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
3db808c8
Commit
3db808c8
authored
Jan 18, 2014
by
Simon Zimmermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
correctly compare the values, better func name
parent
055b404f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
library/system/sysctl
+3
-3
No files found.
library/system/sysctl
View file @
3db808c8
...
...
@@ -148,7 +148,7 @@ class SysctlModule(object):
if
self
.
args
[
'sysctl_set'
]:
if
self
.
proc_value
is
None
:
self
.
changed
=
True
elif
self
.
_compare_values
(
self
.
proc_value
,
self
.
args
[
'value'
]):
elif
not
self
.
_values_is_equal
(
self
.
proc_value
,
self
.
args
[
'value'
]):
self
.
changed
=
True
self
.
set_proc
=
True
...
...
@@ -161,7 +161,7 @@ class SysctlModule(object):
if
self
.
set_proc
:
self
.
set_token_value
(
self
.
args
[
'name'
],
self
.
args
[
'value'
])
def
_
compare_values
(
self
,
a
,
b
):
def
_
values_is_equal
(
self
,
a
,
b
):
"""Expects two string values. It will split the string by whitespace
and compare each value. It will return True if both lists are the same,
contain the same elements and the same order."""
...
...
@@ -174,7 +174,7 @@ class SysctlModule(object):
if
len
(
a
)
!=
len
(
b
):
return
False
return
len
([
i
for
i
,
j
in
zip
(
a
,
b
)
if
i
==
j
])
!
=
len
(
a
)
return
len
([
i
for
i
,
j
in
zip
(
a
,
b
)
if
i
==
j
])
=
=
len
(
a
)
# ==============================================================
# 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