1
0
Fork 0

plugin_script: Execute all scripts regardless of errors

Due to commit d4038a7e64, 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 <olysonek@redhat.com>
This commit is contained in:
Ondřej Lysoněk 2019-07-09 11:31:20 +02:00
parent b514cda168
commit 66924b8422

View file

@ -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)