From e23c42fdffe953311b3405f6d58ff7392779f75a Mon Sep 17 00:00:00 2001 From: Jason Dunsmore Date: Wed, 6 May 2015 12:56:02 -0500 Subject: [PATCH] Fix call to ignore_not_found() in SwiftSignal The call to ignore_not_found() in the SwiftSignal resource was missing an argument. Change-Id: Id65af72ed30e76ab3620248807ef05c31e1e8565 Closes-Bug: 1452412 --- .../resources/openstack/heat/swiftsignal.py | 2 +- heat/tests/test_swiftsignal.py | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/heat/engine/resources/openstack/heat/swiftsignal.py b/heat/engine/resources/openstack/heat/swiftsignal.py index ba7abc6904..f6eaaaa877 100644 --- a/heat/engine/resources/openstack/heat/swiftsignal.py +++ b/heat/engine/resources/openstack/heat/swiftsignal.py @@ -251,7 +251,7 @@ class SwiftSignal(resource.Resource): try: signal = self.client().get_object(self.stack.id, obj['name']) except Exception as exc: - self.client_plugin().ignore_not_found() + self.client_plugin().ignore_not_found(exc) continue body = signal[1] diff --git a/heat/tests/test_swiftsignal.py b/heat/tests/test_swiftsignal.py index ed9db5155a..e3ed1ed09d 100644 --- a/heat/tests/test_swiftsignal.py +++ b/heat/tests/test_swiftsignal.py @@ -851,3 +851,27 @@ class SwiftSignalTest(common.HeatTestCase): self.assertEqual(('CREATE', 'COMPLETE'), st.state) wc = st['test_wait_condition'] self.assertEqual("null", wc.FnGetAtt('data')) + + @mock.patch.object(swift.SwiftClientPlugin, '_create') + @mock.patch.object(resource.Resource, 'physical_resource_name') + def test_swift_get_object_404(self, mock_name, mock_swift): + st = create_stack(swiftsignal_template) + handle = st['test_wait_condition_handle'] + + mock_swift_object = mock.Mock() + mock_swift.return_value = mock_swift_object + mock_swift_object.url = "http://fake-host.com:8080/v1/AUTH_1234" + mock_swift_object.head_account.return_value = { + 'x-account-meta-temp-url-key': '123456' + } + obj_name = "%s-%s-abcdefghijkl" % (st.name, handle.name) + mock_name.return_value = obj_name + mock_swift_object.get_container.return_value = cont_index(obj_name, 2) + mock_swift_object.get_object.side_effect = ( + (obj_header, ''), + swiftclient_client.ClientException( + "Object %s not found" % obj_name, http_status=404) + ) + + st.create() + self.assertEqual(('CREATE', 'COMPLETE'), st.state)