Support boolean inputs for SoftwareConfig's
Adds support for using input/output booleans when creating SoftwareConfigs. This is useful because some of the software config hooks that prefer explicit boolean types for input's. Using Puppet with Hiera to map inputs directly to class parameters is an example that would benefit from this capability. Change-Id: Ic80f35fb259e60429d5a65a1b0bc7ff9f2a3ea0a Closes-bug: #1482223
This commit is contained in:
parent
d5aa987c29
commit
1a828933c1
@ -81,7 +81,7 @@ class SoftwareConfig(resource.Resource):
|
||||
_('Type of the value of the input.'),
|
||||
default='String',
|
||||
constraints=[constraints.AllowedValues((
|
||||
'String', 'Number', 'CommaDelimitedList', 'Json'))]
|
||||
'String', 'Number', 'CommaDelimitedList', 'Json', 'Boolean'))]
|
||||
),
|
||||
DEFAULT: properties.Schema(
|
||||
properties.Schema.STRING,
|
||||
@ -104,7 +104,7 @@ class SoftwareConfig(resource.Resource):
|
||||
_('Type of the value of the output.'),
|
||||
default='String',
|
||||
constraints=[constraints.AllowedValues((
|
||||
'String', 'Number', 'CommaDelimitedList', 'Json'))]
|
||||
'String', 'Number', 'CommaDelimitedList', 'Json', 'Boolean'))]
|
||||
),
|
||||
ERROR_OUTPUT: properties.Schema(
|
||||
properties.Schema.BOOLEAN,
|
||||
|
@ -32,6 +32,41 @@ from heat.tests import common
|
||||
from heat.tests.engine import tools
|
||||
from heat.tests import utils
|
||||
|
||||
software_config_inputs = '''
|
||||
heat_template_version: 2013-05-23
|
||||
description: Validate software config input/output types
|
||||
|
||||
resources:
|
||||
|
||||
InputOutputTestConfig:
|
||||
type: OS::Heat::SoftwareConfig
|
||||
properties:
|
||||
group: puppet
|
||||
inputs:
|
||||
- name: boolean_input
|
||||
type: Boolean
|
||||
- name: json_input
|
||||
type: Json
|
||||
- name: number_input
|
||||
type: Number
|
||||
- name: string_input
|
||||
type: String
|
||||
- name: comma_delimited_list_input
|
||||
type: CommaDelimitedList
|
||||
outputs:
|
||||
- name: boolean_output
|
||||
type: Boolean
|
||||
- name: json_output
|
||||
type: Json
|
||||
- name: number_output
|
||||
type: Number
|
||||
- name: string_output
|
||||
type: String
|
||||
- name: comma_delimited_list_output
|
||||
type: CommaDelimitedList
|
||||
|
||||
'''
|
||||
|
||||
|
||||
class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||
|
||||
@ -108,6 +143,15 @@ class SoftwareConfigServiceTest(common.HeatTestCase):
|
||||
self.ctx, config_id)
|
||||
self.assertEqual(exception.NotFound, ex.exc_info[0])
|
||||
|
||||
def test_boolean_inputs_valid(self):
|
||||
stack_name = 'test_boolean_inputs_valid'
|
||||
t = template_format.parse(software_config_inputs)
|
||||
stack = utils.parse_stack(t, stack_name=stack_name)
|
||||
try:
|
||||
stack.validate()
|
||||
except exception.StackValidationFailed as exc:
|
||||
self.fail("Validation should have passed: %s" % six.text_type(exc))
|
||||
|
||||
def _create_software_deployment(self, config_id=None, input_values=None,
|
||||
action='INIT',
|
||||
status='COMPLETE', status_reason='',
|
||||
|
Loading…
Reference in New Issue
Block a user