bootstrap-vz/common/tasks/volume.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

31 lines
572 B
Python

from base import Task
from common import phases
from common.tasks import workspace
class Attach(Task):
description = 'Attaching the volume'
phase = phases.volume_creation
@classmethod
def run(cls, info):
info.volume.attach()
class Detach(Task):
description = 'Detaching the volume'
phase = phases.volume_unmounting
@classmethod
def run(cls, info):
info.volume.detach()
class Delete(Task):
description = 'Deleting the volume'
phase = phases.cleaning
successors = [workspace.DeleteWorkspace]
@classmethod
def run(cls, info):
info.volume.delete()