diff --git a/contrib/heat_barbican/heat_barbican/resources/order.py b/contrib/heat_barbican/heat_barbican/resources/order.py index 380932902d..f99f836532 100644 --- a/contrib/heat_barbican/heat_barbican/resources/order.py +++ b/contrib/heat_barbican/heat_barbican/resources/order.py @@ -132,13 +132,10 @@ class Order(resource.Resource): try: self.barbican().orders.delete(self.resource_id) - self.resource_id_set(None) except client.barbican_client.HTTPClientError as exc: # This is the only exception the client raises # Inspecting the message to see if it's a 'Not Found' - if 'Not Found' in six.text_type(exc): - self.resource_id_set(None) - else: + if 'Not Found' not in six.text_type(exc): raise def _resolve_attribute(self, name): diff --git a/contrib/heat_barbican/heat_barbican/resources/secret.py b/contrib/heat_barbican/heat_barbican/resources/secret.py index 4eafd9df25..5165465640 100644 --- a/contrib/heat_barbican/heat_barbican/resources/secret.py +++ b/contrib/heat_barbican/heat_barbican/resources/secret.py @@ -137,13 +137,10 @@ class Secret(resource.Resource): try: self.barbican().secrets.delete(self.resource_id) - self.resource_id_set(None) except client.barbican_client.HTTPClientError as exc: # This is the only exception the client raises # Inspecting the message to see if it's a 'Not Found' - if 'Not Found' in six.text_type(exc): - self.resource_id_set(None) - else: + if 'Not Found' not in six.text_type(exc): raise def _resolve_attribute(self, name): diff --git a/contrib/heat_barbican/heat_barbican/tests/test_order.py b/contrib/heat_barbican/heat_barbican/tests/test_order.py index f76caaf5ce..4e5dd7b090 100644 --- a/contrib/heat_barbican/heat_barbican/tests/test_order.py +++ b/contrib/heat_barbican/heat_barbican/tests/test_order.py @@ -143,7 +143,6 @@ class TestOrder(HeatTestCase): self.assertEqual('foo', res.resource_id) scheduler.TaskRunner(res.delete)() - self.assertIsNone(res.resource_id) self.barbican.orders.delete.assert_called_once_with('foo') @mock.patch.object(client, 'barbican_client', new=mock.Mock()) diff --git a/contrib/heat_barbican/heat_barbican/tests/test_secret.py b/contrib/heat_barbican/heat_barbican/tests/test_secret.py index ef6293404a..56f3a46f1a 100644 --- a/contrib/heat_barbican/heat_barbican/tests/test_secret.py +++ b/contrib/heat_barbican/heat_barbican/tests/test_secret.py @@ -160,7 +160,6 @@ class TestSecret(HeatTestCase): mock_delete = self.barbican.secrets.delete scheduler.TaskRunner(self.res.delete)() - self.assertIsNone(self.res.resource_id) mock_delete.assert_called_once_with('foo_id') @mock.patch.object(client, 'barbican_client', new=mock.Mock()) diff --git a/contrib/nova_flavor/nova_flavor/resources/nova_flavor.py b/contrib/nova_flavor/nova_flavor/resources/nova_flavor.py index 8dff5e40a1..38c5731706 100644 --- a/contrib/nova_flavor/nova_flavor/resources/nova_flavor.py +++ b/contrib/nova_flavor/nova_flavor/resources/nova_flavor.py @@ -118,8 +118,6 @@ class NovaFlavor(resource.Resource): except Exception as e: self.client_plugin('nova').ignore_not_found(e) - self.resource_id_set(None) - def resource_mapping(): return { diff --git a/contrib/rackspace/rackspace/resources/cloud_dns.py b/contrib/rackspace/rackspace/resources/cloud_dns.py index 7af7d876ef..26f7e37cdc 100644 --- a/contrib/rackspace/rackspace/resources/cloud_dns.py +++ b/contrib/rackspace/rackspace/resources/cloud_dns.py @@ -195,7 +195,6 @@ class CloudDns(resource.Resource): dom.delete() except NotFound: pass - self.resource_id_set(None) def resource_mapping(): diff --git a/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py b/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py index 847bc33513..12f2659b5d 100644 --- a/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py +++ b/contrib/rackspace/rackspace/resources/cloud_loadbalancer.py @@ -574,7 +574,6 @@ class CloudLoadBalancer(resource.Resource): else: if loadbalancer.status != 'DELETED': loadbalancer.delete() - self.resource_id_set(None) def _remove_none(self, property_dict): """Remove None values that would cause schema validation problems. diff --git a/heat/engine/resources/glance_image.py b/heat/engine/resources/glance_image.py index 9304353f94..fcbe1d58ed 100644 --- a/heat/engine/resources/glance_image.py +++ b/heat/engine/resources/glance_image.py @@ -118,8 +118,6 @@ class GlanceImage(resource.Resource): except Exception as ex: self.client_plugin().ignore_not_found(ex) - self.resource_id_set(None) - def resource_mapping(): return { diff --git a/heat/engine/resources/instance.py b/heat/engine/resources/instance.py index 98e2b50f6d..bd5813a167 100644 --- a/heat/engine/resources/instance.py +++ b/heat/engine/resources/instance.py @@ -836,7 +836,6 @@ class Instance(resource.Resource): deleter.start() if not deleter.step(): return False - self.resource_id_set(None) return True def handle_suspend(self): diff --git a/heat/engine/resources/neutron/security_group.py b/heat/engine/resources/neutron/security_group.py index 223e7b1236..4218d669d9 100644 --- a/heat/engine/resources/neutron/security_group.py +++ b/heat/engine/resources/neutron/security_group.py @@ -214,7 +214,6 @@ class SecurityGroup(neutron.NeutronResource): self.neutron().delete_security_group(self.resource_id) except Exception as ex: self.client_plugin().ignore_not_found(ex) - self.resource_id_set(None) def handle_update(self, json_snippet, tmpl_diff, prop_diff): props = self.prepare_update_properties(json_snippet) diff --git a/heat/engine/resources/nova_servergroup.py b/heat/engine/resources/nova_servergroup.py index 85595cbd66..e454476d1e 100644 --- a/heat/engine/resources/nova_servergroup.py +++ b/heat/engine/resources/nova_servergroup.py @@ -59,7 +59,6 @@ class ServerGroup(resource.Resource): self.nova().server_groups.delete(self.resource_id) except Exception as e: self.client_plugin('nova').ignore_not_found(e) - self.resource_id_set(None) def physical_resource_name(self): name = self.properties.get(self.NAME) diff --git a/heat/engine/resources/os_database.py b/heat/engine/resources/os_database.py index 8bf94ea935..f30d41e594 100644 --- a/heat/engine/resources/os_database.py +++ b/heat/engine/resources/os_database.py @@ -309,7 +309,6 @@ class OSDBInstance(resource.Resource): except Exception as ex: self.client_plugin().ignore_not_found(ex) LOG.debug("Database instance %s not found." % self.resource_id) - self.resource_id_set(None) else: instance.delete() return instance @@ -326,7 +325,6 @@ class OSDBInstance(resource.Resource): self._refresh_instance(instance) except Exception as ex: self.client_plugin().ignore_not_found(ex) - self.resource_id_set(None) return True return False diff --git a/heat/engine/resources/security_group.py b/heat/engine/resources/security_group.py index bb273649b1..ae980a4646 100644 --- a/heat/engine/resources/security_group.py +++ b/heat/engine/resources/security_group.py @@ -233,7 +233,6 @@ class SecurityGroup(resource.Resource): self.client_plugin('nova').ignore_not_found(e) self.nova().security_groups.delete(self.resource_id) - self.resource_id_set(None) def _handle_delete_neutron(self): client = self.neutron() @@ -255,7 +254,6 @@ class SecurityGroup(resource.Resource): client.delete_security_group(self.resource_id) except Exception as ex: self.client_plugin('neutron').ignore_not_found(ex) - self.resource_id_set(None) def FnGetRefId(self): if self.properties[self.VPC_ID]: diff --git a/heat/engine/resources/server.py b/heat/engine/resources/server.py index 7b4237790f..6af307c46a 100644 --- a/heat/engine/resources/server.py +++ b/heat/engine/resources/server.py @@ -984,7 +984,6 @@ class Server(stack_user.StackUser): def check_delete_complete(self, deleter): if deleter is None or deleter.step(): - self.resource_id_set(None) return True return False diff --git a/heat/engine/resources/volume.py b/heat/engine/resources/volume.py index a1fcd4d530..87ce589c90 100644 --- a/heat/engine/resources/volume.py +++ b/heat/engine/resources/volume.py @@ -166,7 +166,6 @@ class Volume(resource.Resource): vol.get() except Exception as ex: self.client_plugin().ignore_not_found(ex) - self.resource_id_set(None) def handle_snapshot_delete(self, state): backup = state not in ((self.CREATE, self.FAILED), diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index 26cfb3bb4d..c1d1c552f3 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -541,7 +541,6 @@ class InstancesTest(HeatTestCase): self.m.ReplayAll() scheduler.TaskRunner(instance.delete)() - self.assertIsNone(instance.resource_id) self.assertEqual((instance.DELETE, instance.COMPLETE), instance.state) self.m.VerifyAll() diff --git a/heat/tests/test_nova_servergroup.py b/heat/tests/test_nova_servergroup.py index 14dc9fd7be..94ced76268 100644 --- a/heat/tests/test_nova_servergroup.py +++ b/heat/tests/test_nova_servergroup.py @@ -96,7 +96,6 @@ class NovaServerGroupTest(HeatTestCase): self.sg_mgr.delete.assert_called_once_with('test') self.assertEqual((self.sg.DELETE, self.sg.COMPLETE), self.sg.state) - self.assertIsNone(self.sg.resource_id) def test_sg_delete_not_found(self): self._create_sg('test') @@ -105,4 +104,3 @@ class NovaServerGroupTest(HeatTestCase): self.sg_mgr.delete.assert_called_once_with('test') self.assertEqual((self.sg.DELETE, self.sg.COMPLETE), self.sg.state) - self.assertIsNone(self.sg.resource_id) diff --git a/heat/tests/test_os_database.py b/heat/tests/test_os_database.py index b3da418f97..56d888b76b 100644 --- a/heat/tests/test_os_database.py +++ b/heat/tests/test_os_database.py @@ -214,7 +214,6 @@ class OSDBInstanceTest(HeatTestCase): self.m.ReplayAll() scheduler.TaskRunner(instance.delete)() - self.assertIsNone(instance.resource_id) self.m.VerifyAll() def test_osdatabase_delete_overlimit(self): @@ -237,7 +236,6 @@ class OSDBInstanceTest(HeatTestCase): self.m.ReplayAll() scheduler.TaskRunner(instance.delete)() - self.assertIsNone(instance.resource_id) self.m.VerifyAll() def test_osdatabase_delete_resource_none(self): @@ -265,7 +263,6 @@ class OSDBInstanceTest(HeatTestCase): self.m.ReplayAll() scheduler.TaskRunner(instance.delete)() - self.assertIsNone(instance.resource_id) self.m.VerifyAll() def test_osdatabase_invalid_attribute(self): diff --git a/heat/tests/test_server.py b/heat/tests/test_server.py index a112653f3c..4e039e90d1 100644 --- a/heat/tests/test_server.py +++ b/heat/tests/test_server.py @@ -929,7 +929,6 @@ class ServersTest(HeatTestCase): self.m.ReplayAll() scheduler.TaskRunner(server.delete)() - self.assertIsNone(server.resource_id) self.assertEqual((server.DELETE, server.COMPLETE), server.state) self.m.VerifyAll() @@ -947,12 +946,6 @@ class ServersTest(HeatTestCase): get().AndRaise(fakes_v1_1.fake_exception()) mox.Replay(get) - scheduler.TaskRunner(server.delete)() - self.assertIsNone(server.resource_id) - self.assertEqual((server.DELETE, server.COMPLETE), server.state) - self.m.VerifyAll() - - server.state_set(server.CREATE, server.COMPLETE, 'to delete again') scheduler.TaskRunner(server.delete)() self.assertEqual((server.DELETE, server.COMPLETE), server.state) self.m.VerifyAll() diff --git a/heat/tests/test_volume.py b/heat/tests/test_volume.py index b850e15e18..a13fef2cdf 100644 --- a/heat/tests/test_volume.py +++ b/heat/tests/test_volume.py @@ -217,10 +217,6 @@ class VolumeTest(HeatTestCase): fv.status = 'available' scheduler.TaskRunner(rsrc.destroy)() - # Test when volume already deleted - rsrc.state_set(rsrc.CREATE, rsrc.COMPLETE) - scheduler.TaskRunner(rsrc.destroy)() - self.m.VerifyAll() def test_volume_default_az(self):