diff --git a/tuned/plugins/plugin_script.py b/tuned/plugins/plugin_script.py index 9948060..0cb6a34 100644 --- a/tuned/plugins/plugin_script.py +++ b/tuned/plugins/plugin_script.py @@ -16,7 +16,7 @@ class ScriptPlugin(base.Plugin): if self._options["script"] is None: return - self._scripts.append(self._options["script"]) + self._scripts.extend(self._options["script"]) @classmethod def tunable_devices(self): @@ -30,7 +30,7 @@ class ScriptPlugin(base.Plugin): def _call_scripts(self, arg = "start"): for script in self._scripts: - log.info("Calling script %s" % (script)) + log.info("Calling script %s with arg %s" % (script, arg)) try: proc = Popen([script, arg], stdout=PIPE, stderr=PIPE) out, err = proc.communicate() diff --git a/tuned/profiles/loader.py b/tuned/profiles/loader.py index f2bdee9..497c2cf 100644 --- a/tuned/profiles/loader.py +++ b/tuned/profiles/loader.py @@ -86,9 +86,9 @@ class Loader(object): # TODO: HACK, this needs to be solved in a better way (better config parser) for unit_name in config: - if config[unit_name].get("type", None) == "script" and "script" in config[unit_name]: + if "script" in config[unit_name] and config[unit_name].get("script", None) is not None: dir_name = os.path.dirname(file_name) script_path = os.path.join(dir_name, config[unit_name]["script"]) - config[unit_name]["script"] = os.path.normpath(script_path) + config[unit_name]["script"] = [os.path.normpath(script_path)] return config diff --git a/tuned/profiles/merger.py b/tuned/profiles/merger.py index 31fe2f6..0a4660d 100644 --- a/tuned/profiles/merger.py +++ b/tuned/profiles/merger.py @@ -32,6 +32,11 @@ class Merger(object): profile_a.units[unit_name].type = unit.type profile_a.units[unit_name].enabled = unit.enabled profile_a.units[unit_name].devices = unit.devices - profile_a.units[unit_name].options.update(unit.options) + if unit_name == "script" and profile_a.units[unit_name].options.get("script", None) is not None: + script = profile_a.units[unit_name].options.get("script", None) + profile_a.units[unit_name].options.update(unit.options) + profile_a.units[unit_name].options["script"] = script + profile_a.units[unit_name].options["script"] + else: + profile_a.units[unit_name].options.update(unit.options) return profile_a