Change input for UpdateCapabilitiesAction
The format has changed slightly with the values no longer being a dict, but simply being true/false. Change-Id: I24c0189b2164c7a839be359e9c5858c9c23d9ab0 Closes-bug: #1608539
This commit is contained in:
parent
e7377aaeb1
commit
c8f613835a
|
@ -113,14 +113,17 @@ class UpdateCapabilitiesAction(base.TripleOAction):
|
|||
)
|
||||
|
||||
for k, v in self.environments.items():
|
||||
if v.get('enabled', False):
|
||||
mistral_env.variables['environments'].append(
|
||||
{'path': k}
|
||||
)
|
||||
found = False
|
||||
if {'path': k} in mistral_env.variables['environments']:
|
||||
found = True
|
||||
if v:
|
||||
if not found:
|
||||
mistral_env.variables['environments'].append(
|
||||
{'path': k}
|
||||
)
|
||||
else:
|
||||
# see if it resides in mistral env and if so, remove it
|
||||
if {'path': k} in mistral_env.variables['environments']:
|
||||
mistral_env.variables['environments'].pop({'path': k})
|
||||
if found:
|
||||
mistral_env.variables['environments'].remove({'path': k})
|
||||
|
||||
env_kwargs = {
|
||||
'name': mistral_env.name,
|
||||
|
@ -137,4 +140,4 @@ class UpdateCapabilitiesAction(base.TripleOAction):
|
|||
None,
|
||||
err_msg
|
||||
)
|
||||
return mistral_env
|
||||
return mistral_env.variables
|
||||
|
|
|
@ -131,15 +131,18 @@ class UpdateCapabilitiesActionTest(base.TestCase):
|
|||
mocked_env = mock.MagicMock()
|
||||
mocked_env.variables = {
|
||||
'environments': [
|
||||
{'path': '/path/to/overcloud-default-env.yaml'}
|
||||
{'path': '/path/to/overcloud-default-env.yaml'},
|
||||
{'path': '/path/to/ceph-storage-env.yaml'},
|
||||
]
|
||||
}
|
||||
mistral.environments.get.return_value = mocked_env
|
||||
get_workflow_client_mock.return_value = mistral
|
||||
|
||||
environments = {'/path/to/ceph-storage-env.yaml': {'enabled': False},
|
||||
'/path/to/network-isolation.json': {'enabled': False},
|
||||
'/path/to/poc-custom-env.yaml': {'enabled': True}}
|
||||
environments = {
|
||||
'/path/to/ceph-storage-env.yaml': False,
|
||||
'/path/to/network-isolation.json': False,
|
||||
'/path/to/poc-custom-env.yaml': True
|
||||
}
|
||||
|
||||
action = heat_capabilities.UpdateCapabilitiesAction(
|
||||
environments, self.container_name)
|
||||
|
@ -148,7 +151,7 @@ class UpdateCapabilitiesActionTest(base.TestCase):
|
|||
{'path': '/path/to/overcloud-default-env.yaml'},
|
||||
{'path': '/path/to/poc-custom-env.yaml'}
|
||||
]},
|
||||
action.run().variables)
|
||||
action.run())
|
||||
|
||||
@mock.patch(
|
||||
'tripleo_common.actions.base.TripleOAction._get_object_client')
|
||||
|
|
Loading…
Reference in New Issue