2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.base import Task
|
|
|
|
from bootstrapvz.common import phases
|
2013-09-04 14:46:54 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ImageExecuteCommand(Task):
|
2013-11-24 16:15:01 +01:00
|
|
|
description = 'Execute command in the image'
|
|
|
|
phase = phases.system_modification
|
2013-09-04 14:46:54 +02:00
|
|
|
|
2014-01-05 15:57:11 +01:00
|
|
|
@classmethod
|
|
|
|
def run(cls, info):
|
2014-03-23 23:12:07 +01:00
|
|
|
from bootstrapvz.common.tools import log_check_call
|
2014-01-12 12:58:29 +01:00
|
|
|
for raw_command in info.manifest.plugins['image_commands']['commands']:
|
2014-01-14 08:46:53 +01:00
|
|
|
command = map(lambda part: part.format(root=info.root, **info.manifest_vars), raw_command)
|
2015-03-27 11:23:58 -03:00
|
|
|
shell = len(command) == 1
|
|
|
|
log_check_call(command, shell=shell)
|