mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 15:36:27 +00:00
Implemented prebootstrapped plugin
This commit is contained in:
parent
b8341c48e4
commit
8479ff4dca
3 changed files with 21 additions and 8 deletions
|
@ -33,6 +33,10 @@
|
||||||
"build_metadata": {
|
"build_metadata": {
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"path" : "/root/build-metadata-{ami_name}"
|
"path" : "/root/build-metadata-{ami_name}"
|
||||||
|
},
|
||||||
|
"prebootstrapped": {
|
||||||
|
"enabled": false,
|
||||||
|
"snapshot": ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,13 @@
|
||||||
|
|
||||||
|
|
||||||
def tasks(tasklist, manifest):
|
def tasks(tasklist, manifest):
|
||||||
from ebs import CreateVolumeFromSnapshot
|
from tasks import CreateVolumeFromSnapshot
|
||||||
from providers.ec2.tasks.ebs import CreateVolume
|
from providers.ec2.tasks import ebs
|
||||||
tasklist.replace(CreateVolume, CreateVolumeFromSnapshot())
|
from providers.ec2.tasks import bootstrap
|
||||||
|
from providers.ec2.tasks import filesystem
|
||||||
|
tasklist.replace(ebs.CreateVolume, CreateVolumeFromSnapshot())
|
||||||
|
tasklist.remove(filesystem.FormatVolume,
|
||||||
|
filesystem.TuneVolumeFS,
|
||||||
|
filesystem.AddXFSProgs,
|
||||||
|
bootstrap.MakeTarball,
|
||||||
|
bootstrap.Bootstrap)
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
from base import Task
|
from base import Task
|
||||||
from common import phases
|
from common import phases
|
||||||
from connection import Connect
|
from providers.ec2.tasks import connection
|
||||||
|
from providers.ec2.tasks import ebs
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class CreateVolumeFromSnapshot(Task):
|
class CreateVolumeFromSnapshot(Task):
|
||||||
phase = phases.volume_creation
|
phase = phases.volume_creation
|
||||||
after = [Connect]
|
after = [connection.Connect]
|
||||||
|
before = [ebs.AttachVolume]
|
||||||
|
|
||||||
description = 'Creating an EBS volume from a snapshot'
|
description = 'Creating EBS volume from a snapshot'
|
||||||
|
|
||||||
def run(self, info):
|
def run(self, info):
|
||||||
volume_size = int(info.manifest.volume['size']/1024)
|
volume_size = int(info.manifest.volume['size']/1024)
|
||||||
snapshot_id = info.manifest.plugins['prebootstrapped'].snapshot_id
|
snapshot = info.manifest.plugins['prebootstrapped']['snapshot']
|
||||||
info.volume = info.connection.create_volume(volume_size,
|
info.volume = info.connection.create_volume(volume_size,
|
||||||
info.host['availabilityZone'],
|
info.host['availabilityZone'],
|
||||||
snapshot=snapshot_id)
|
snapshot=snapshot)
|
||||||
while info.volume.volume_state() != 'available':
|
while info.volume.volume_state() != 'available':
|
||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
info.volume.update()
|
info.volume.update()
|
Loading…
Add table
Reference in a new issue