From 0f2ff07aed9576fb85c913326f1eb9342cd09232 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 23 Jun 2022 16:23:28 -0400 Subject: [PATCH] Support additional arguments to a script execution --- bootstrap-daemon/pvcbootstrapd/lib/hooks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bootstrap-daemon/pvcbootstrapd/lib/hooks.py b/bootstrap-daemon/pvcbootstrapd/lib/hooks.py index 15588d7..e011be6 100755 --- a/bootstrap-daemon/pvcbootstrapd/lib/hooks.py +++ b/bootstrap-daemon/pvcbootstrapd/lib/hooks.py @@ -225,6 +225,7 @@ def run_hook_script(config, targets, args): script = args.get("script", None) source = args.get("source", None) path = args.get("path", None) + arguments = args.get("arguments", []) logger.info(f"Running script on node {node_name}") @@ -255,7 +256,12 @@ def run_hook_script(config, targets, args): elif source == "remote": remote_path = path - stdin, stdout, stderr = c.exec_command(remote_path) + if len(arguments) > 0: + remote_command = f"{remote_path} {' '.join(arguments)}" + else: + remote_command = remote_path + + stdin, stdout, stderr = c.exec_command(remote_command) logger.debug(stdout.readlines()) logger.debug(stderr.readlines())