Skip to content

Commit

Permalink
Break out NoDevice property validation (Fixes #1551)
Browse files Browse the repository at this point in the history
* NoDevice is a string for launch template block device mapping and
  a null object for EC2 block device mapping
* This addresses the issue by breaking out block device mapping to
  two separate objects. The EC2 version will keep the original name
  for backwards compatibility purposes and the launch template
  version will take up a new name
  • Loading branch information
cwgem committed Jan 6, 2020
1 parent 3c1ef2d commit 6c651bd
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions troposphere/ec2.py
Expand Up @@ -138,8 +138,17 @@ class BlockDeviceMapping(AWSProperty):
props = {
'DeviceName': (basestring, True),
'Ebs': (EBSBlockDevice, False), # Conditional
'NoDevice': (dict, False),
'VirtualName': (basestring, False), # Conditional
'NoDevice': (dict, False)
}


class LaunchTemplateBlockDeviceMapping(AWSProperty):
props = {
'DeviceName': (basestring, True),
'Ebs': (EBSBlockDevice, False), # Conditional
'VirtualName': (basestring, False), # Conditional
'NoDevice': (basestring, False)
}


Expand Down Expand Up @@ -975,7 +984,7 @@ class LaunchTemplateCreditSpecification(AWSProperty):

class LaunchTemplateData(AWSProperty):
props = {
'BlockDeviceMappings': ([BlockDeviceMapping], False),
'BlockDeviceMappings': ([LaunchTemplateBlockDeviceMapping], False),
'CpuOptions': (CpuOptions, False),
'CreditSpecification': (LaunchTemplateCreditSpecification, False),
'DisableApiTermination': (boolean, False),
Expand Down

0 comments on commit 6c651bd

Please sign in to comment.