From c2e40bceab81eccbb2012caf5d8c75077724c5b4 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Wed, 8 Apr 2020 21:37:13 +0900 Subject: [PATCH] Replace removed ironic api_endpoint by endpoint_override Deprecate api_endpoint in nova::ironic::common because its actual parameter, [ironic]api_endpioint, was already removed from nova in Train release[1]. Also, add new nova::ironic::common::endpoint_override parameter to allow operators to override endpoint to be used in acceess to ironic. [1] I527f512b371705b490ba55dfab101340d417edb6 Change-Id: I838240f7138adcbf619ce12ac616f0bc517570dd --- manifests/ironic/common.pp | 43 ++++++++++++------- ...-common-api_endpoint-be452cc86092eb4d.yaml | 6 +++ spec/classes/nova_ironic_common_spec.rb | 19 ++------ 3 files changed, 37 insertions(+), 31 deletions(-) create mode 100644 releasenotes/notes/nova-ironic-common-api_endpoint-be452cc86092eb4d.yaml diff --git a/manifests/ironic/common.pp b/manifests/ironic/common.pp index 92a073a02..62b35e6cc 100644 --- a/manifests/ironic/common.pp +++ b/manifests/ironic/common.pp @@ -1,9 +1,5 @@ # == Class: nova::ironic::common # -# [*api_endpoint*] -# The url for Ironic api endpoint. -# Defaults to 'http://127.0.0.1:6385/v1' -# # [*auth_plugin*] # The authentication plugin to use when connecting to nova. # Defaults to 'password' @@ -24,6 +20,10 @@ # The admin username for Ironic to connect to Nova. # Defaults to 'admin' # +# [*endpoint_override*] +# (optional) Override the endpoint to use to talk to Ironic. +# Defaults to $::os_service_default +# # [*api_max_retries*] # Max times for ironic driver to poll ironic api # @@ -38,32 +38,45 @@ # (Optional) Name of domain for $project_domain_name # Defaults to 'Default' # +# DEPRECATED PARAMETERS +# +# [*api_endpoint*] +# The url for Ironic api endpoint. +# Defaults to undef +# class nova::ironic::common ( - $api_endpoint = 'http://127.0.0.1:6385/v1', $auth_plugin = 'password', $auth_url = 'http://127.0.0.1:5000/', $password = 'ironic', $project_name = 'services', $username = 'admin', + $endpoint_override = $::os_service_default, $api_max_retries = $::os_service_default, $api_retry_interval = $::os_service_default, $user_domain_name = 'Default', $project_domain_name = 'Default', + # DEPRECATED PARAMETERS + $api_endpoint = undef, ) { include nova::deps + if $api_endpoint != undef { + warning('nova::ironic::common::api_endpoint is deprecated and has no effect. \ +Use nova::ironic::common::endpoint_override instead.') + } + nova_config { - 'ironic/auth_plugin': value => $auth_plugin; - 'ironic/username': value => $username; - 'ironic/password': value => $password, secret => true; - 'ironic/auth_url': value => $auth_url; - 'ironic/project_name': value => $project_name; - 'ironic/api_endpoint': value => $api_endpoint; - 'ironic/api_max_retries': value => $api_max_retries; - 'ironic/api_retry_interval': value => $api_retry_interval; - 'ironic/user_domain_name': value => $user_domain_name; - 'ironic/project_domain_name': value => $project_domain_name; + 'ironic/auth_plugin': value => $auth_plugin; + 'ironic/username': value => $username; + 'ironic/password': value => $password, secret => true; + 'ironic/auth_url': value => $auth_url; + 'ironic/project_name': value => $project_name; + 'ironic/endpoint_override': value => $endpoint_override; + 'ironic/api_max_retries': value => $api_max_retries; + 'ironic/api_retry_interval': value => $api_retry_interval; + 'ironic/user_domain_name': value => $user_domain_name; + 'ironic/project_domain_name': value => $project_domain_name; } } diff --git a/releasenotes/notes/nova-ironic-common-api_endpoint-be452cc86092eb4d.yaml b/releasenotes/notes/nova-ironic-common-api_endpoint-be452cc86092eb4d.yaml new file mode 100644 index 000000000..8d7153613 --- /dev/null +++ b/releasenotes/notes/nova-ironic-common-api_endpoint-be452cc86092eb4d.yaml @@ -0,0 +1,6 @@ +--- +deprecations: + - | + The nova::ironic::common::api_endpoint is deprecated and has no effect, + because the corresponding [ironic]api_endpoint was removed in Nova. + The nova::ironic::common::endpoint_override should be used instead. diff --git a/spec/classes/nova_ironic_common_spec.rb b/spec/classes/nova_ironic_common_spec.rb index d3ad4db3d..8f06f78b3 100644 --- a/spec/classes/nova_ironic_common_spec.rb +++ b/spec/classes/nova_ironic_common_spec.rb @@ -11,7 +11,7 @@ describe 'nova::ironic::common' do is_expected.to contain_nova_config('ironic/password').with_value('ironic').with_secret(true) is_expected.to contain_nova_config('ironic/auth_url').with_value('http://127.0.0.1:5000/') is_expected.to contain_nova_config('ironic/project_name').with_value('services') - is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://127.0.0.1:6385/v1') + is_expected.to contain_nova_config('ironic/endpoint_override').with_value('') is_expected.to contain_nova_config('ironic/api_max_retries').with('value' => '') is_expected.to contain_nova_config('ironic/api_retry_interval').with('value' => '') is_expected.to contain_nova_config('ironic/user_domain_name').with_value('Default') @@ -27,7 +27,7 @@ describe 'nova::ironic::common' do :password => 's3cr3t', :auth_url => 'http://10.0.0.10:5000/', :project_name => 'services2', - :api_endpoint => 'http://10.0.0.10:6385/v1', + :endpoint_override => 'http://10.0.0.10:6385/v1', :api_max_retries => 60, :api_retry_interval => 2, :user_domain_name => 'custom_domain', @@ -41,7 +41,7 @@ describe 'nova::ironic::common' do is_expected.to contain_nova_config('ironic/password').with_value('s3cr3t').with_secret(true) is_expected.to contain_nova_config('ironic/auth_url').with_value('http://10.0.0.10:5000/') is_expected.to contain_nova_config('ironic/project_name').with_value('services2') - is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://10.0.0.10:6385/v1') + is_expected.to contain_nova_config('ironic/endpoint_override').with_value('http://10.0.0.10:6385/v1') is_expected.to contain_nova_config('ironic/api_max_retries').with('value' => '60') is_expected.to contain_nova_config('ironic/api_retry_interval').with('value' => '2') is_expected.to contain_nova_config('ironic/user_domain_name').with('value' => 'custom_domain') @@ -49,19 +49,6 @@ describe 'nova::ironic::common' do end end - - context 'with deprecated parameters' do - let :params do - { - :api_endpoint => 'http://10.0.0.10:6385/v1', - } - end - - it 'configures ironic in nova.conf' do - is_expected.to contain_nova_config('ironic/api_endpoint').with_value('http://10.0.0.10:6385/v1') - - end - end end on_supported_os({