Derive params network config stack exists fix
This change is to fix stack already exists issue in the environment where overcloud with same name is already deployed. get_network_config action is failing and error message is stack already exists if overcloud is deployed already. Change-Id: If917ae93691540b525d9e1eddcf0c0885ccc5f5e Closes-Bug: #1714471
This commit is contained in:
parent
923658a720
commit
3ea3cbd6d3
@ -556,15 +556,18 @@ class GetNetworkConfigAction(templates.ProcessTemplatesAction):
|
||||
if isinstance(processed_data, actions.Result):
|
||||
return processed_data
|
||||
|
||||
# stacks.preview method raises validation message if stack is
|
||||
# already deployed. here renaming container to get preview data.
|
||||
container_temp = self.container + "-TEMP"
|
||||
fields = {
|
||||
'template': processed_data['template'],
|
||||
'files': processed_data['files'],
|
||||
'environment': processed_data['environment'],
|
||||
'stack_name': self.container,
|
||||
'stack_name': container_temp,
|
||||
}
|
||||
orc = self.get_orchestration_client(context)
|
||||
preview_data = orc.stacks.preview(**fields)
|
||||
result = self.get_network_config(preview_data, self.container,
|
||||
result = self.get_network_config(preview_data, container_temp,
|
||||
self.role_name)
|
||||
return result
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ class GetNetworkConfigActionTest(base.TestCase):
|
||||
|
||||
mock_heat = mock.MagicMock()
|
||||
mock_heat.stacks.preview.return_value = mock.Mock(resources=[{
|
||||
"resource_identity": {"stack_name": "overcloud-Compute-0"},
|
||||
"resource_identity": {"stack_name": "overcloud-TEMP-Compute-0"},
|
||||
"resource_name": "OsNetConfigImpl",
|
||||
"properties": {"config": "echo \'{\"network_config\": {}}\'"}
|
||||
}])
|
||||
@ -1070,7 +1070,7 @@ class GetNetworkConfigActionTest(base.TestCase):
|
||||
environment={},
|
||||
files={},
|
||||
template={'heat_template_version': '2016-04-30'},
|
||||
stack_name='overcloud',
|
||||
stack_name='overcloud-TEMP',
|
||||
)
|
||||
|
||||
@mock.patch('tripleo_common.actions.base.TripleOAction.'
|
||||
@ -1113,7 +1113,7 @@ class GetNetworkConfigActionTest(base.TestCase):
|
||||
|
||||
mock_heat = mock.MagicMock()
|
||||
mock_heat.stacks.preview.return_value = mock.Mock(resources=[{
|
||||
"resource_identity": {"stack_name": "overcloud-Compute-0"},
|
||||
"resource_identity": {"stack_name": "overcloud-TEMP-Compute-0"},
|
||||
"resource_name": "OsNetConfigImpl",
|
||||
"properties": {"config": ""}
|
||||
}])
|
||||
@ -1130,5 +1130,5 @@ class GetNetworkConfigActionTest(base.TestCase):
|
||||
environment={},
|
||||
files={},
|
||||
template={'heat_template_version': '2016-04-30'},
|
||||
stack_name='overcloud',
|
||||
stack_name='overcloud-TEMP',
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user