bootstrap-vz/plugins/image_commands/tasks.py
Anders Ingemann 0092e1c2c2 Don't instantiate tasks
In practice they are just typed functions with attributes, having a reference to an object is just confusing.
So: Task.run() is now a classmethod
2014-01-06 22:58:21 +01:00

18 lines
453 B
Python

from base import Task
from common import phases
class ImageExecuteCommand(Task):
description = 'Execute command in the image'
phase = phases.system_modification
@classmethod
def run(cls, info):
from common.tools import log_check_call
for user_cmd in info.manifest.plugins['image_commands']['commands']:
command = []
for elt in user_cmd:
fragment = elt.format(root=info.root)
command.append(fragment)
log_check_call(command)