Support additional arguments to a script execution

This commit is contained in:
Joshua Boniface 2022-06-23 16:23:28 -04:00
parent 68ebfae6af
commit 0f2ff07aed
1 changed files with 7 additions and 1 deletions

View File

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