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
97db1676
Commit
97db1676
authored
Feb 26, 2014
by
nate@bx.psu.edu
Committed by
Michael DeHaan
Mar 19, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugfix for xattrless files and the capabilities module.
parent
f26ebff4
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
library/system/capabilities
+6
-6
No files found.
library/system/capabilities
View file @
97db1676
...
...
@@ -84,8 +84,6 @@ class CapabilitiesModule(object):
self
.
setcap_cmd
=
module
.
get_bin_path
(
'setcap'
,
required
=
True
)
self
.
capability_tup
=
self
.
_parse_cap
(
self
.
capability
,
op_required
=
self
.
state
==
'present'
)
self
.
changed
=
False
self
.
run
()
def
run
(
self
):
...
...
@@ -102,15 +100,16 @@ class CapabilitiesModule(object):
current
=
filter
(
lambda
x
:
x
[
0
]
!=
self
.
capability_tup
[
0
],
current
)
# add new cap with correct op/flags
current
.
append
(
self
.
capability_tup
)
self
.
module
.
exit_json
(
changed
=
True
,
msg
=
'capabilities changed'
,
stdout
=
self
.
setcap
(
self
.
path
,
current
))
if
self
.
state
==
'absent'
and
self
.
capability_tup
[
0
]
in
caps
:
self
.
module
.
exit_json
(
changed
=
True
,
state
=
self
.
state
,
msg
=
'capabilities changed'
,
stdout
=
self
.
setcap
(
self
.
path
,
current
))
el
if
self
.
state
==
'absent'
and
self
.
capability_tup
[
0
]
in
caps
:
# need to remove capability
if
self
.
module
.
check_mode
:
self
.
module
.
exit_json
(
changed
=
True
,
msg
=
'capabilities changed'
)
else
:
# remove from current cap list and then set current list
current
=
filter
(
lambda
x
:
x
[
0
]
!=
self
.
capability_tup
[
0
],
current
)
self
.
module
.
exit_json
(
changed
=
True
,
msg
=
'capabilities changed'
,
stdout
=
self
.
setcap
(
self
.
path
,
current
))
self
.
module
.
exit_json
(
changed
=
True
,
state
=
self
.
state
,
msg
=
'capabilities changed'
,
stdout
=
self
.
setcap
(
self
.
path
,
current
))
self
.
module
.
exit_json
(
changed
=
False
,
state
=
self
.
state
)
def
getcap
(
self
,
path
):
rval
=
[]
...
...
@@ -123,7 +122,8 @@ class CapabilitiesModule(object):
# If the file does not eixst the output will be (with rc == 0...):
# '/foo (No such file or directory)'
if
rc
!=
0
or
(
stdout
.
strip
()
!=
path
and
stdout
.
count
(
' ='
)
!=
1
):
self
.
module
.
fail_json
(
msg
=
"Unable to get capabilities of
%
s"
%
path
,
stdout
=
stdout
,
stderr
=
stderr
)
self
.
module
.
fail_json
(
msg
=
"Unable to get capabilities of
%
s"
%
path
,
stdout
=
stdout
.
strip
(),
stderr
=
stderr
)
if
stdout
.
strip
()
!=
path
:
caps
=
stdout
.
split
(
' ='
)[
1
]
.
strip
()
.
split
()
for
cap
in
caps
:
cap
=
cap
.
lower
()
...
...
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