bootstrap-vz/bootstrapvz/plugins/image_commands/tasks.py
Jonh Wendell 8ee0af1a3b 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 '*'.
2015-03-27 11:23:58 -03:00

15 lines
516 B
Python

from bootstrapvz.base import Task
from bootstrapvz.common import phases
class ImageExecuteCommand(Task):
description = 'Execute command in the image'
phase = phases.system_modification
@classmethod
def run(cls, info):
from bootstrapvz.common.tools import log_check_call
for raw_command in info.manifest.plugins['image_commands']['commands']:
command = map(lambda part: part.format(root=info.root, **info.manifest_vars), raw_command)
shell = len(command) == 1
log_check_call(command, shell=shell)