mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 18:00:35 +00:00
Unfinished new plugin to speed up bootstrapping process when developing
This commit is contained in:
parent
a471c7ef71
commit
3cf6a20ba4
2 changed files with 27 additions and 0 deletions
6
plugins/prebootstrapped/__init__.py
Normal file
6
plugins/prebootstrapped/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
|
||||
|
||||
def tasks(tasklist, manifest):
|
||||
from ebs import CreateVolumeFromSnapshot
|
||||
from providers.ec2.tasks.ebs import CreateVolume
|
||||
tasklist.replace(CreateVolume, CreateVolumeFromSnapshot())
|
21
plugins/prebootstrapped/ebs.py
Normal file
21
plugins/prebootstrapped/ebs.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
from base import Task
|
||||
from common import phases
|
||||
from connection import Connect
|
||||
import time
|
||||
|
||||
|
||||
class CreateVolumeFromSnapshot(Task):
|
||||
phase = phases.volume_creation
|
||||
after = [Connect]
|
||||
|
||||
description = 'Creating an EBS volume from a snapshot'
|
||||
|
||||
def run(self, info):
|
||||
volume_size = int(info.manifest.volume['size']/1024)
|
||||
snapshot_id = info.manifest.plugins['prebootstrapped'].snapshot_id
|
||||
info.volume = info.connection.create_volume(volume_size,
|
||||
info.host['availabilityZone'],
|
||||
snapshot=snapshot_id)
|
||||
while info.volume.volume_state() != 'available':
|
||||
time.sleep(5)
|
||||
info.volume.update()
|
Loading…
Add table
Reference in a new issue