correctly compare the values, better func name
This commit is contained in:
parent
45728d739c
commit
be69ca4ead
1 changed files with 3 additions and 3 deletions
|
@ -148,7 +148,7 @@ class SysctlModule(object):
|
||||||
if self.args['sysctl_set']:
|
if self.args['sysctl_set']:
|
||||||
if self.proc_value is None:
|
if self.proc_value is None:
|
||||||
self.changed = True
|
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.changed = True
|
||||||
self.set_proc = True
|
self.set_proc = True
|
||||||
|
|
||||||
|
@ -161,7 +161,7 @@ class SysctlModule(object):
|
||||||
if self.set_proc:
|
if self.set_proc:
|
||||||
self.set_token_value(self.args['name'], self.args['value'])
|
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
|
"""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,
|
and compare each value. It will return True if both lists are the same,
|
||||||
contain the same elements and the same order."""
|
contain the same elements and the same order."""
|
||||||
|
@ -174,7 +174,7 @@ class SysctlModule(object):
|
||||||
if len(a) != len(b):
|
if len(a) != len(b):
|
||||||
return False
|
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
|
# SYSCTL COMMAND MANAGEMENT
|
||||||
|
|
Loading…
Reference in a new issue