Merge "Remove trove::api::service_credentials"

This commit is contained in:
Zuul 2024-04-25 15:14:14 +00:00 committed by Gerrit Code Review
commit e46bb54f4b
6 changed files with 6 additions and 160 deletions

View File

@ -21,7 +21,7 @@ class { 'trove':
default_transport_url => 'rabbit://trove:an_even_bigger_secret@10.0.0.1:5672/trove',
}
class { 'trove::api::service_credentials':
class { 'trove::service_credentials':
password => 'verysecrete',
}

View File

@ -128,9 +128,6 @@ class trove::api(
include trove::deps
include trove::db
include trove::db::sync
if (!defined(Class[trove::service_credentials])) {
include trove::api::service_credentials
}
# basic service config
trove_config {

View File

@ -1,62 +0,0 @@
# The trove::api::service_credentials class helps configure auth settings
#
# == Parameters
#
# [*password*]
# (required) the keystone password for trove services
#
# [*auth_url*]
# (optional) the keystone public endpoint
# Defaults to 'http://127.0.0.1:5000'
#
# [*region_name*]
# (optional) the keystone region of this node
# Defaults to 'RegionOne'
#
# [*username*]
# (optional) the keystone user for trove services
# Defaults to 'trove'
#
# [*project_name*]
# (optional) the keystone tenant name for trove services
# Defaults to 'services'
#
# [*project_domain_name*]
# (optional) the keystone project domain name for trove services
# Defaults to 'Default'
#
# [*user_domain_name*]
# (optional) the keystone user domain name for trove services
# Defaults to 'Default'
#
# [*system_scope*]
# (optional) Scope for system operations.
# Defaults to $facts['os_service_default']
#
class trove::api::service_credentials (
$password,
$auth_url = 'http://127.0.0.1:5000',
$region_name = 'RegionOne',
$username = 'trove',
$project_name = 'services',
$project_domain_name = 'Default',
$user_domain_name = 'Default',
$system_scope = $facts['os_service_default'],
) {
include trove::deps
warning("The trove::api::service_credentials class is deprecated. \
Use the trove::service_credentials class instead.")
class { 'trove::service_credentials':
password => $password,
auth_url => $auth_url,
region_name => $region_name,
username => $username,
project_name => $project_name,
project_domain_name => $project_domain_name,
user_domain_name => $user_domain_name,
system_scope => $system_scope,
}
}

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
The deprecated ``trove::api::service_credentials`` class has been removed.
Use the ``trove::service_credentials`` class instead.

View File

@ -1,90 +0,0 @@
#
# Copyright (C) 2020 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
require 'spec_helper'
describe 'trove::api::service_credentials' do
shared_examples 'trove::api::service_credentials' do
let :params do
{
:password => 'verysecrete'
}
end
context 'with default parameters' do
it 'configures service credentials with default parameters' do
is_expected.to contain_trove_config('service_credentials/auth_url').with_value('http://127.0.0.1:5000')
is_expected.to contain_trove_config('service_credentials/username').with_value('trove')
is_expected.to contain_trove_config('service_credentials/password').with_value('verysecrete').with_secret(true)
is_expected.to contain_trove_config('service_credentials/project_name').with_value('services')
is_expected.to contain_trove_config('service_credentials/region_name').with_value('RegionOne')
is_expected.to contain_trove_config('service_credentials/user_domain_name').with_value('Default')
is_expected.to contain_trove_config('service_credentials/project_domain_name').with_value('Default')
is_expected.to contain_trove_config('service_credentials/system_scope').with_value('<SERVICE DEFAULT>')
end
end
context 'when overriding defaults' do
before do
params.merge!({
:auth_url => 'http://localhost:5000',
:username => 'trove2',
:project_name => 'services2',
:region_name => 'RegionTwo',
:user_domain_name => 'MyDomain',
:project_domain_name => 'MyDomain',
})
end
it 'configures service credentials with default parameters' do
is_expected.to contain_trove_config('service_credentials/auth_url').with_value('http://localhost:5000')
is_expected.to contain_trove_config('service_credentials/username').with_value('trove2')
is_expected.to contain_trove_config('service_credentials/project_name').with_value('services2')
is_expected.to contain_trove_config('service_credentials/region_name').with_value('RegionTwo')
is_expected.to contain_trove_config('service_credentials/user_domain_name').with_value('MyDomain')
is_expected.to contain_trove_config('service_credentials/project_domain_name').with_value('MyDomain')
is_expected.to contain_trove_config('service_credentials/system_scope').with_value('<SERVICE DEFAULT>')
end
end
context 'when system_scope is set' do
before do
params.merge!(
:system_scope => 'all'
)
end
it 'configures system-scoped credential' do
is_expected.to contain_trove_config('service_credentials/project_domain_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_config('service_credentials/project_name').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_config('service_credentials/system_scope').with_value('all')
end
end
end
on_supported_os({
:supported_os => OSDefaults.get_supported_os
}).each do |os,facts|
let (:facts) do
facts.merge!(OSDefaults.get_facts())
end
context "on #{os}" do
it_configures 'trove::api::service_credentials'
end
end
end

View File

@ -32,9 +32,6 @@ describe 'trove::api' do
let :pre_condition do
"class { 'trove':
}
class { 'trove::api::service_credentials':
password => 'verysectrete',
}
class { 'trove::keystone::authtoken':
password => 'a_big_secret',
}"
@ -45,7 +42,6 @@ describe 'trove::api' do
is_expected.to contain_class('trove::db')
is_expected.to contain_class('trove::db::sync')
is_expected.to contain_class('trove::params')
is_expected.to contain_class('trove::api::service_credentials')
end
it 'installs trove-api package and service' do