Changes to checkeddict for tuples and required

This commit is contained in:
Chris Alfonso 2012-05-24 15:22:41 -04:00
parent 4c1adc193f
commit 84b6569ae6
3 changed files with 9 additions and 6 deletions

View File

@ -135,9 +135,11 @@ class Properties(CheckedDict):
def validate(self): def validate(self):
for key in self.data: for key in self.data:
# are there missing required Properties # are there missing required Properties
if 'Required' in self.data[key] and not 'Value' in self.data[key]: if 'Required' in self.data[key]:
return {'Error': \ if self.data[key]['Required'] \
'%s Property must be provided' % key} and not 'Value' in self.data[key]:
return {'Error': \
'%s Property must be provided' % key}
# are there unimplemented Properties # are there unimplemented Properties
if not self.data[key]['Implemented'] and 'Value' in self.data[key]: if not self.data[key]['Implemented'] and 'Value' in self.data[key]:

View File

@ -29,9 +29,9 @@ class SecurityGroup(Resource):
'Required': True}, 'Required': True},
'VpcId': {'Type': 'String', 'VpcId': {'Type': 'String',
'Implemented': False}, 'Implemented': False},
'SecurityGroupIngress': {'Type': 'CommaDelimitedList', 'SecurityGroupIngress': {'Type': 'TuplesList',
'Implemented': False}, 'Implemented': False},
'SecurityGroupEgress': {'Type': 'CommaDelimitedList'}} 'SecurityGroupEgress': {'Type': 'TuplesList'}}
def __init__(self, name, json_snippet, stack): def __init__(self, name, json_snippet, stack):
super(SecurityGroup, self).__init__(name, json_snippet, stack) super(SecurityGroup, self).__init__(name, json_snippet, stack)

View File

@ -28,7 +28,8 @@ class Volume(Resource):
properties_schema = {'AvailabilityZone': {'Type': 'String', properties_schema = {'AvailabilityZone': {'Type': 'String',
'Required': True}, 'Required': True},
'Size': {'Type': 'Number'}, 'Size': {'Type': 'Number'},
'SnapshotId': {'Type': 'String'}} 'SnapshotId': {'Type': 'String'},
'Tags': {'Type': 'TuplesList'}}
def __init__(self, name, json_snippet, stack): def __init__(self, name, json_snippet, stack):
super(Volume, self).__init__(name, json_snippet, stack) super(Volume, self).__init__(name, json_snippet, stack)