diff --git a/tuned/plugins/plugin_sysctl.py b/tuned/plugins/plugin_sysctl.py index 84c3077..eddcbf7 100644 --- a/tuned/plugins/plugin_sysctl.py +++ b/tuned/plugins/plugin_sysctl.py @@ -51,7 +51,7 @@ class SysctlPlugin(base.Plugin): ret = True for option, value in instance._sysctl.iteritems(): curr_val = self._read_sysctl(option) - if self._verify_value(option, value, curr_val) == False: + if self._verify_value(option, self._cmd.remove_ws(value), curr_val) == False: ret = False return ret @@ -67,7 +67,7 @@ class SysctlPlugin(base.Plugin): def _read_sysctl(self, option): retcode, stdout = self._execute_sysctl(["-e", option]) if retcode == 0: - parts = map(lambda value: re.sub('\s+', ' ', value).strip(), stdout.split("=", 1)) + parts = map(lambda value: self._cmd.remove_ws(value), stdout.split("=", 1)) if len(parts) == 2: option, value = parts return value diff --git a/tuned/utils/commands.py b/tuned/utils/commands.py index 0be27f3..ab3bef6 100644 --- a/tuned/utils/commands.py +++ b/tuned/utils/commands.py @@ -26,6 +26,9 @@ class commands: v = str(value).upper().strip() return {"Y":"1", "YES":"1", "T":"1", "TRUE":"1", "N":"0", "NO":"0", "F":"0", "FALSE":"0"}.get(v, value) + def remove_ws(self, s): + return re.sub('\s+', ' ', s).strip() + def write_to_file(self, f, data): self._debug("Writing to file: %s < %s" % (f, data)) try: