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
46755670
Commit
46755670
authored
Feb 23, 2013
by
Michael DeHaan
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2145 from leucos/sysctl_no_file_check
Better sysctl module file check
parents
274f15b5
e0496634
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
9 deletions
+7
-9
library/sysctl
+7
-9
No files found.
library/sysctl
View file @
46755670
...
...
@@ -155,15 +155,6 @@ def sysctl_check(current_step, **sysctl_args):
if
not
os
.
access
(
sysctl_args
[
'key_path'
],
os
.
R_OK
):
return
1
,
'key_path is not a readable file, key seems to be uncheckable'
# sysctl file exists and openable ?
# TODO choose if prefered to use os.access() instead try/catch on open
if
current_step
==
'before'
:
try
:
f
=
open
(
sysctl_args
[
'sysctl_file'
])
f
.
close
()
except
IOError
,
e
:
return
1
,
'unable to open supplied sysctl.conf'
# no smart checks at this step ?
if
sysctl_args
[
'checks'
]
==
'none'
:
return
0
,
''
...
...
@@ -244,6 +235,13 @@ def main():
if
res
!=
0
:
module
.
fail_json
(
msg
=
'checks_before failed with: '
+
msg
)
if
not
os
.
access
(
sysctl_args
[
'sysctl_file'
],
os
.
W_OK
):
try
:
f
=
open
(
sysctl_args
[
'sysctl_file'
],
'w'
)
f
.
close
()
except
IOError
,
e
:
module
.
fail_json
(
msg
=
'unable to create supplied sysctl file (destination directory probably missing)'
)
# reading the file
for
line
in
open
(
sysctl_args
[
'sysctl_file'
],
'r'
)
.
readlines
():
if
not
line
.
strip
():
...
...
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