diff --git a/elements/puppet-stack-config/install.d/02-puppet-stack-config b/elements/puppet-stack-config/install.d/02-puppet-stack-config index d17381568..9aac23fec 100755 --- a/elements/puppet-stack-config/install.d/02-puppet-stack-config +++ b/elements/puppet-stack-config/install.d/02-puppet-stack-config @@ -22,7 +22,7 @@ import pystache from instack_undercloud import undercloud -renderer = pystache.Renderer() +renderer = pystache.Renderer(escape=lambda s: s) template = os.path.join(os.path.dirname(__file__), '..', 'puppet-stack-config.yaml.template') diff --git a/elements/puppet-stack-config/puppet-stack-config.yaml.template b/elements/puppet-stack-config/puppet-stack-config.yaml.template index 5bc17c3f4..ae8ccbb90 100644 --- a/elements/puppet-stack-config/puppet-stack-config.yaml.template +++ b/elements/puppet-stack-config/puppet-stack-config.yaml.template @@ -361,11 +361,7 @@ nova::keystone::auth::configure_ec2_endpoint: false # Ironic ironic::debug: "%{hiera('debug')}" ironic::my_ip: {{LOCAL_IP}} -ironic::enabled_drivers: - - 'pxe_ipmitool' - - 'pxe_ssh' - - 'pxe_drac' - - 'pxe_ilo' +ironic::enabled_drivers: {{ENABLED_DRIVERS}} ironic::rpc_response_timeout: 600 ironic::api::authtoken::password: {{UNDERCLOUD_IRONIC_PASSWORD}} ironic::api::authtoken::auth_uri: "%{hiera('keystone_auth_uri')}" diff --git a/instack_undercloud/tests/test_undercloud.py b/instack_undercloud/tests/test_undercloud.py index 6c079373c..2bd664ddf 100644 --- a/instack_undercloud/tests/test_undercloud.py +++ b/instack_undercloud/tests/test_undercloud.py @@ -14,6 +14,7 @@ import collections import io +import json import os import subprocess @@ -279,6 +280,11 @@ class TestGenerateEnvironment(BaseTestCase): 'default,extra-hardware,logs') self.assertEqual('192.0.2.1/24', env['PUBLIC_INTERFACE_IP']) self.assertEqual('192.0.2.1', env['LOCAL_IP']) + # The list is generated from a set, so we can't rely on ordering. + # Instead make sure that it looks like a valid list by parsing it. + drivers = json.loads(env['ENABLED_DRIVERS']) + self.assertEqual(sorted(drivers), ['pxe_drac', 'pxe_ilo', + 'pxe_ipmitool', 'pxe_ssh']) def test_generate_endpoints(self): env = undercloud._generate_environment('.') diff --git a/instack_undercloud/undercloud.py b/instack_undercloud/undercloud.py index 80c541935..b4bc7af7e 100644 --- a/instack_undercloud/undercloud.py +++ b/instack_undercloud/undercloud.py @@ -328,6 +328,10 @@ _opts = [ default=False, help=('Whether to clean overcloud nodes (wipe the hard drive) ' 'between deployments and after the introspection.')), + cfg.ListOpt('enabled_drivers', + default=['pxe_ipmitool', 'pxe_drac', 'pxe_ilo', 'pxe_ssh'], + help=('List of enabled bare metal drivers.')), + ] # Passwords, tokens, hashes @@ -895,6 +899,10 @@ def _generate_environment(instack_root): instack_env['INSPECTION_KERNEL_ARGS'] = ' '.join(inspection_kernel_args) + # Ensure correct rendering of the list and uniqueness of the items + instack_env['ENABLED_DRIVERS'] = ( + '[%s]' % ', '.join('"%s"' % drv for drv in set(CONF.enabled_drivers))) + instack_env['PUBLIC_INTERFACE_IP'] = instack_env['LOCAL_IP'] instack_env['LOCAL_IP'] = instack_env['LOCAL_IP'].split('/')[0] if instack_env['UNDERCLOUD_SERVICE_CERTIFICATE']: diff --git a/undercloud.conf.sample b/undercloud.conf.sample index 565103901..626b66377 100644 --- a/undercloud.conf.sample +++ b/undercloud.conf.sample @@ -177,6 +177,9 @@ # deployments and after the introspection. (boolean value) #clean_nodes = false +# List of enabled bare metal drivers. (list value) +#enabled_drivers = pxe_ipmitool,pxe_drac,pxe_ilo,pxe_ssh + [auth]