From f3be3d90b30b6beb5d1ba94a4589a4345469f544 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Tue, 23 Apr 2013 13:36:47 +0200 Subject: [PATCH] Assert on Resource double-create() There's no valid case in which we should be creating a resource multiple times. Change-Id: Id90edd3a09ec15d3814a322ac0b7ec75fd0be54a --- heat/engine/resource.py | 3 +-- heat/tests/test_loadbalancer.py | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) 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')) -- 2.45.2