cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #02760
[Merge] ~ajorgens/cloud-init:user-shell into cloud-init:master
Andrew Jorgensen has proposed merging ~ajorgens/cloud-init:user-shell into cloud-init:master.
Requested reviews:
cloud-init commiters (cloud-init-dev)
For more details, see:
https://code.launchpad.net/~ajorgens/cloud-init/+git/cloud-init/+merge/325857
--
Your team cloud-init commiters is requested to review the proposed merge of ~ajorgens/cloud-init:user-shell into cloud-init:master.
diff --git a/cloudinit/handlers/boot_hook.py b/cloudinit/handlers/boot_hook.py
index 057b4db..1d2eba5 100644
--- a/cloudinit/handlers/boot_hook.py
+++ b/cloudinit/handlers/boot_hook.py
@@ -50,7 +50,9 @@ class BootHookPartHandler(handlers.Handler):
env = os.environ.copy()
if self.instance_id is not None:
env['INSTANCE_ID'] = str(self.instance_id)
- util.subp([filepath], env=env)
+ # Use shell=True so that if the user omits the #!, there is still
+ # some chance it will succeed.
+ util.subp([filepath], env=env, shell=True)
except util.ProcessExecutionError:
util.logexc(LOG, "Boothooks script %s execution error", filepath)
except Exception:
diff --git a/cloudinit/util.py b/cloudinit/util.py
index c93b6d7..c315b70 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -829,7 +829,9 @@ def runparts(dirp, skip_no_exist=True, exe_prefix=None):
if os.path.isfile(exe_path) and os.access(exe_path, os.X_OK):
attempted.append(exe_path)
try:
- subp(prefix + [exe_path], capture=False)
+ # Use shell=True so that if the user omits the #!, there is
+ # still some chance it will succeed.
+ subp(prefix + [exe_path], capture=False, shell=True)
except ProcessExecutionError as e:
logexc(LOG, "Failed running %s [%s]", exe_path, e.exit_code)
failed.append(e)
Follow ups