From d025a47d822a4fe1ae06aebe987482e66946a673 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 26 Oct 2022 14:41:06 +0000 Subject: [PATCH] Correct returns for copy and script execution --- bootstrap-daemon/pvcbootstrapd/lib/hooks.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/bootstrap-daemon/pvcbootstrapd/lib/hooks.py b/bootstrap-daemon/pvcbootstrapd/lib/hooks.py index 9f492cb..8c50ef8 100755 --- a/bootstrap-daemon/pvcbootstrapd/lib/hooks.py +++ b/bootstrap-daemon/pvcbootstrapd/lib/hooks.py @@ -219,11 +219,14 @@ def run_hook_copy(config, targets, args): tc.chmod(dfile, int(dmode, 8)) tc.close() + return 0 + def run_hook_script(config, targets, args): """ Run a script on the targets """ + return_status = 0 for node in targets: node_name = node.name node_address = node.host_ipaddr @@ -274,8 +277,10 @@ def run_hook_script(config, targets, args): stdin, stdout, stderr = c.exec_command(remote_command) logger.debug(stdout.readlines()) logger.debug(stderr.readlines()) + if stdout.channel.recv_exit_status() != 0: + return_status = stdout.channel.recv_exit_status() - return stdout.channel.recv_exit_status() + return return_status def run_hook_webhook(config, targets, args):