Add support to add Tuskar-ui config to local_settings

Patch adds optional configuration for Tuskar-UI to local_settings template
so it is possible to to use puppet-horizon for Tuskar-UI post install
configuration

Change-Id: Iaacd9e1a95a38093bc442375151f2e05dd13771f
This commit is contained in:
Jiri Tomasek 2015-04-29 14:48:03 +02:00
parent bce96510a0
commit d713dd725c
3 changed files with 95 additions and 36 deletions

View File

@ -181,6 +181,23 @@
# (optional) Selects the session engine for Django to use.
# Defaults to undefined - will not add entry to local settings.
#
# [*tuskar_ui*]
# (optional) Boolean to enable Tuskar-UI related configuration (http://tuskar-ui.readthedocs.org/)
# Defaults to false
#
# [*tuskar_ui_ironic_discoverd_url*]
# (optional) Tuskar-UI - Ironic Discoverd API endpoint
# Defaults to 'http://127.0.0.1:5050'
#
# [*tuskar_ui_undercloud_admin_password*]
# (optional) Tuskar-UI - Undercloud admin password used to authenticate admin user in Tuskar-UI.
# It is required by Heat to perform certain actions.
# Defaults to undefined
#
# [*tuskar_ui_deployment_mode*]
# (optional) Tuskar-UI - Deployment mode ('poc' or 'scale')
# Defaults to 'scale'
#
# === Examples
#
# class { 'horizon':
@ -194,43 +211,47 @@
#
class horizon(
$secret_key,
$fqdn = undef,
$package_ensure = 'present',
$cache_server_ip = '127.0.0.1',
$cache_server_port = '11211',
$horizon_app_links = false,
$keystone_url = 'http://127.0.0.1:5000/v2.0',
$keystone_default_role = '_member_',
$django_debug = 'False',
$openstack_endpoint_type = undef,
$secondary_endpoint_type = undef,
$available_regions = undef,
$api_result_limit = 1000,
$log_level = 'INFO',
$help_url = 'http://docs.openstack.org',
$local_settings_template = 'horizon/local_settings.py.erb',
$configure_apache = true,
$bind_address = undef,
$servername = $::fqdn,
$server_aliases = $::fqdn,
$allowed_hosts = $::fqdn,
$listen_ssl = false,
$ssl_redirect = true,
$horizon_cert = undef,
$horizon_key = undef,
$horizon_ca = undef,
$compress_offline = true,
$hypervisor_options = {},
$cinder_options = {},
$neutron_options = {},
$file_upload_temp_dir = '/tmp',
$policy_files_path = undef,
$policy_files = undef,
$fqdn = undef,
$package_ensure = 'present',
$cache_server_ip = '127.0.0.1',
$cache_server_port = '11211',
$horizon_app_links = false,
$keystone_url = 'http://127.0.0.1:5000/v2.0',
$keystone_default_role = '_member_',
$django_debug = 'False',
$openstack_endpoint_type = undef,
$secondary_endpoint_type = undef,
$available_regions = undef,
$api_result_limit = 1000,
$log_level = 'INFO',
$help_url = 'http://docs.openstack.org',
$local_settings_template = 'horizon/local_settings.py.erb',
$configure_apache = true,
$bind_address = undef,
$servername = $::fqdn,
$server_aliases = $::fqdn,
$allowed_hosts = $::fqdn,
$listen_ssl = false,
$ssl_redirect = true,
$horizon_cert = undef,
$horizon_key = undef,
$horizon_ca = undef,
$compress_offline = true,
$hypervisor_options = {},
$cinder_options = {},
$neutron_options = {},
$file_upload_temp_dir = '/tmp',
$policy_files_path = undef,
$policy_files = undef,
$tuskar_ui = false,
$tuskar_ui_ironic_discoverd_url = 'http://127.0.0.1:5050',
$tuskar_ui_undercloud_admin_password = undef,
$tuskar_ui_deployment_mode = 'scale',
# DEPRECATED PARAMETERS
$can_set_mount_point = undef,
$vhost_extra_params = undef,
$secure_cookies = false,
$django_session_engine = undef,
$can_set_mount_point = undef,
$vhost_extra_params = undef,
$secure_cookies = false,
$django_session_engine = undef,
) {
include ::horizon::params
@ -326,4 +347,8 @@ class horizon(
}
}
$tuskar_ui_deployment_mode_allowed_values = ['scale', 'poc']
if ! (member($tuskar_ui_deployment_mode_allowed_values, $tuskar_ui_deployment_mode)) {
fail("'${$tuskar_ui_deployment_mode}' is not correct value for tuskar_ui_deployment_mode parameter. It must be either 'scale' or 'poc'.")
}
}

View File

@ -150,6 +150,34 @@ describe 'horizon' do
it { is_expected.to contain_exec('refresh_horizon_django_cache') }
end
context 'with tuskar-ui enabled' do
before do
params.merge!({
:tuskar_ui => true,
:tuskar_ui_ironic_discoverd_url => 'http://127.0.0.1:5050',
:tuskar_ui_undercloud_admin_password => 'somesecretpassword',
:tuskar_ui_deployment_mode => 'scale',
})
end
it 'generates local_settings.py' do
verify_concat_fragment_contents(catalogue, 'local_settings.py', [
'IRONIC_DISCOVERD_URL = "http://127.0.0.1:5050"',
'UNDERCLOUD_ADMIN_PASSWORD = "somesecretpassword"',
'DEPLOYMENT_MODE = "scale"',
])
end
end
context 'with wrong tuskar_ui_deployment_mode parameter value' do
before do
params.merge!({
:tuskar_ui_deployment_mode => 'wrong' })
end
it_raises 'a Puppet::Error', /'wrong' is not correct value for tuskar_ui_deployment_mode parameter. It must be either 'scale' or 'poc'./
end
context 'with vhost_extra_params' do
before do
params.merge!({

View File

@ -569,3 +569,9 @@ COMPRESS_OFFLINE = <%= @compress_offline.to_s.capitalize %>
# so we add this option to change the directory where uploaded files are temporarily
# stored until they are loaded into Glance.
FILE_UPLOAD_TEMP_DIR = '<%= @file_upload_temp_dir %>'
<% if @tuskar_ui %>
IRONIC_DISCOVERD_URL = "<%= @tuskar_ui_ironic_discoverd_url %>"
UNDERCLOUD_ADMIN_PASSWORD = "<%= @tuskar_ui_undercloud_admin_password %>"
DEPLOYMENT_MODE = "<%= @tuskar_ui_deployment_mode %>"
<% end %>