diff --git a/bootstrap-daemon/pvcbootstrapd/lib/hooks.py b/bootstrap-daemon/pvcbootstrapd/lib/hooks.py index f43bb44..9bed4d9 100755 --- a/bootstrap-daemon/pvcbootstrapd/lib/hooks.py +++ b/bootstrap-daemon/pvcbootstrapd/lib/hooks.py @@ -227,6 +227,7 @@ def run_hook_script(config, targets, args): source = args.get("source", None) path = args.get("path", None) arguments = args.get("arguments", []) + use_sudo = args.get("use_sudo", False) logger.info(f"Running script on node {node_name}") @@ -262,6 +263,9 @@ def run_hook_script(config, targets, args): else: remote_command = remote_path + if use_sudo: + remote_command = f"sudo {remote_command}" + stdin, stdout, stderr = c.exec_command(remote_command) logger.debug(stdout.readlines()) logger.debug(stderr.readlines())