mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Accept numeric user and group parameters
This commit is contained in:
parent
1f96925159
commit
d2e457f81f
1 changed files with 12 additions and 6 deletions
|
@ -368,6 +368,9 @@ class AnsibleModule(object):
|
|||
return changed
|
||||
user, group = self.user_and_group(path)
|
||||
if owner != user:
|
||||
try:
|
||||
uid = int(owner)
|
||||
except ValueError:
|
||||
try:
|
||||
uid = pwd.getpwnam(owner).pw_uid
|
||||
except KeyError:
|
||||
|
@ -389,6 +392,9 @@ class AnsibleModule(object):
|
|||
if old_group != group:
|
||||
if self.check_mode:
|
||||
return True
|
||||
try:
|
||||
gid = int(group)
|
||||
except ValueError:
|
||||
try:
|
||||
gid = grp.getgrnam(group).gr_gid
|
||||
except KeyError:
|
||||
|
|
Loading…
Reference in a new issue