Replace unnecessary usage of false

We currently accept false for some parameters, as an indicator to
purge options but this can be replaced by the os_service_default fact.

Change-Id: Ie6632c21b5723d1db73cfae9fa52b543fd91a605
This commit is contained in:
Takashi Kajinami 2023-06-21 07:34:13 +09:00
parent 1f273d3b4e
commit 80bd5e8abf
3 changed files with 100 additions and 100 deletions

View File

@ -163,10 +163,6 @@
# tenant mode.
# Defaults to false.
#
# [*nova_compute_url*]
# (optional) URL without the tenant segment.
# Defaults to false.
#
# [*rpc_response_timeout*]
# (Optional) Seconds to wait for a response from a call.
# Defaults to $facts['os_service_default']
@ -175,17 +171,21 @@
# (optional) Control exchange.
# Defaults to 'trove'.
#
# [*nova_compute_url*]
# (optional) URL without the tenant segment.
# Defaults to $facts['os_service_default'].
#
# [*cinder_url*]
# (optional) Cinder URL without the tenant segment.
# Defaults to false.
# Defaults to $facts['os_service_default'].
#
# [*swift_url*]
# (optional) Swift URL ending in AUTH_.
# Defaults to false.
# Defaults to $facts['os_service_default'].
#
# [*neutron_url*]
# (optional) Neutron URL without the tenant segment.
# Defaults to false.
# Defaults to $facts['os_service_default'].
#
# [*nova_compute_service_type*]
# (optional) Nova service type to use when searching catalog.
@ -240,96 +240,76 @@
# Defaults to 'present'
#
class trove(
$default_transport_url = $facts['os_service_default'],
$notification_transport_url = $facts['os_service_default'],
$notification_driver = $facts['os_service_default'],
$notification_topics = $facts['os_service_default'],
$rabbit_use_ssl = $facts['os_service_default'],
$rabbit_ha_queues = $facts['os_service_default'],
$rabbit_notification_topic = $facts['os_service_default'],
$rabbit_heartbeat_in_pthread = $facts['os_service_default'],
$kombu_ssl_ca_certs = $facts['os_service_default'],
$kombu_ssl_certfile = $facts['os_service_default'],
$kombu_ssl_keyfile = $facts['os_service_default'],
$kombu_ssl_version = $facts['os_service_default'],
$kombu_reconnect_delay = $facts['os_service_default'],
$kombu_failover_strategy = $facts['os_service_default'],
$amqp_durable_queues = $facts['os_service_default'],
$amqp_server_request_prefix = $facts['os_service_default'],
$amqp_broadcast_prefix = $facts['os_service_default'],
$amqp_group_request_prefix = $facts['os_service_default'],
$amqp_container_name = $facts['os_service_default'],
$amqp_idle_timeout = $facts['os_service_default'],
$amqp_trace = $facts['os_service_default'],
$amqp_ssl_ca_file = $facts['os_service_default'],
$amqp_ssl_cert_file = $facts['os_service_default'],
$amqp_ssl_key_file = $facts['os_service_default'],
$amqp_ssl_key_password = $facts['os_service_default'],
$amqp_sasl_mechanisms = $facts['os_service_default'],
$amqp_sasl_config_dir = $facts['os_service_default'],
$amqp_sasl_config_name = $facts['os_service_default'],
$amqp_username = $facts['os_service_default'],
$amqp_password = $facts['os_service_default'],
Boolean $single_tenant_mode = false,
$nova_compute_url = false,
$rpc_response_timeout = $facts['os_service_default'],
$control_exchange = 'trove',
$cinder_url = false,
$swift_url = false,
$neutron_url = false,
$nova_compute_service_type = 'compute',
$cinder_service_type = 'volumev3',
$swift_service_type = 'object-store',
$neutron_service_type = 'network',
$glance_service_type = 'image',
$nova_compute_endpoint_type = $facts['os_service_default'],
$cinder_endpoint_type = $facts['os_service_default'],
$swift_endpoint_type = $facts['os_service_default'],
$glance_endpoint_type = $facts['os_service_default'],
$trove_endpoint_type = $facts['os_service_default'],
$neutron_endpoint_type = $facts['os_service_default'],
$management_networks = $facts['os_service_default'],
$package_ensure = 'present',
$default_transport_url = $facts['os_service_default'],
$notification_transport_url = $facts['os_service_default'],
$notification_driver = $facts['os_service_default'],
$notification_topics = $facts['os_service_default'],
$rabbit_use_ssl = $facts['os_service_default'],
$rabbit_ha_queues = $facts['os_service_default'],
$rabbit_notification_topic = $facts['os_service_default'],
$rabbit_heartbeat_in_pthread = $facts['os_service_default'],
$kombu_ssl_ca_certs = $facts['os_service_default'],
$kombu_ssl_certfile = $facts['os_service_default'],
$kombu_ssl_keyfile = $facts['os_service_default'],
$kombu_ssl_version = $facts['os_service_default'],
$kombu_reconnect_delay = $facts['os_service_default'],
$kombu_failover_strategy = $facts['os_service_default'],
$amqp_durable_queues = $facts['os_service_default'],
$amqp_server_request_prefix = $facts['os_service_default'],
$amqp_broadcast_prefix = $facts['os_service_default'],
$amqp_group_request_prefix = $facts['os_service_default'],
$amqp_container_name = $facts['os_service_default'],
$amqp_idle_timeout = $facts['os_service_default'],
$amqp_trace = $facts['os_service_default'],
$amqp_ssl_ca_file = $facts['os_service_default'],
$amqp_ssl_cert_file = $facts['os_service_default'],
$amqp_ssl_key_file = $facts['os_service_default'],
$amqp_ssl_key_password = $facts['os_service_default'],
$amqp_sasl_mechanisms = $facts['os_service_default'],
$amqp_sasl_config_dir = $facts['os_service_default'],
$amqp_sasl_config_name = $facts['os_service_default'],
$amqp_username = $facts['os_service_default'],
$amqp_password = $facts['os_service_default'],
Boolean $single_tenant_mode = false,
$rpc_response_timeout = $facts['os_service_default'],
$control_exchange = 'trove',
$nova_compute_url = $facts['os_service_default'],
$cinder_url = $facts['os_service_default'],
$swift_url = $facts['os_service_default'],
$neutron_url = $facts['os_service_default'],
$nova_compute_service_type = 'compute',
$cinder_service_type = 'volumev3',
$swift_service_type = 'object-store',
$neutron_service_type = 'network',
$glance_service_type = 'image',
$nova_compute_endpoint_type = $facts['os_service_default'],
$cinder_endpoint_type = $facts['os_service_default'],
$swift_endpoint_type = $facts['os_service_default'],
$glance_endpoint_type = $facts['os_service_default'],
$trove_endpoint_type = $facts['os_service_default'],
$neutron_endpoint_type = $facts['os_service_default'],
$management_networks = $facts['os_service_default'],
$package_ensure = 'present',
) {
include trove::deps
include trove::policy
include trove::params
if $nova_compute_url {
trove_config { 'DEFAULT/nova_compute_url': value => $nova_compute_url }
}
else {
trove_config { 'DEFAULT/nova_compute_url': ensure => absent }
}
if $cinder_url {
trove_config { 'DEFAULT/cinder_url': value => $cinder_url }
}
else {
trove_config { 'DEFAULT/cinder_url': ensure => absent }
}
if $swift_url {
trove_config { 'DEFAULT/swift_url': value => $swift_url }
}
else {
trove_config { 'DEFAULT/swift_url': ensure => absent }
}
if $neutron_url {
trove_config { 'DEFAULT/neutron_url': value => $neutron_url }
}
else {
trove_config { 'DEFAULT/neutron_url': ensure => absent }
}
package { 'trove':
ensure => $package_ensure,
name => $::trove::params::common_package_name,
tag => ['openstack', 'trove-package'],
}
# endpoint url
trove_config {
'DEFAULT/nova_compute_url': value => $nova_compute_url;
'DEFAULT/cinder_url': value => $cinder_url;
'DEFAULT/swift_url': value => $swift_url;
'DEFAULT/neutron_url': value => $neutron_url;
}
# services type
trove_config {
'DEFAULT/nova_compute_service_type': value => $nova_compute_service_type;

View File

@ -0,0 +1,11 @@
---
upgrade:
- |
The following parameters of the ``trove`` class no longer treat `fase`
as a special value to purge the option. Use the `os_service_default` fact
which is not default.
- `nova_compute_url`
- `cinder_url`
- `neutron_url`
- `swift_url`

View File

@ -22,24 +22,15 @@ require 'spec_helper'
describe 'trove' do
let :params do
{
:nova_compute_url => 'http://localhost:8774/v2',
:cinder_url => 'http://localhost:8776/v1',
:swift_url => 'http://localhost:8080/v1/AUTH_',
:neutron_url => 'http://localhost:9696/',
}
end
shared_examples_for 'trove' do
context 'with default parameters' do
it {
it 'configures the default values' do
is_expected.to contain_class('trove::params')
is_expected.to contain_trove_config('DEFAULT/nova_compute_url').with_value('http://localhost:8774/v2')
is_expected.to contain_trove_config('DEFAULT/cinder_url').with_value('http://localhost:8776/v1')
is_expected.to contain_trove_config('DEFAULT/swift_url').with_value('http://localhost:8080/v1/AUTH_')
is_expected.to contain_trove_config('DEFAULT/neutron_url').with_value('http://localhost:9696/')
is_expected.to contain_trove_config('DEFAULT/nova_compute_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_config('DEFAULT/cinder_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_config('DEFAULT/swift_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_config('DEFAULT/neutron_url').with_value('<SERVICE DEFAULT>')
is_expected.to contain_trove_config('DEFAULT/nova_compute_service_type').with_value('compute')
is_expected.to contain_trove_config('DEFAULT/cinder_service_type').with_value('volumev3')
is_expected.to contain_trove_config('DEFAULT/swift_service_type').with_value('object-store')
@ -92,7 +83,7 @@ describe 'trove' do
:driver => '<SERVICE DEFAULT>',
:topics => '<SERVICE DEFAULT>'
)
}
end
it 'installs common package' do
is_expected.to contain_package('trove').with(
@ -108,6 +99,24 @@ describe 'trove' do
end
end
context 'with parameters' do
let :params do
{
:nova_compute_url => 'http://localhost:8774/v2',
:cinder_url => 'http://localhost:8776/v1',
:swift_url => 'http://localhost:8080/v1/AUTH_',
:neutron_url => 'http://localhost:9696/',
}
end
it 'configures the given values' do
is_expected.to contain_trove_config('DEFAULT/nova_compute_url').with_value('http://localhost:8774/v2')
is_expected.to contain_trove_config('DEFAULT/cinder_url').with_value('http://localhost:8776/v1')
is_expected.to contain_trove_config('DEFAULT/swift_url').with_value('http://localhost:8080/v1/AUTH_')
is_expected.to contain_trove_config('DEFAULT/neutron_url').with_value('http://localhost:9696/')
end
end
context 'with single tenant mode enabled' do
let :params do
{ :single_tenant_mode => true }