From a881a4aa4e4c67b5f72dd66feeebac9e154f4e3e Mon Sep 17 00:00:00 2001 From: Dimitri Savineau Date: Fri, 24 Oct 2014 15:43:25 -0400 Subject: [PATCH] dashboard: Allow override of neutron_options When using specific neutron driver like cisco n1kv we need to have cisco profile enable in horizon. This patch allow to override neutron_options in horizon class in order to enable cisco profile. It's also useful when we need to activate vpnaas or fwaas in the dashboard. https://blueprints.launchpad.net/horizon/+spec/horizon-cisco-n1k Signed-off-by: Dimitri Savineau --- manifests/dashboard.pp | 15 ++++++++++++--- spec/classes/cloud_dashboard_spec.rb | 18 ++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/manifests/dashboard.pp b/manifests/dashboard.pp index e5c9fad2..782bba43 100644 --- a/manifests/dashboard.pp +++ b/manifests/dashboard.pp @@ -75,6 +75,11 @@ # Useful when activating SSL binding on HAproxy and not in Horizon. # Defaults to false # +# [*neutron_extra_options*] +# (optional) Enable optional services provided by neutron +# Useful when using cisco n1kv plugin, vpnaas or fwaas. +# Default to {} + class cloud::dashboard( $ks_keystone_internal_host = '127.0.0.1', $secret_key = 'secrete', @@ -94,6 +99,7 @@ class cloud::dashboard( $os_endpoint_type = undef, $allowed_hosts = $::fqdn, $vhost_extra_params = {}, + $neutron_extra_options = {}, ) { # We build the param needed for horizon class @@ -111,6 +117,11 @@ class cloud::dashboard( } $vhost_extra_params_real = merge ($vhost_extra_params, $extra_params) + $neutron_options = { + 'enable_lb' => true + } + $neutron_options_real = merge ($neutron_options, $neutron_extra_options) + ensure_resource('class', 'apache', { default_vhost => false }) @@ -124,9 +135,7 @@ class cloud::dashboard( keystone_url => $keystone_url, cache_server_ip => false, django_debug => $debug, - neutron_options => { - 'enable_lb' => true - }, + neutron_options => $neutron_options_real, listen_ssl => $listen_ssl, horizon_cert => $horizon_cert, horizon_key => $horizon_key, diff --git a/spec/classes/cloud_dashboard_spec.rb b/spec/classes/cloud_dashboard_spec.rb index 92e243f7..5dffa024 100644 --- a/spec/classes/cloud_dashboard_spec.rb +++ b/spec/classes/cloud_dashboard_spec.rb @@ -79,6 +79,24 @@ describe 'cloud::dashboard' do end end + context 'with cisco plugin enabled' do + before do + params.merge!( + :neutron_extra_options => { + 'profile_support' => 'cisco' + }) + end + + it 'configure horizon with cisco support' do + is_expected.to contain_class('horizon').with( + :neutron_options => { + 'enable_lb' => true, + 'profile_support' => 'cisco' + }, + ) + end + end + context 'with multiple allowed_hosts' do before do params.merge!(:allowed_hosts => ['horizon.openstack.org', 'vip.openstack.org'])