delete_trust failure will not block a stack delete

Deleting a tenant that has active stacks would have to issue
a stack delete twice per stack to delete those stacks,
that was because the delete_trust would fail, but credentials were still
cleared.This change just logs the error but does not fail the stack delete.

Change-Id: I9d770a91b20d1db137b3fc313c794fcee4a5e4bf
Story: 2002619
Task: 22248
This commit is contained in:
Nakul Dahiwade 2018-06-19 22:13:14 +00:00
parent a4a6a00809
commit a33f761f47
2 changed files with 7 additions and 6 deletions

View File

@ -1787,10 +1787,12 @@ class Stack(collections.Mapping):
self.clients.client('keystone').delete_trust(
trust_id)
except Exception as ex:
# We want the admin to be able to delete the stack
# Do not FAIL a delete when we cannot delete a trust.
# We already carry through and delete the credentials
# Without this, they would need to issue
# an additional stack-delete
LOG.exception("Error deleting trust")
stack_status = self.FAILED
reason = ("Error deleting trust: %s" %
six.text_type(ex))
# Delete the stored credentials
try:

View File

@ -354,10 +354,9 @@ class StackTest(common.HeatTestCase):
self.assertEqual(2, mock_kcp.call_count)
db_s = stack_object.Stack.get_by_id(self.ctx, stack_id)
self.assertIsNotNone(db_s)
self.assertEqual((stack.Stack.DELETE, stack.Stack.FAILED),
self.assertIsNone(db_s)
self.assertEqual((stack.Stack.DELETE, stack.Stack.COMPLETE),
self.stack.state)
self.assertIn('Error deleting trust', self.stack.status_reason)
def test_delete_deletes_project(self):
fkc = fake_ks.FakeKeystoneClient()