From 13d6327fd82c7624f9088e2681fdb88cdce0d929 Mon Sep 17 00:00:00 2001 From: Iury Gregory Melo Ferreira Date: Sat, 21 May 2016 08:56:01 -0300 Subject: [PATCH] Change enabled_apis to list Remove mitaka warnings and let the default be list. Change-Id: I46679442ce6f0dd0016a4937702c5d5be77d4397 --- manifests/api.pp | 26 ++++--------------- .../notes/enabled_apis-55985bb85989601c.yaml | 3 +++ spec/classes/nova_api_spec.rb | 22 ---------------- 3 files changed, 8 insertions(+), 43 deletions(-) create mode 100644 releasenotes/notes/enabled_apis-55985bb85989601c.yaml diff --git a/manifests/api.pp b/manifests/api.pp index bb0d28747..1356f4b20 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -53,8 +53,6 @@ # # [*enabled_apis*] # (optional) A list of apis to enable -# It was a string until now but will be an array. -# To avoid a warning, use an array, like ['osapi_compute', metadata'] for example. # Defaults to ['osapi_compute', 'metadata'] # # [*use_forwarded_for*] @@ -253,20 +251,6 @@ class nova::api( } } - # In N release, enabled_apis should be an array by default - if is_array($enabled_apis) { - # let's transform the array in a string - # ['osapi_compute', 'metadata'] would become 'osapi_compute,metadata' - $enabled_apis_string = join($enabled_apis, ',') - } else { - # But for Mitaka cycle, we maintain backward compatibility: - # when running wsgi, we need to know what to exactly enable or not. - # since enabled_apis is not an array, so we need to grep services - # so we can detect what is actually activated for eventlet or not. - $enabled_apis_string = $enabled_apis - warning('In N cycle, enabled_apis will have to be an array of APIs to enable.') - } - # metadata can't be run in wsgi so we have to enable it in eventlet anyway. if ('metadata' in $enabled_apis and $service_name == 'httpd') { $enable_metadata = true @@ -278,16 +262,16 @@ class nova::api( if $service_name == $::nova::params::api_service_name { # if running evenlet, we use the original puppet parameter # so people can enable custom service names and we keep backward compatibility. - $enabled_apis_real = $enabled_apis_string + $enabled_apis_real = $enabled_apis $service_enabled = $enabled } elsif $service_name == 'httpd' { # when running wsgi, we want to enable metadata in eventlet if part of enabled_apis if $enable_metadata { - $enabled_apis_real = 'metadata' + $enabled_apis_real = ['metadata'] $service_enabled = $enabled } else { - # otherwise, set it to undef - $enabled_apis_real = undef + # otherwise, set it to empty list + $enabled_apis_real = [] # if running wsgi for compute, and metadata disabled # we don't need to enable nova-api service. $service_enabled = false @@ -309,7 +293,7 @@ class nova::api( nova_config { 'wsgi/api_paste_config': value => $api_paste_config; - 'DEFAULT/enabled_apis': value => $enabled_apis_real; + 'DEFAULT/enabled_apis': value => join($enabled_apis_real, ','); 'DEFAULT/osapi_compute_listen': value => $api_bind_address; 'DEFAULT/metadata_listen': value => $metadata_listen; 'DEFAULT/metadata_listen_port': value => $metadata_listen_port; diff --git a/releasenotes/notes/enabled_apis-55985bb85989601c.yaml b/releasenotes/notes/enabled_apis-55985bb85989601c.yaml new file mode 100644 index 000000000..2ae3fdef5 --- /dev/null +++ b/releasenotes/notes/enabled_apis-55985bb85989601c.yaml @@ -0,0 +1,3 @@ +--- +upgrade: + - enabled_apis in api.pp now only accepts list values. diff --git a/spec/classes/nova_api_spec.rb b/spec/classes/nova_api_spec.rb index 46b6c42eb..cf334e034 100644 --- a/spec/classes/nova_api_spec.rb +++ b/spec/classes/nova_api_spec.rb @@ -314,28 +314,6 @@ describe 'nova::api' do end end - context 'when enabled_apis is not an array' do - before do - params.merge!({ - :service_name => 'httpd', - :enabled_apis => 'osapi_compute' }) - end - - let :pre_condition do - "include ::apache - include ::nova" - end - - it 'disable nova API service' do - is_expected.to contain_service('nova-api').with( - :ensure => 'stopped', - :name => platform_params[:nova_api_service], - :enable => false, - :tag => 'nova-service', - ) - end - end - context 'when service_name is not valid' do before do params.merge!({ :service_name => 'foobar' })