mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-22 09:50:37 +00:00
ec2: Fix bug with EBS creation when no tags were specified
Also make the creation params a little more modular
This commit is contained in:
parent
2d64ddb867
commit
7a845fcd81
1 changed files with 11 additions and 7 deletions
|
@ -13,14 +13,18 @@ class EBSVolume(Volume):
|
||||||
tags = e.tags
|
tags = e.tags
|
||||||
size = self.size.bytes.get_qty_in('GiB')
|
size = self.size.bytes.get_qty_in('GiB')
|
||||||
|
|
||||||
params = dict(Size=size,
|
params = {
|
||||||
AvailabilityZone=zone,
|
'Size': size,
|
||||||
VolumeType='gp2',
|
'AvailabilityZone': zone,
|
||||||
TagSpecifications=[{'ResourceType': 'volume', 'Tags': tags}],
|
'VolumeType': 'gp2',
|
||||||
Encrypted=e.encrypted)
|
}
|
||||||
|
if len(tags) > 0:
|
||||||
|
params['TagSpecifications'] = [{'ResourceType': 'volume', 'Tags': tags}]
|
||||||
|
|
||||||
if e.encrypted and e.kms_key_id:
|
if e.encrypted:
|
||||||
params['KmsKeyId'] = e.kms_key_id
|
params['Encrypted'] = e.encrypted
|
||||||
|
if e.kms_key_id:
|
||||||
|
params['KmsKeyId'] = e.kms_key_id
|
||||||
|
|
||||||
self.volume = self.conn.create_volume(**params)
|
self.volume = self.conn.create_volume(**params)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue