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
b7082677
Commit
b7082677
authored
Aug 28, 2014
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8790 from sivel/issue/8784
Don't use ternary if statements. Fixes #8784
parents
ab495d19
2b307985
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
3 deletions
+17
-3
lib/ansible/module_utils/basic.py
+17
-3
No files found.
lib/ansible/module_utils/basic.py
View file @
b7082677
...
...
@@ -608,12 +608,24 @@ class AnsibleModule(object):
# Permission bits constants documented at:
# http://docs.python.org/2/library/stat.html#stat.S_ISUID
if
apply_X_permission
:
X_perms
=
{
'u'
:
{
'X'
:
stat
.
S_IXUSR
},
'g'
:
{
'X'
:
stat
.
S_IXGRP
},
'o'
:
{
'X'
:
stat
.
S_IXOTH
}
}
else
:
X_perms
=
{
'u'
:
{
'X'
:
0
},
'g'
:
{
'X'
:
0
},
'o'
:
{
'X'
:
0
}
}
user_perms_to_modes
=
{
'u'
:
{
'r'
:
stat
.
S_IRUSR
,
'w'
:
stat
.
S_IWUSR
,
'x'
:
stat
.
S_IXUSR
,
'X'
:
stat
.
S_IXUSR
if
apply_X_permission
else
0
,
's'
:
stat
.
S_ISUID
,
't'
:
0
,
'u'
:
prev_mode
&
stat
.
S_IRWXU
,
...
...
@@ -623,7 +635,6 @@ class AnsibleModule(object):
'r'
:
stat
.
S_IRGRP
,
'w'
:
stat
.
S_IWGRP
,
'x'
:
stat
.
S_IXGRP
,
'X'
:
stat
.
S_IXGRP
if
apply_X_permission
else
0
,
's'
:
stat
.
S_ISGID
,
't'
:
0
,
'u'
:
(
prev_mode
&
stat
.
S_IRWXU
)
>>
3
,
...
...
@@ -633,7 +644,6 @@ class AnsibleModule(object):
'r'
:
stat
.
S_IROTH
,
'w'
:
stat
.
S_IWOTH
,
'x'
:
stat
.
S_IXOTH
,
'X'
:
stat
.
S_IXOTH
if
apply_X_permission
else
0
,
's'
:
0
,
't'
:
stat
.
S_ISVTX
,
'u'
:
(
prev_mode
&
stat
.
S_IRWXU
)
>>
6
,
...
...
@@ -641,6 +651,10 @@ class AnsibleModule(object):
'o'
:
prev_mode
&
stat
.
S_IRWXO
}
}
# Insert X_perms into user_perms_to_modes
for
key
,
value
in
X_perms
.
items
():
user_perms_to_modes
[
key
]
.
update
(
value
)
or_reduce
=
lambda
mode
,
perm
:
mode
|
user_perms_to_modes
[
user
][
perm
]
return
reduce
(
or_reduce
,
perms
,
0
)
...
...
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