From 66924b842228e7178301aa399d30459155b35762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Lyson=C4=9Bk?= Date: Tue, 9 Jul 2019 11:31:20 +0200 Subject: [PATCH] plugin_script: Execute all scripts regardless of errors MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Due to commit d4038a7e64af3, if a script fails to execute or its exit code is non-zero, no subsequent scripts are executed. This seems logically wrong and it causes problems especially during rollback as some tunings may not be reverted due to this behaviour. Also, it appears it was not the intention of that commit to change this behaviour - the intention rather seems to have been to make _call_scripts return success/error information for use by the verification mechanism. So let's aggregate the success/error information instead. Related: https://github.com/redhat-performance/tuned/pull/194 Signed-off-by: Ondřej Lysoněk --- tuned/plugins/plugin_script.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/tuned/plugins/plugin_script.py b/tuned/plugins/plugin_script.py index 940c1f9..19b7fc6 100644 --- a/tuned/plugins/plugin_script.py +++ b/tuned/plugins/plugin_script.py @@ -31,6 +31,7 @@ class ScriptPlugin(base.Plugin): pass def _call_scripts(self, scripts, arguments): + ret = True for script in scripts: environ = os.environ environ.update(self._variables.get_env()) @@ -47,11 +48,11 @@ class ScriptPlugin(base.Plugin): log.error("script '%s' error output: '%s'" % (script, err[:-1])) if proc.returncode: log.error("script '%s' returned error code: %d" % (script, proc.returncode)) - return False + ret = False except (OSError,IOError) as e: log.error("script '%s' error: %s" % (script, e)) - return False - return True + ret = False + return ret def _instance_apply_static(self, instance): super(ScriptPlugin, self)._instance_apply_static(instance)