mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Execute entries with a single string as shell commands
Documentation says about that, but it's not implemented like that. If the command to be executed is an array with just one string, it's likely the user passed the entire command inside the string. Plus, they benefit from shell expansion of wildcards like '*'.
This commit is contained in:
parent
3d86cc3d72
commit
8ee0af1a3b
2 changed files with 8 additions and 1 deletions
|
@ -10,6 +10,12 @@ Plugin is defined in the manifest file, plugin section with:
|
||||||
|
|
||||||
The *commands* element is an array of commands. Each command is an array describing the executable and its arguments.
|
The *commands* element is an array of commands. Each command is an array describing the executable and its arguments.
|
||||||
|
|
||||||
|
If you need shell expansion of wildcards, like __\*__, just put the entire command as a single entry:
|
||||||
|
|
||||||
|
"image_commands": {
|
||||||
|
"commands": [ [ "rm -f /tmp/*" ]],
|
||||||
|
}
|
||||||
|
|
||||||
Command is executed in current context. It is possible to use variables to access the image or execute chroot commands in the image.
|
Command is executed in current context. It is possible to use variables to access the image or execute chroot commands in the image.
|
||||||
|
|
||||||
Available variables are:
|
Available variables are:
|
||||||
|
|
|
@ -11,4 +11,5 @@ class ImageExecuteCommand(Task):
|
||||||
from bootstrapvz.common.tools import log_check_call
|
from bootstrapvz.common.tools import log_check_call
|
||||||
for raw_command in info.manifest.plugins['image_commands']['commands']:
|
for raw_command in info.manifest.plugins['image_commands']['commands']:
|
||||||
command = map(lambda part: part.format(root=info.root, **info.manifest_vars), raw_command)
|
command = map(lambda part: part.format(root=info.root, **info.manifest_vars), raw_command)
|
||||||
log_check_call(command)
|
shell = len(command) == 1
|
||||||
|
log_check_call(command, shell=shell)
|
||||||
|
|
Loading…
Add table
Reference in a new issue