diff --git a/manifests/init.pp b/manifests/init.pp index 8eba6452c..060351f6d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -47,6 +47,14 @@ # [*django_debug*] # (optional) Enable or disable Django debugging. Defaults to 'False'. # +# [*openstack_endpoint_type*] +# (optional) endpoint type to use for the endpoints in the Keystone +# service catalog. Defaults to 'undef'. +# +# [*secondary_endpoint_type*] +# (optional) secondary endpoint type to use for the endpoints in the +# Keystone service catalog. Defaults to 'undef'. +# # [*api_result_limit*] # (optional) Maximum number of Swift containers/objects to display # on a single page. Defaults to 1000. @@ -79,6 +87,8 @@ $keystone_scheme = 'http', $keystone_default_role = 'Member', $django_debug = 'False', + $openstack_endpoint_type = undef, + $secondary_endpoint_type = undef, $api_result_limit = 1000, $log_level = 'DEBUG', $can_set_mount_point = 'True', diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index edc84adb9..02fe29147 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -150,5 +150,33 @@ :line => "SSLCertificateKeyFile /etc/ssl/localcerts/apache.key" )} end + + describe 'with openstack_endpoint_type' do + before do + params.merge!({ + :openstack_endpoint_type => 'internalURL', + }) + end + + it 'generates local_settings.py' do + verify_contents(subject, '/etc/openstack-dashboard/local_settings.py', [ + 'OPENSTACK_ENDPOINT_TYPE = "internalURL"', + ]) + end + end + + describe 'with secondary_endpoint_type' do + before do + params.merge!({ + :secondary_endpoint_type => 'ANY-VALUE', + }) + end + + it 'generates local_settings.py' do + verify_contents(subject, '/etc/openstack-dashboard/local_settings.py', [ + 'SECONDARY_ENDPOINT_TYPE = "ANY-VALUE"', + ]) + end + end end end diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index b2b1f79e7..e7cb5e105 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -203,6 +203,9 @@ OPENSTACK_NEUTRON_NETWORK = { # in the Keystone service catalog. Use this setting when Horizon is running # external to the OpenStack environment. The default is 'publicURL'. #OPENSTACK_ENDPOINT_TYPE = "publicURL" +<% if @openstack_endpoint_type %> +OPENSTACK_ENDPOINT_TYPE = "<%= @openstack_endpoint_type %>" +<% end %> # SECONDARY_ENDPOINT_TYPE specifies the fallback endpoint type to use in the # case that OPENSTACK_ENDPOINT_TYPE is not present in the endpoints @@ -210,6 +213,9 @@ OPENSTACK_NEUTRON_NETWORK = { # external to the OpenStack environment. The default is None. This # value should differ from OPENSTACK_ENDPOINT_TYPE if used. #SECONDARY_ENDPOINT_TYPE = "publicURL" +<% if @secondary_endpoint_type %> +SECONDARY_ENDPOINT_TYPE = "<%= @secondary_endpoint_type %>" +<% end %> # The number of objects (Swift containers/objects or images) to display # on a single page before providing a paging element (a "more" link)