From 04854bf34bb8db85db7263af8bcac1872243d9b1 Mon Sep 17 00:00:00 2001 From: Mathias Fechner Date: Tue, 19 Dec 2017 14:56:26 +0100 Subject: [PATCH] Added Parameter horizon_upload_mode Adds a new Puppet parameter "horizon_upload_mode" which goes into the local_settings.py configuration file and allows to change the parameter "HORIZON_IMAGES_UPLOAD_MODE" to one of "legacy", "off" or "direct" (default is "legacy"). Change-Id: I2e36227d318dd74267ad23f14595481b379cbbd6 Closes-Bug: 1738814 --- manifests/init.pp | 7 +++++++ releasenotes/notes/add-b3d6015cc987a835.yaml | 6 ++++++ spec/classes/horizon_init_spec.rb | 14 +++++++++++++- templates/local_settings.py.erb | 3 +++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/add-b3d6015cc987a835.yaml diff --git a/manifests/init.pp b/manifests/init.pp index a6f5986d..d52ada1a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -399,6 +399,12 @@ # Example: # customization_module => "my_project.overrides" # +# [*horizon_upload_mode*] +# (optional) Horizon provides the upload mode. The default mode is legacy, off +# will disable the function in Horizon, direct will allow the user agent to directly +# talk to the glance-api. +# +# # === DEPRECATED group/name # # [*fqdn*] @@ -510,6 +516,7 @@ class horizon( $password_validator_help = undef, $enable_user_pass = true, $customization_module = undef, + $horizon_upload_mode = undef, # DEPRECATED PARAMETERS $custom_theme_path = undef, $fqdn = undef, diff --git a/releasenotes/notes/add-b3d6015cc987a835.yaml b/releasenotes/notes/add-b3d6015cc987a835.yaml new file mode 100644 index 00000000..bed5c911 --- /dev/null +++ b/releasenotes/notes/add-b3d6015cc987a835.yaml @@ -0,0 +1,6 @@ +--- + +features: + - Add the config option "HORIZON_IMAGES_UPLOAD_MODE". + now it is possible in puppet to configure the option + with "off", "legacy" and "direct". diff --git a/spec/classes/horizon_init_spec.rb b/spec/classes/horizon_init_spec.rb index c01f661b..3350ab49 100644 --- a/spec/classes/horizon_init_spec.rb +++ b/spec/classes/horizon_init_spec.rb @@ -600,6 +600,19 @@ describe 'horizon' do ]) end end + + context 'with upload mode' do + before do + params.merge!({ + :horizon_upload_mode => 'direct', + }) + end + it 'sets HORIZON_IMAGES_UPLOAD_MODE in local_settings.py' do + verify_concat_fragment_contents(catalogue, 'local_settings.py', [ + 'HORIZON_IMAGES_UPLOAD_MODE = direct', + ]) + end + end end shared_examples_for 'horizon on RedHat' do @@ -650,5 +663,4 @@ describe 'horizon' do it_behaves_like "horizon on #{facts[:osfamily]}" end end - end diff --git a/templates/local_settings.py.erb b/templates/local_settings.py.erb index 5f30a1bb..d2d20a57 100644 --- a/templates/local_settings.py.erb +++ b/templates/local_settings.py.erb @@ -1029,3 +1029,6 @@ REST_API_REQUIRED_SETTINGS = ['OPENSTACK_HYPERVISOR_FEATURES', HORIZON_CONFIG["disallow_iframe_embed"] = True <% end %> +<% if @horizon_upload_mode %> +HORIZON_IMAGES_UPLOAD_MODE = <%= @horizon_upload_mode %> +<% end %>