Merge "delete_trust failure will not block a stack delete"

This commit is contained in:
Zuul 2018-07-12 06:11:28 +00:00 committed by Gerrit Code Review
commit 8921dade4a
2 changed files with 7 additions and 6 deletions

View File

@ -1788,10 +1788,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()