From 2417317d866a2428c8e9bfa1548d60a3d87616fe Mon Sep 17 00:00:00 2001 From: Denis Egorenko Date: Thu, 8 Oct 2015 19:31:15 +0300 Subject: [PATCH] Remove deprecated parameters This patch removes parameters from main init and keystone::auth classes, which were marked as deprecated since Kilo release. Change-Id: I83b35136d066a66756a9620c70ec4e42d22d24a2 --- manifests/init.pp | 107 ++---------------- manifests/keystone/auth.pp | 128 +--------------------- spec/classes/sahara_init_spec.rb | 20 ---- spec/classes/sahara_keystone_auth_spec.rb | 19 ---- 4 files changed, 11 insertions(+), 263 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d44b93ae..176bdd38 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -295,41 +295,6 @@ # (optional) Should the service be enabled. # Defaults to undef. # -# [*service_host*] -# (Optional) DEPRECATED: Use host instead. -# Hostname for sahara to listen on -# Defaults to undef. -# -# [*service_port*] -# (Optional) DEPRECATED: Use port instead. -# Port for sahara to listen on -# Defaults to undef. -# -# [*keystone_username*] -# (Optional) DEPRECATED: Use admin_user instead. -# Username for sahara credentials -# Defaults to undef. -# -# [*keystone_password*] -# (Optional) DEPRECATED: Use admin_password instead. -# Password for sahara credentials -# Defaults to undef. -# -# [*keystone_tenant*] -# (Optional) DEPRECATED: Use admin_tenant_name instead. -# Tenant for keystone_username -# Defaults to undef. -# -# [*keystone_url*] -# (Optional) DEPRECATED: Use auth_uri instead. -# Public identity endpoint -# Defaults to undef. -# -# [*identity_url*] -# (Optional) DEPRECATED: Use identity_uri instead. -# Admin identity endpoint -# Defaults to undef. -# class sahara( $package_ensure = 'present', $verbose = undef, @@ -401,68 +366,12 @@ class sahara( # DEPRECATED PARAMETERS $manage_service = undef, $enabled = undef, - $service_host = undef, - $service_port = undef, - $keystone_username = undef, - $keystone_password = undef, - $keystone_tenant = undef, - $keystone_url = undef, - $identity_url = undef, ) { include ::sahara::params include ::sahara::logging include ::sahara::db include ::sahara::policy - if $service_host { - warning('The service_host parameter is deprecated. Use host parameter instead') - $host_real = $service_host - } else { - $host_real = $host - } - - if $service_port { - warning('The service_port parameter is deprecated. Use port parameter instead') - $port_real = $service_port - } else { - $port_real = $port - } - - if $keystone_username { - warning('The keystone_username parameter is deprecated. Use admin_user parameter instead') - $admin_user_real = $keystone_username - } else { - $admin_user_real = $admin_user - } - - if $keystone_password { - warning('The keystone_password parameter is deprecated. Use admin_password parameter instead') - $admin_password_real = $keystone_password - } else { - $admin_password_real = $admin_password - } - - if $keystone_tenant { - warning('The keystone_tenant parameter is deprecated. Use admin_tenant_name parameter instead') - $admin_tenant_name_real = $keystone_tenant - } else { - $admin_tenant_name_real = $admin_tenant_name - } - - if $keystone_url { - warning('The keystone_url parameter is deprecated. Use auth_uri parameter instead') - $auth_uri_real = $keystone_url - } else { - $auth_uri_real = $auth_uri - } - - if $identity_url { - warning('The identity_url parameter is deprecated. Use identity_uri parameter instead') - $identity_uri_real = $identity_url - } else { - $identity_uri_real = $identity_uri - } - package { 'sahara-common': ensure => $package_ensure, name => $::sahara::params::common_package_name, @@ -484,18 +393,18 @@ class sahara( sahara_config { 'DEFAULT/use_neutron': value => $use_neutron; 'DEFAULT/use_floating_ips': value => $use_floating_ips; - 'DEFAULT/host': value => $host_real; - 'DEFAULT/port': value => $port_real; + 'DEFAULT/host': value => $host; + 'DEFAULT/port': value => $port; } - if $admin_password_real { + if $admin_password { sahara_config { - 'keystone_authtoken/auth_uri': value => $auth_uri_real; - 'keystone_authtoken/identity_uri': value => $identity_uri_real; - 'keystone_authtoken/admin_user': value => $admin_user_real; - 'keystone_authtoken/admin_tenant_name': value => $admin_tenant_name_real; + 'keystone_authtoken/auth_uri': value => $auth_uri; + 'keystone_authtoken/identity_uri': value => $identity_uri; + 'keystone_authtoken/admin_user': value => $admin_user; + 'keystone_authtoken/admin_tenant_name': value => $admin_tenant_name; 'keystone_authtoken/admin_password': - value => $admin_password_real, + value => $admin_password, secret => true; } } diff --git a/manifests/keystone/auth.pp b/manifests/keystone/auth.pp index 943a6476..a28ff433 100644 --- a/manifests/keystone/auth.pp +++ b/manifests/keystone/auth.pp @@ -51,51 +51,6 @@ # (optional) The endpoint's internal url. (Defaults to 'http://127.0.0.1:8386/v1.1/%(tenant_id)s') # This url should *not* contain any trailing '/'. # -# [*version*] -# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead. -# API version endpoint. (Defaults to 'v1.1') -# Setting this parameter overrides public_url, internal_url and admin_url parameters. -# -# [*port*] -# (optional) DEPRECATED: Use public_url, internal_url and admin_url instead. -# Default port for endpoints. (Defaults to 8386) -# Setting this parameter overrides public_url, internal_url and admin_url parameters. -# -# [*public_port*] -# (optional) DEPRECATED: Use public_url instead. -# Default port for endpoints. (Defaults to $port) -# Setting this parameter overrides public_url parameter. -# -# [*public_protocol*] -# (optional) DEPRECATED: Use public_url instead. -# Protocol for public endpoint. (Defaults to 'http') -# Setting this parameter overrides public_url parameter. -# -# [*public_address*] -# (optional) DEPRECATED: Use public_url instead. -# Public address for endpoint. (Defaults to '127.0.0.1') -# Setting this parameter overrides public_url parameter. -# -# [*internal_protocol*] -# (optional) DEPRECATED: Use internal_url instead. -# Protocol for internal endpoint. (Defaults to 'http') -# Setting this parameter overrides internal_url parameter. -# -# [*internal_address*] -# (optional) DEPRECATED: Use internal_url instead. -# Internal address for endpoint. (Defaults to '127.0.0.1') -# Setting this parameter overrides internal_url parameter. -# -# [*admin_protocol*] -# (optional) DEPRECATED: Use admin_url instead. -# Protocol for admin endpoint. (Defaults to 'http') -# Setting this parameter overrides admin_url parameter. -# -# [*admin_address*] -# (optional) DEPRECATED: Use admin_url instead. -# Admin address for endpoint. (Defaults to '127.0.0.1') -# Setting this parameter overrides admin_url parameter. -# # === Deprecation notes # # If any value is provided for public_protocol, public_address or port parameters, @@ -122,85 +77,8 @@ class sahara::keystone::auth( $public_url = 'http://127.0.0.1:8386/v1.1/%(tenant_id)s', $admin_url = 'http://127.0.0.1:8386/v1.1/%(tenant_id)s', $internal_url = 'http://127.0.0.1:8386/v1.1/%(tenant_id)s', - # DEPRECATED PARAMETERS - $version = undef, - $port = undef, - $public_port = undef, - $public_protocol = undef, - $public_address = undef, - $public_port = undef, - $internal_protocol = undef, - $internal_address = undef, - $admin_protocol = undef, - $admin_address = undef, ) { - if $version { - warning('The version parameter is deprecated, use public_url, internal_url and admin_url instead.') - } - - if $port { - warning('The port parameter is deprecated, use public_url, internal_url and admin_url instead.') - } - - if $public_port { - warning('The public_port parameter is deprecated, use public_url instead.') - } - - if $public_protocol { - warning('The public_protocol parameter is deprecated, use public_url instead.') - } - - if $internal_protocol { - warning('The internal_protocol parameter is deprecated, use internal_url instead.') - } - - if $admin_protocol { - warning('The admin_protocol parameter is deprecated, use admin_url instead.') - } - - if $public_address { - warning('The public_address parameter is deprecated, use public_url instead.') - } - - if $internal_address { - warning('The internal_address parameter is deprecated, use internal_url instead.') - } - - if $admin_address { - warning('The admin_address parameter is deprecated, use admin_url instead.') - } - - if ($public_protocol or $public_address or $port or $public_port or $version) { - $public_url_real = sprintf('%s://%s:%s/%s/%%(tenant_id)s', - pick($public_protocol, 'http'), - pick($public_address, '127.0.0.1'), - pick($public_port, $port, '8386'), - pick($version, 'v1.1')) - } else { - $public_url_real = $public_url - } - - if ($admin_protocol or $admin_address or $port or $version) { - $admin_url_real = sprintf('%s://%s:%s/%s/%%(tenant_id)s', - pick($admin_protocol, 'http'), - pick($admin_address, '127.0.0.1'), - pick($port, '8386'), - pick($version, 'v1.1')) - } else { - $admin_url_real = $admin_url - } - - if ($internal_protocol or $internal_address or $port or $version) { - $internal_url_real = sprintf('%s://%s:%s/%s/%%(tenant_id)s', - pick($internal_protocol, 'http'), - pick($internal_address, '127.0.0.1'), - pick($port, '8386'), - pick($version, 'v1.1')) - } else { - $internal_url_real = $internal_url - } - $real_service_name = pick($service_name, $auth_name) keystone::resource::service_identity { $real_service_name: @@ -213,8 +91,8 @@ class sahara::keystone::auth( password => $password, email => $email, tenant => $tenant, - public_url => $public_url_real, - admin_url => $admin_url_real, - internal_url => $internal_url_real, + public_url => $public_url, + admin_url => $admin_url, + internal_url => $internal_url, } } diff --git a/spec/classes/sahara_init_spec.rb b/spec/classes/sahara_init_spec.rb index 3beb6bff..c2310795 100644 --- a/spec/classes/sahara_init_spec.rb +++ b/spec/classes/sahara_init_spec.rb @@ -58,26 +58,6 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('plugin1,plugin2') } end - context 'with deprecated params' do - let :params do { - :service_host => 'localhost', - :service_port => '8387', - :keystone_url => 'http://8.8.8.8:5000/v2.0/', - :identity_url => 'http://8.8.8.8:35357/', - :keystone_username => 'sahara', - :keystone_tenant => 'sahara-tenant', - :keystone_password => 'new_password', - } - end - - it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('localhost') } - it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('8387') } - it { is_expected.to contain_sahara_config('keystone_authtoken/auth_uri').with_value('http://8.8.8.8:5000/v2.0/') } - it { is_expected.to contain_sahara_config('keystone_authtoken/identity_uri').with_value('http://8.8.8.8:35357/') } - it { is_expected.to contain_sahara_config('keystone_authtoken/admin_user').with_value('sahara') } - it { is_expected.to contain_sahara_config('keystone_authtoken/admin_tenant_name').with_value('sahara-tenant') } - it { is_expected.to contain_sahara_config('keystone_authtoken/admin_password').with_value('new_password').with_secret(true) } - end end shared_examples_for 'sahara rpc_backend' do diff --git a/spec/classes/sahara_keystone_auth_spec.rb b/spec/classes/sahara_keystone_auth_spec.rb index 98bdb704..c08b1fd2 100644 --- a/spec/classes/sahara_keystone_auth_spec.rb +++ b/spec/classes/sahara_keystone_auth_spec.rb @@ -67,25 +67,6 @@ describe 'sahara::keystone::auth' do ) } end - describe 'with deprecated endpoint parameters' do - let :params do - { :password => 'sahara_password', - :public_protocol => 'https', - :public_port => '80', - :public_address => '10.10.10.10', - :port => '81', - :internal_address => '10.10.10.11', - :admin_address => '10.10.10.12' } - end - - it { is_expected.to contain_keystone_endpoint('RegionOne/sahara').with( - :ensure => 'present', - :public_url => "https://10.10.10.10:80/v1.1/%(tenant_id)s", - :internal_url => "http://10.10.10.11:81/v1.1/%(tenant_id)s", - :admin_url => "http://10.10.10.12:81/v1.1/%(tenant_id)s" - ) } - end - describe 'when overriding auth name' do let :params do { :password => 'foo',