Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
d2e457f8
Commit
d2e457f8
authored
Apr 23, 2013
by
Aaron Brady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accept numeric user and group parameters
parent
1f969251
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
lib/ansible/module_common.py
+6
-0
No files found.
lib/ansible/module_common.py
View file @
d2e457f8
...
@@ -369,6 +369,9 @@ class AnsibleModule(object):
...
@@ -369,6 +369,9 @@ class AnsibleModule(object):
user, group = self.user_and_group(path)
user, group = self.user_and_group(path)
if owner != user:
if owner != user:
try:
try:
uid = int(owner)
except ValueError:
try:
uid = pwd.getpwnam(owner).pw_uid
uid = pwd.getpwnam(owner).pw_uid
except KeyError:
except KeyError:
self.fail_json(path=path, msg='chown failed: failed to look up user
%
s'
%
owner)
self.fail_json(path=path, msg='chown failed: failed to look up user
%
s'
%
owner)
...
@@ -390,6 +393,9 @@ class AnsibleModule(object):
...
@@ -390,6 +393,9 @@ class AnsibleModule(object):
if self.check_mode:
if self.check_mode:
return True
return True
try:
try:
gid = int(group)
except ValueError:
try:
gid = grp.getgrnam(group).gr_gid
gid = grp.getgrnam(group).gr_gid
except KeyError:
except KeyError:
self.fail_json(path=path, msg='chgrp failed: failed to look up group
%
s'
%
group)
self.fail_json(path=path, msg='chgrp failed: failed to look up group
%
s'
%
group)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment