From: Zane Bitter Date: Tue, 23 Apr 2013 11:36:47 +0000 (+0200) Subject: Assert on Resource double-create() X-Git-Tag: 2014.1~699 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=f3be3d90b30b6beb5d1ba94a4589a4345469f544;p=openstack-build%2Fheat-build.git Assert on Resource double-create() There's no valid case in which we should be creating a resource multiple times. Change-Id: Id90edd3a09ec15d3814a322ac0b7ec75fd0be54a --- diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 92aabe6d..bd63cf5b 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -299,8 +299,7 @@ class Resource(object): Create the resource. Subclasses should provide a handle_create() method to customise creation. ''' - if self.state in (self.CREATE_IN_PROGRESS, self.CREATE_COMPLETE): - return 'Resource creation already requested' + assert self.state is None, 'Resource create requested in invalid state' logger.info('creating %s' % str(self)) diff --git a/heat/tests/test_loadbalancer.py b/heat/tests/test_loadbalancer.py index 3b8b40a6..1cc916ac 100644 --- a/heat/tests/test_loadbalancer.py +++ b/heat/tests/test_loadbalancer.py @@ -154,8 +154,6 @@ class LoadBalancerTest(unittest.TestCase): s) id_list.append(inst.FnGetRefId()) - resource.nested().create() - resource.reload(id_list) self.assertEqual('4.5.6.7', resource.FnGetAtt('DNSName'))