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
8c9a63bc
Commit
8c9a63bc
authored
Jan 27, 2014
by
Jakub Jirutka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sysctl: parse bool value as 0/1 and refactor a little bit
parent
8ff1b068
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
library/system/sysctl
+11
-4
No files found.
library/system/sysctl
View file @
8c9a63bc
...
...
@@ -120,10 +120,7 @@ class SysctlModule(object):
# Whitespace is bad
self
.
args
[
'name'
]
=
self
.
args
[
'name'
]
.
strip
()
if
self
.
args
[
'value'
]
is
not
None
:
self
.
args
[
'value'
]
=
self
.
args
[
'value'
]
.
strip
()
else
:
self
.
args
[
'value'
]
=
""
self
.
args
[
'value'
]
=
self
.
_parse_value
(
self
.
args
[
'value'
])
thisname
=
self
.
args
[
'name'
]
...
...
@@ -176,6 +173,16 @@ class SysctlModule(object):
return
len
([
i
for
i
,
j
in
zip
(
a
,
b
)
if
i
==
j
])
==
len
(
a
)
def
_parse_value
(
self
,
value
):
if
value
is
None
:
return
''
elif
value
.
lower
()
in
BOOLEANS_TRUE
:
return
'1'
elif
value
.
lower
()
in
BOOLEANS_FALSE
:
return
'0'
else
:
return
value
.
strip
()
# ==============================================================
# SYSCTL COMMAND MANAGEMENT
# ==============================================================
...
...
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