Merge "Add support to add Tuskar-ui config to local_settings"

This commit is contained in:
Jenkins 2015-05-12 14:37:38 +00:00 committed by Gerrit Code Review
commit 3e2776bcef
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':
@ -226,6 +243,10 @@ class horizon(
$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,
@ -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 %>