Don't wait for undefined actions in SoftwareComponent

This skips deploying a configuration on SoftwareDeployment if the
associated SoftwareComponent doesn't define a script for the action.

Change-Id: I9353cfd92bdcedfab6c8559e7a96425f09a1f6f0
Closes-Bug: #1532784
This commit is contained in:
Thomas Herve 2016-01-11 14:23:00 +01:00
parent e86b91b05f
commit b797457a1a
2 changed files with 44 additions and 3 deletions

View File

@ -248,9 +248,13 @@ class SoftwareDeployment(signal_responder.SignalResponder):
else:
config = {}
if (action not in self.properties[self.DEPLOY_ACTIONS]
and not config.get(
rpc_api.SOFTWARE_CONFIG_GROUP) == 'component'):
if config.get(rpc_api.SOFTWARE_CONFIG_GROUP) == 'component':
valid_actions = set()
for conf in config['config']['configs']:
valid_actions.update(conf['actions'])
if action not in valid_actions:
return
elif action not in self.properties[self.DEPLOY_ACTIONS]:
return
props = self._build_properties(

View File

@ -982,6 +982,43 @@ class SoftwareDeploymentTest(common.HeatTestCase):
self.assertIsNotNone(self.deployment.handle_resume())
self.assertIsNotNone(self.deployment.handle_delete())
def test_handle_unused_action_for_component(self):
self._create_stack(self.template)
config = {
'id': '48e8ade1-9196-42d5-89a2-f709fde42632',
'group': 'component',
'name': 'myconfig',
'config': {
'configs': [
{
'actions': ['CREATE'],
'config': 'the config',
'tool': 'a_tool'
}
]
},
'options': {},
'inputs': [{
'name': 'foo',
'type': 'String',
'default': 'baa',
}, {
'name': 'bar',
'type': 'String',
'default': 'baz',
}],
'outputs': [],
}
self.rpc_client.show_software_config.return_value = config
sd = self.mock_deployment()
self.rpc_client.show_software_deployment.return_value = sd
self.deployment.resource_id = sd['id']
self.assertIsNotNone(self.deployment.handle_create())
self.assertIsNone(self.deployment.handle_delete())
def test_get_temp_url(self):
dep_data = {}