diff --git a/heatclient/common/deployment_utils.py b/heatclient/common/deployment_utils.py index 02a3f79b..e6d68f89 100644 --- a/heatclient/common/deployment_utils.py +++ b/heatclient/common/deployment_utils.py @@ -19,11 +19,14 @@ import uuid from heatclient import exc from heatclient.openstack.common._i18n import _ +from heatclient.v1.software_configs import SoftwareConfig def build_derived_config_params(action, source, name, input_values, server_id, signal_transport, signal_id=None): + if isinstance(source, SoftwareConfig): + source = source.to_dict() input_values = input_values or {} inputs = copy.deepcopy(source.get('inputs')) or [] diff --git a/heatclient/tests/unit/test_deployment_utils.py b/heatclient/tests/unit/test_deployment_utils.py index 69a2899a..5754b170 100644 --- a/heatclient/tests/unit/test_deployment_utils.py +++ b/heatclient/tests/unit/test_deployment_utils.py @@ -19,6 +19,7 @@ import testtools from heatclient.common import deployment_utils from heatclient import exc +from heatclient.v1 import software_configs from testtools import matchers @@ -27,13 +28,13 @@ load_tests = testscenarios.load_tests_apply_scenarios def mock_sc(group=None, config=None, options=None, inputs=None, outputs=None): - return { + return software_configs.SoftwareConfig(None, { 'group': group, 'config': config, 'options': options or {}, 'inputs': inputs or [], 'outputs': outputs or [], - } + }, True) class DerivedConfigTest(testtools.TestCase): @@ -70,6 +71,38 @@ class DerivedConfigTest(testtools.TestCase): 'name': 's1', 'options': {}, 'outputs': []})), + ('defaults_empty', dict( + action='UPDATE', + source={}, + name='s1', + input_values=None, + server_id='1234', + signal_transport='NO_SIGNAL', + signal_id=None, + result={ + 'config': '', + 'group': 'Heat::Ungrouped', + 'inputs': [{ + 'description': 'ID of the server being deployed to', + 'name': 'deploy_server_id', + 'type': 'String', + 'value': '1234' + }, { + 'description': 'Name of the current action ' + 'being deployed', + 'name': 'deploy_action', + 'type': 'String', + 'value': 'UPDATE' + }, { + 'description': 'How the server should signal to ' + 'heat with the deployment output values.', + 'name': 'deploy_signal_transport', + 'type': 'String', + 'value': 'NO_SIGNAL'}], + 'name': 's1', + 'options': {}, + 'outputs': []})), + ('config_values', dict( action='UPDATE', source=mock_sc(