Correctly pass custom env to lxc-attach

lxc-attach doesn't understand commands with environment variables
prepended (i.e. "FOO=bar baz") and tells command is not found.

Use configured shell to set PATH environment variables and call
bootstrap script.

Backported from 2015.2.
This commit is contained in:
cellscape 2015-05-08 12:52:34 +06:00
parent 7fb85f7be1
commit 934bc57c73

View file

@ -2054,8 +2054,8 @@ def bootstrap(name, config=None, approve_key=True,
cp(name, cfg_files['pubkey'],
os.path.join(configdir, 'minion.pub'))
bootstrap_args = bootstrap_args.format(configdir)
cmd = ('PATH=$PATH:/bin:/sbin:/usr/sbin'
' {0} /tmp/bootstrap.sh {1}').format(
cmd = ("{0} -c 'PATH=$PATH:/bin:/sbin:/usr/sbin"
" {0} /tmp/bootstrap.sh {1}'").format(
bootstrap_shell, bootstrap_args)
# log ASAP the forged bootstrap command which can be wrapped
# out of the output in case of unexpected problem