diff --git a/heat/engine/autoscaling.py b/heat/engine/autoscaling.py index e599a7f7b7..4fe4ee2ef0 100644 --- a/heat/engine/autoscaling.py +++ b/heat/engine/autoscaling.py @@ -59,7 +59,7 @@ class AutoScalingGroup(Resource): def handle_create(self): - if 'DesiredCapacity' in self.properties: + if self.properties['DesiredCapacity']: num_to_create = int(self.properties['DesiredCapacity']) else: num_to_create = int(self.properties['MinSize']) diff --git a/heat/engine/eip.py b/heat/engine/eip.py index 854db76fba..4b9e59d4c9 100644 --- a/heat/engine/eip.py +++ b/heat/engine/eip.py @@ -85,10 +85,7 @@ class ElasticIpAssociation(Resource): super(ElasticIpAssociation, self).__init__(name, json_snippet, stack) def FnGetRefId(self): - if not 'EIP' in self.properties: - return unicode('0.0.0.0') - else: - return unicode(self.properties['EIP']) + return unicode(self.properties.get('EIP', '0.0.0.0')) def validate(self): ''' diff --git a/heat/engine/security_group.py b/heat/engine/security_group.py index dcebff9d51..91301a6379 100644 --- a/heat/engine/security_group.py +++ b/heat/engine/security_group.py @@ -49,7 +49,7 @@ class SecurityGroup(Resource): self.properties['GroupDescription']) self.instance_id_set(sec.id) - if 'SecurityGroupIngress' in self.properties: + if self.properties['SecurityGroupIngress']: rules_client = self.nova().security_group_rules for i in self.properties['SecurityGroupIngress']: try: diff --git a/heat/engine/user.py b/heat/engine/user.py index d5a1e83e64..e735fbe9f6 100644 --- a/heat/engine/user.py +++ b/heat/engine/user.py @@ -44,10 +44,9 @@ class User(Resource): def handle_create(self): passwd = '' - if 'LoginProfile' in self.properties: - if self.properties['LoginProfile'] and \ - 'Password' in self.properties['LoginProfile']: - passwd = self.properties['LoginProfile']['Password'] + if self.properties['LoginProfile'] and \ + 'Password' in self.properties['LoginProfile']: + passwd = self.properties['LoginProfile']['Password'] tenant_id = self.context.tenant_id user = self.keystone().users.create(self.name, passwd,