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
|
||||
size = self.size.bytes.get_qty_in('GiB')
|
||||
|
||||
params = dict(Size=size,
|
||||
AvailabilityZone=zone,
|
||||
VolumeType='gp2',
|
||||
TagSpecifications=[{'ResourceType': 'volume', 'Tags': tags}],
|
||||
Encrypted=e.encrypted)
|
||||
params = {
|
||||
'Size': size,
|
||||
'AvailabilityZone': zone,
|
||||
'VolumeType': 'gp2',
|
||||
}
|
||||
if len(tags) > 0:
|
||||
params['TagSpecifications'] = [{'ResourceType': 'volume', 'Tags': tags}]
|
||||
|
||||
if e.encrypted and e.kms_key_id:
|
||||
params['KmsKeyId'] = e.kms_key_id
|
||||
if e.encrypted:
|
||||
params['Encrypted'] = e.encrypted
|
||||
if e.kms_key_id:
|
||||
params['KmsKeyId'] = e.kms_key_id
|
||||
|
||||
self.volume = self.conn.create_volume(**params)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue