Removes Ironic deprecated authtoken options and tests

Change-Id: Id9b8cb6c4a42fb96547c016301ba3a54ce5d5648
This commit is contained in:
Yaguang Tang 2017-07-08 22:35:38 +08:00
parent c47cf92e6a
commit 5f60b10eeb
3 changed files with 7 additions and 59 deletions

View File

@ -57,55 +57,20 @@ class nova::ironic::common (
$username = 'admin',
$api_max_retries = $::os_service_default,
$api_retry_interval = $::os_service_default,
# DEPRECATED
$admin_username = undef,
$admin_password = undef,
$admin_tenant_name = undef,
$admin_url = undef,
) {
include ::nova::deps
if ($admin_username) {
warning('nova::ironic::common::admin_username is deprecated. Please use username')
}
if ($admin_password) {
warning('nova::ironic::common::admin_password is deprecated. Please use password')
}
if ($admin_tenant_name) {
warning('nova::ironic::common::admin_tenant_name is deprecated. Please use project_name')
}
if ($admin_url) {
warning('nova::ironic::common::admin_url is deprecated. Please use auth_url')
}
$username_real = pick($admin_username, $username)
$password_real = pick($admin_password, $password)
$auth_url_real = pick($admin_url, $auth_url)
$project_name_real = pick($admin_tenant_name, $project_name)
nova_config {
'ironic/auth_plugin': value => $auth_plugin;
'ironic/username': value => $username_real;
'ironic/password': value => $password_real;
'ironic/auth_url': value => $auth_url_real;
'ironic/project_name': value => $project_name_real;
'ironic/username': value => $username;
'ironic/password': value => $password;
'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;
}
# TODO(aschultz): these are deprecated, remove in P
nova_config {
'ironic/admin_username': value => $username_real;
'ironic/admin_password': value => $password_real;
'ironic/admin_url': value => $auth_url_real;
'ironic/admin_tenant_name': value => $project_name_real;
}
}

View File

@ -0,0 +1,3 @@
---
upgrade:
- Removes Ironic deprecated admin_* authtoken options.

View File

@ -15,10 +15,6 @@ describe 'nova::ironic::common' do
is_expected.to contain_nova_config('ironic/api_max_retries').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_nova_config('ironic/api_retry_interval').with('value' => '<SERVICE DEFAULT>')
is_expected.to contain_nova_config('ironic/admin_username').with_value('admin')
is_expected.to contain_nova_config('ironic/admin_password').with_value('ironic')
is_expected.to contain_nova_config('ironic/admin_url').with_value('http://127.0.0.1:35357/')
is_expected.to contain_nova_config('ironic/admin_tenant_name').with_value('services')
end
end
@ -45,35 +41,19 @@ describe 'nova::ironic::common' do
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/admin_username').with_value('ironic')
is_expected.to contain_nova_config('ironic/admin_password').with_value('s3cr3t')
is_expected.to contain_nova_config('ironic/admin_url').with_value('http://10.0.0.10:35357/')
is_expected.to contain_nova_config('ironic/admin_tenant_name').with_value('services2')
end
end
context 'with deprecated parameters' do
let :params do
{
:admin_username => 'ironic',
:admin_password => 's3cr3t',
:admin_url => 'http://10.0.0.10:35357/v2.0',
:admin_tenant_name => 'services2',
:api_endpoint => 'http://10.0.0.10:6385/v1',
}
end
it 'configures ironic in nova.conf' do
is_expected.to contain_nova_config('ironic/username').with_value('ironic')
is_expected.to contain_nova_config('ironic/password').with_value('s3cr3t')
is_expected.to contain_nova_config('ironic/auth_url').with_value('http://10.0.0.10:35357/v2.0')
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/admin_username').with_value('ironic')
is_expected.to contain_nova_config('ironic/admin_password').with_value('s3cr3t')
is_expected.to contain_nova_config('ironic/admin_url').with_value('http://10.0.0.10:35357/v2.0')
is_expected.to contain_nova_config('ironic/admin_tenant_name').with_value('services2')
end
end
end