Remove deprecated parameters

Removes some deprecated parameters that was left
in ::sahara

Change-Id: Iea6ada581cb7f1e629029c257a97bed7fdea977e
This commit is contained in:
Tobias Urdin 2018-11-29 09:46:09 +01:00
parent faecd0fa69
commit 96f884bc9b
8 changed files with 51 additions and 85 deletions

View File

@ -28,10 +28,17 @@ class Puppet::Provider::Sahara < Puppet::Provider::Openstack
def self.sahara_request(service, action, error, properties=nil)
properties ||= []
@credentials.username = sahara_credentials['admin_user']
@credentials.password = sahara_credentials['admin_password']
@credentials.project_name = sahara_credentials['admin_tenant_name']
@credentials.username = sahara_credentials['username']
@credentials.password = sahara_credentials['password']
@credentials.project_name = sahara_credentials['project_name']
@credentials.auth_url = auth_endpoint
if sahara_credentials['region_name']
@credentials.region_name = sahara_credentials['region_name']
end
if @credentials.version == '3'
@credentials.user_domain_name = sahara_credentials['user_domain_name']
@credentials.project_domain_name = sahara_credentials['project_domain_name']
end
raise error unless @credentials.set?
Puppet::Provider::Openstack.request(service, action, properties, @credentials)
end
@ -45,13 +52,26 @@ class Puppet::Provider::Sahara < Puppet::Provider::Openstack
end
def self.get_sahara_credentials
auth_keys = ['auth_url', 'admin_tenant_name', 'admin_user',
'admin_password']
auth_keys = ['auth_url', 'project_name', 'username',
'password']
conf = sahara_conf
if conf and conf['keystone_authtoken'] and
auth_keys.all?{|k| !conf['keystone_authtoken'][k].nil?}
creds = Hash[ auth_keys.map \
{ |k| [k, conf['keystone_authtoken'][k].strip] } ]
if conf['project_domain_name']
creds['project_domain_name'] = conf['project_domain_name']
else
creds['project_domain_name'] = 'Default'
end
if conf['user_domain_name']
creds['user_domain_name'] = conf['user_domain_name']
else
creds['user_domain_name'] = 'Default'
end
if conf['keystone_authtoken']['region_name']
creds['region_name'] = conf['keystone_authtoken']['region_name']
end
return creds
else
raise(Puppet::Error, "File: #{conf_filename} does not contain all " +

View File

@ -226,32 +226,6 @@
#
# === DEPRECATED PARAMETERS
#
# [*admin_user*]
# (Optional) Service user name
# Defaults to undef.
#
# [*admin_password*]
# (Optional) Service user password.
# Defaults to undef.
#
# [*admin_tenant_name*]
# (Optional) Service tenant name.
# Defaults to undef.
#
# [*identity_uri*]
# (Optional) Complete admin Identity API endpoint.
# This should specify the unversioned root endpoint.
# Defaults to undef.
#
# [*memcached_servers*]
# (optinal) a list of memcached server(s) to use for caching. If left
# undefined, tokens will instead be cached in-process.
# Defaults to undef.
#
# [*use_neutron*]
# (Optional) Whether to use neutron
# Defaults to undef.
#
# [*zeromq_bind_address*]
# (Optional) Bind address; wildcard, ethernet, or ip address.
# Defaults to undef.
@ -329,12 +303,6 @@ class sahara(
$purge_config = false,
$default_ntp_server = $::os_service_default,
# DEPRECATED PARAMETERS
$admin_user = undef,
$admin_password = undef,
$admin_tenant_name = undef,
$identity_uri = undef,
$memcached_servers = undef,
$use_neutron = undef,
$zeromq_bind_address = undef,
$zeromq_contexts = undef,
$zeromq_topic_backlog = undef,
@ -348,22 +316,6 @@ class sahara(
include ::sahara::db
include ::sahara::policy
if $use_neutron {
warning('The use_neutron parameter has been deprecated and will be removed in the future release.')
}
if $admin_user or $admin_password or
$admin_tenant_name or
$identity_uri or $memcached_servers {
warning("sahara::admin_user, sahara::admin_password, \
sahara::identity_uri, sahara::admin_tenant_name and sahara::memcached_servers are \
deprecated. Please use sahara::keystone::authtoken::* parameters instead.")
}
if $admin_password {
include ::sahara::keystone::authtoken
}
package { 'sahara-common':
ensure => $package_ensure,
name => $::sahara::params::common_package_name,

View File

@ -54,14 +54,10 @@
# This url should *not* contain any trailing '/'.
# Defaults to 'http://127.0.0.1:8386/v1.1/%(tenant_id)s'
#
# === Deprecation notes
#
# If any value is provided for public_protocol, public_address or port parameters,
# public_url will be completely ignored. The same applies for internal and admin parameters.
#
# === Examples
#
# class { 'sahara::keystone::auth':
# password => 'secret',
# public_url => 'https://10.0.0.10:8386/v1.1/%(tenant_id)s',
# internal_url => 'https://10.0.0.11:8386/v1.1/%(tenant_id)s',
# admin_url => 'https://10.0.0.11:8386/v1.1/%(tenant_id)s',

View File

@ -228,18 +228,11 @@ class sahara::keystone::authtoken(
warning('hash_algorithms parameter is deprecated, has no effect and will be removed in the future.')
}
#NOTE(emilien): Use pick to keep backward compatibility
$username_real = pick($::sahara::admin_user,$username)
$password_real = pick($::sahara::admin_password,$password)
$project_name_real = pick($::sahara::admin_tenant_name,$project_name)
$memcached_servers_real = pick($::sahara::memcached_servers,$memcached_servers)
$auth_url_real = pick($::sahara::identity_uri,$auth_url)
keystone::resource::authtoken { 'sahara_config':
username => $username_real,
password => $password_real,
project_name => $project_name_real,
auth_url => $auth_url_real,
username => $username,
password => $password,
project_name => $project_name,
auth_url => $auth_url,
www_authenticate_uri => $www_authenticate_uri,
auth_version => $auth_version,
auth_type => $auth_type,
@ -264,7 +257,7 @@ class sahara::keystone::authtoken(
memcache_security_strategy => $memcache_security_strategy,
memcache_use_advanced_pool => $memcache_use_advanced_pool,
memcache_pool_unused_timeout => $memcache_pool_unused_timeout,
memcached_servers => $memcached_servers_real,
memcached_servers => $memcached_servers,
manage_memcache_package => $manage_memcache_package,
region_name => $region_name,
token_cache_time => $token_cache_time,

View File

@ -5,15 +5,13 @@
# === Parameters
#
# [*notification_transport_url*]
# (optional) A URL representing the messaging driver to use for notifications
# (Optional) A URL representing the messaging driver to use for notifications
# and its full configuration. Transport URLs take the form:
# transport://user:pass@host1:port[,hostN:portN]/virtual_host
# Defaults to $::os_service_default
#
# [*notification_driver*]
# (Optional) Notification driver to use. WARNING: the enable_notifications is
# deprecated. plese specify the notification_driver if you wish to enable
# notifications
# (Optional) Notification driver to use.
# Defaults to $::os_service_default.
#
# [*notification_topics*]

View File

@ -0,0 +1,7 @@
---
upgrade:
- |
The deprecated parameters admin_user, admin_password, admin_tenant_name,
auth_uri, identity_uri and memcached_servers in ::sahara is now removed.
- |
The deprecated parameter sahara::use_neutron is now removed.

View File

@ -7,8 +7,7 @@ describe 'sahara' do
let :params do
{
:admin_password => 'secrete',
:purge_config => false,
:purge_config => false,
}
end
@ -32,7 +31,6 @@ describe 'sahara' do
it { is_expected.to contain_sahara_config('DEFAULT/use_floating_ips').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('keystone_authtoken/www_authenticate_uri').with_value('http://127.0.0.1:5000/') }
it { is_expected.to contain_sahara_config('DEFAULT/plugins').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_reconnect_delay').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/kombu_compression').with_value('<SERVICE DEFAULT>') }

View File

@ -24,17 +24,19 @@ describe Puppet::Provider::Sahara do
it 'should read conf file with all sections' do
creds_hash = {
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
'project_domain_name' => 'Default',
'user_domain_name' => 'Default',
}
mock = {
'keystone_authtoken' => {
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'admin_tenant_name' => 'admin_tenant',
'admin_user' => 'admin',
'admin_password' => 'password',
'auth_url' => 'https://192.168.56.210:5000/v2.0/',
'project_name' => 'admin_tenant',
'username' => 'admin',
'password' => 'password',
}
}
Puppet::Util::IniConfig::File.expects(:new).returns(mock)