mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
Remove 'Volume' part from ebs tasks.
It's kind of obvious that we are working with volumes in the ebs module.
This commit is contained in:
parent
5c4456139d
commit
9f85cdf909
5 changed files with 24 additions and 25 deletions
|
@ -1,5 +1,5 @@
|
|||
from tasks import CreateSnapshot
|
||||
from tasks import CreateVolumeFromSnapshot
|
||||
from tasks import Snapshot
|
||||
from tasks import CreateFromSnapshot
|
||||
from providers.ec2.tasks import ebs
|
||||
|
||||
|
||||
|
@ -7,9 +7,9 @@ def tasks(tasklist, manifest):
|
|||
from providers.ec2.tasks import bootstrap
|
||||
from providers.ec2.tasks import filesystem
|
||||
if manifest.plugins['prebootstrapped']['snapshot'] == "":
|
||||
tasklist.add(CreateSnapshot())
|
||||
tasklist.add(Snapshot())
|
||||
else:
|
||||
tasklist.replace(ebs.CreateVolume, CreateVolumeFromSnapshot())
|
||||
tasklist.replace(ebs.Create, CreateFromSnapshot())
|
||||
tasklist.remove(filesystem.FormatVolume,
|
||||
filesystem.TuneVolumeFS,
|
||||
filesystem.AddXFSProgs,
|
||||
|
@ -24,7 +24,7 @@ def rollback_tasks(tasklist, tasks_completed, manifest):
|
|||
if task in completed and counter not in completed:
|
||||
tasklist.add(counter())
|
||||
|
||||
counter_task(CreateVolumeFromSnapshot, ebs.DeleteVolume)
|
||||
counter_task(CreateFromSnapshot, ebs.Delete)
|
||||
|
||||
|
||||
def validate_manifest(data, schema_validate):
|
||||
|
|
|
@ -8,11 +8,11 @@ import logging
|
|||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CreateVolumeFromSnapshot(Task):
|
||||
class CreateFromSnapshot(Task):
|
||||
description = 'Creating EBS volume from a snapshot'
|
||||
phase = phases.volume_creation
|
||||
after = [connection.Connect]
|
||||
before = [ebs.AttachVolume]
|
||||
before = [ebs.Attach]
|
||||
|
||||
def run(self, info):
|
||||
volume_size = int(info.manifest.volume['size']/1024)
|
||||
|
@ -25,12 +25,12 @@ class CreateVolumeFromSnapshot(Task):
|
|||
info.volume.update()
|
||||
|
||||
|
||||
class CreateSnapshot(ebs.CreateSnapshot):
|
||||
class Snapshot(ebs.Snapshot):
|
||||
description = 'Creating a snapshot of the bootstrapped volume'
|
||||
phase = phases.os_installation
|
||||
after = [bootstrap.Bootstrap]
|
||||
|
||||
def run(self, info):
|
||||
super(CreateSnapshot, self).run(info)
|
||||
super(Snapshot, self).run(info)
|
||||
msg = 'A snapshot of the bootstrapped volume was created. ID: {id}'.format(id=info.snapshot.id)
|
||||
log.info(msg)
|
||||
|
|
|
@ -30,8 +30,8 @@ def tasks(tasklist, manifest):
|
|||
ami.AMIName(),
|
||||
connection.Connect())
|
||||
if manifest.volume['backing'].lower() == 'ebs':
|
||||
tasklist.add(ebs.CreateVolume(),
|
||||
ebs.AttachVolume())
|
||||
tasklist.add(ebs.Create(),
|
||||
ebs.Attach())
|
||||
tasklist.add(filesystem.FormatVolume())
|
||||
if manifest.volume['filesystem'].lower() == 'xfs':
|
||||
tasklist.add(filesystem.AddXFSProgs())
|
||||
|
@ -70,9 +70,9 @@ def tasks(tasklist, manifest):
|
|||
filesystem.UnmountVolume(),
|
||||
filesystem.DeleteMountDir())
|
||||
if manifest.volume['backing'].lower() == 'ebs':
|
||||
tasklist.add(ebs.DetachVolume(),
|
||||
ebs.CreateSnapshot(),
|
||||
ebs.DeleteVolume())
|
||||
tasklist.add(ebs.Detach(),
|
||||
ebs.Snapshot(),
|
||||
ebs.Delete())
|
||||
tasklist.add(ami.RegisterAMI())
|
||||
|
||||
|
||||
|
@ -84,8 +84,8 @@ def rollback_tasks(tasklist, tasks_completed, manifest):
|
|||
tasklist.add(counter())
|
||||
|
||||
if manifest.volume['backing'].lower() == 'ebs':
|
||||
counter_task(ebs.CreateVolume, ebs.DeleteVolume)
|
||||
counter_task(ebs.AttachVolume, ebs.DetachVolume)
|
||||
counter_task(ebs.Create, ebs.Delete)
|
||||
counter_task(ebs.Attach, ebs.Detach)
|
||||
counter_task(filesystem.CreateMountDir, filesystem.DeleteMountDir)
|
||||
counter_task(filesystem.MountVolume, filesystem.UnmountVolume)
|
||||
counter_task(filesystem.MountSpecials, filesystem.UnmountSpecials)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
from ebs import CreateSnapshot
|
||||
from ebs import Snapshot
|
||||
from connection import Connect
|
||||
from common.exceptions import TaskError
|
||||
|
||||
|
@ -38,7 +38,7 @@ class AMIName(Task):
|
|||
class RegisterAMI(Task):
|
||||
description = 'Registering the image as an AMI'
|
||||
phase = phases.image_registration
|
||||
after = [CreateSnapshot]
|
||||
after = [Snapshot]
|
||||
|
||||
kernel_mapping = {'us-east-1': {'amd64': 'aki-88aa75e1',
|
||||
'i386': 'aki-b6aa75df'},
|
||||
|
|
|
@ -5,7 +5,7 @@ from filesystem import UnmountVolume
|
|||
import time
|
||||
|
||||
|
||||
class CreateVolume(Task):
|
||||
class Create(Task):
|
||||
description = 'Creating an EBS volume for bootstrapping'
|
||||
phase = phases.volume_creation
|
||||
|
||||
|
@ -17,10 +17,10 @@ class CreateVolume(Task):
|
|||
info.volume.update()
|
||||
|
||||
|
||||
class AttachVolume(Task):
|
||||
class Attach(Task):
|
||||
description = 'Attaching the EBS volume'
|
||||
phase = phases.volume_creation
|
||||
after = [CreateVolume]
|
||||
after = [Create]
|
||||
|
||||
def run(self, info):
|
||||
def char_range(c1, c2):
|
||||
|
@ -45,7 +45,7 @@ class AttachVolume(Task):
|
|||
info.volume.update()
|
||||
|
||||
|
||||
class DetachVolume(Task):
|
||||
class Detach(Task):
|
||||
description = 'Detaching the EBS volume'
|
||||
phase = phases.volume_unmounting
|
||||
after = [UnmountVolume]
|
||||
|
@ -57,7 +57,7 @@ class DetachVolume(Task):
|
|||
info.volume.update()
|
||||
|
||||
|
||||
class CreateSnapshot(Task):
|
||||
class Snapshot(Task):
|
||||
description = 'Creating a snapshot of the EBS volume'
|
||||
phase = phases.image_registration
|
||||
|
||||
|
@ -68,10 +68,9 @@ class CreateSnapshot(Task):
|
|||
info.snapshot.update()
|
||||
|
||||
|
||||
class DeleteVolume(Task):
|
||||
class Delete(Task):
|
||||
description = 'Deleting the EBS volume'
|
||||
phase = phases.cleaning
|
||||
after = []
|
||||
|
||||
def run(self, info):
|
||||
info.volume.delete()
|
||||
|
|
Loading…
Add table
Reference in a new issue