Fix stack_name reference

The correct way to get the stack name from a stack object is to use
.stack_name and not ['stack_name']. The current version of this code
will fail since Stack does not have a __getitem__ implementation.

Change-Id: I92420af2ca34f1c66058213cbb1a4403017790d1
Closes-Bug: #1832637
(cherry picked from commit e2dd051205)
This commit is contained in:
Alex Schultz 2019-06-12 13:32:46 -06:00
parent 89b09d3ed1
commit 0238882ec9
2 changed files with 9 additions and 9 deletions

View File

@ -1030,8 +1030,8 @@ class TestPostConfig(BaseTestCase):
mock_swift_client.return_value = mock_instance_swift
mock_heat = mock.Mock()
aux_stack = {}
aux_stack['stack_name'] = "mystack"
aux_stack = mock.Mock()
aux_stack.stack_name = "mystack"
mock_heat.stacks.list.return_value = [aux_stack]
mock_make_client.return_value = mock_heat
@ -1071,8 +1071,8 @@ class TestPostConfig(BaseTestCase):
mock_swift_client.return_value = mock_instance_swift
mock_heat = mock.Mock()
aux_stack = {}
aux_stack['stack_name'] = "mystackooo"
aux_stack = mock.Mock()
aux_stack.stack_name = "mystackooo"
mock_heat.stacks.list.return_value = [aux_stack]
mock_make_client.return_value = mock_heat
@ -1109,8 +1109,8 @@ class TestPostConfig(BaseTestCase):
mock_swift_client.return_value = mock_instance_swift
mock_heat = mock.Mock()
aux_stack = {}
aux_stack['stack_name'] = "mystack"
aux_stack = mock.Mock()
aux_stack.stack_name = "mystack"
mock_heat.stacks.list.return_value = [aux_stack]
mock_make_client.return_value = mock_heat
@ -1149,8 +1149,8 @@ class TestPostConfig(BaseTestCase):
mock_swift_client.return_value = mock_instance_swift
mock_heat = mock.Mock()
aux_stack = {}
aux_stack['stack_name'] = "mystack"
aux_stack = mock.Mock()
aux_stack.stack_name = "mystack"
mock_heat.stacks.list.return_value = [aux_stack]
mock_make_client.return_value = mock_heat

View File

@ -1947,7 +1947,7 @@ def _run_validation_groups(groups=[], mistral_url='', timeout=540,
user_domain_name='Default')
# Here we get all the stack names, we should have only one.
stack_names_list = [stack['stack_name'] for stack in heat.stacks.list()]
stack_names_list = [stack.stack_name for stack in heat.stacks.list()]
# We calculate the interception of the two previous list, the
# result should be only one value in case the Overcloud exists.