Move default value to '<SERVICE DEFAULT>'

Few weeks ago, a patchset[1] that aims to treat the value '<SERVICE
DEFAULT>' of a parameter as if ensure => absent has been merged.

The final objective of this patch was to make our manifests lighter to
read and write by avoiding the pattern

if $var { value => $var } else { ensure => absent }

This commit brings this feature to the puppet-cinder module and remains
backward compatible with what was in place before.

This commit switches a part of the module, another commit will switch the
other part (init.pp/paste).

The split in reviews aims to offer :

  * easier readability on this one
  * the other review might needs other change as well - not a drop in
    replacement, contrary to this one so it is simpler to split it.

[1]
b554d30aaf
Change-Id: I005096625a9ea7d069893e4a3d64aa31e074378e
This commit is contained in:
Yanis Guenane 2015-09-07 15:15:49 +02:00
parent c5d73e1bc7
commit 3259caa0ef
15 changed files with 105 additions and 356 deletions

View File

@ -38,7 +38,7 @@
# (optional) Some operations require cinder to make API requests
# to Nova. This sets the keystone region to be used for these
# requests. For example, boot-from-volume.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'.
#
# [*nova_catalog_info*]
# (optional) Match this value when searching for nova in the service
@ -106,7 +106,7 @@
# This should contain the name of the default volume type to use.
# If not configured, it produces an error when creating a volume
# without specifying a type.
# Defaults to 'false'.
# Defaults to '<SERVICE DEFAULT>'.
#
# [*validate*]
# (optional) Whether to validate the service is working after any service refreshes
@ -139,16 +139,16 @@ class cinder::api (
$keystone_user = 'cinder',
$auth_uri = false,
$identity_uri = false,
$os_region_name = undef,
$nova_catalog_info = 'compute:Compute Service:publicURL',
$nova_catalog_admin_info = 'compute:Compute Service:adminURL',
$os_region_name = '<SERVICE DEFAULT>',
$service_workers = $::processorcount,
$package_ensure = 'present',
$bind_host = '0.0.0.0',
$enabled = true,
$manage_service = true,
$ratelimits = undef,
$default_volume_type = false,
$default_volume_type = '<SERVICE DEFAULT>',
$ratelimits_factory =
'cinder.api.v1.limits:RateLimitingMiddleware.factory',
$validate = false,
@ -207,12 +207,8 @@ class cinder::api (
cinder_config {
'DEFAULT/osapi_volume_listen': value => $bind_host;
'DEFAULT/osapi_volume_workers': value => $service_workers;
}
if $os_region_name {
cinder_config {
'DEFAULT/os_region_name': value => $os_region_name;
}
'DEFAULT/os_region_name': value => $os_region_name;
'DEFAULT/default_volume_type': value => $default_volume_type;
}
cinder_config {
@ -342,16 +338,6 @@ class cinder::api (
}
}
if $default_volume_type {
cinder_config {
'DEFAULT/default_volume_type': value => $default_volume_type;
}
} else {
cinder_config {
'DEFAULT/default_volume_type': ensure => absent;
}
}
if $validate {
$defaults = {
'cinder-api' => {

View File

@ -112,7 +112,7 @@
# [*nfs_mount_options*]
# (optional) Mount options passed to the nfs client. See section
# of the nfs man page for details.
# Defaults to undef
# Defaults to '<SERVICE DEFAULT>'
#
# [*netapp_copyoffload_tool_path*]
# (optional) This option specifies the path of the NetApp Copy Offload tool
@ -197,7 +197,7 @@ define cinder::backend::netapp (
$thres_avl_size_perc_stop = '60',
$nfs_shares = undef,
$nfs_shares_config = '/etc/cinder/shares.conf',
$nfs_mount_options = undef,
$nfs_mount_options = '<SERVICE DEFAULT>',
$netapp_copyoffload_tool_path = undef,
$netapp_controller_ips = undef,
$netapp_sa_password = undef,
@ -216,17 +216,8 @@ define cinder::backend::netapp (
}
}
if $nfs_mount_options {
cinder_config {
"${name}/nfs_mount_options": value => $nfs_mount_options;
}
} else {
cinder_config {
"${name}/nfs_mount_options": ensure => absent;
}
}
cinder_config {
"${name}/nfs_mount_options": value => $nfs_mount_options;
"${name}/volume_backend_name": value => $volume_backend_name;
"${name}/volume_driver": value => 'cinder.volume.drivers.netapp.common.NetAppDriver';
"${name}/netapp_login": value => $netapp_login;

View File

@ -25,12 +25,12 @@
#
# [*rbd_secret_uuid*]
# (optional) A required parameter to use cephx.
# Defaults to false
# Defaults to '<SERVICE DEFAULT>'
#
# [*volume_tmp_dir*]
# (optional) Location to store temporary image files if the volume
# driver does not write them directly to the volume
# Defaults to false
# Defaults to '<SERVICE DEFAULT>'
#
# [*rbd_max_clone_depth*]
# (optional) Maximum number of nested clones that can be taken of a
@ -50,8 +50,8 @@ define cinder::backend::rbd (
$volume_backend_name = $name,
$rbd_ceph_conf = '/etc/ceph/ceph.conf',
$rbd_flatten_volume_from_snapshot = false,
$rbd_secret_uuid = false,
$volume_tmp_dir = false,
$rbd_secret_uuid = '<SERVICE DEFAULT>',
$volume_tmp_dir = '<SERVICE DEFAULT>',
$rbd_max_clone_depth = '5',
$extra_options = {},
) {
@ -67,18 +67,8 @@ define cinder::backend::rbd (
"${name}/rbd_max_clone_depth": value => $rbd_max_clone_depth;
"${name}/rbd_flatten_volume_from_snapshot": value => $rbd_flatten_volume_from_snapshot;
"${name}/host": value => "rbd:${rbd_pool}";
}
if $rbd_secret_uuid {
cinder_config {"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;}
} else {
cinder_config {"${name}/rbd_secret_uuid": ensure => absent;}
}
if $volume_tmp_dir {
cinder_config {"${name}/volume_tmp_dir": value => $volume_tmp_dir;}
} else {
cinder_config {"${name}/volume_tmp_dir": ensure => absent;}
"${name}/rbd_secret_uuid": value => $rbd_secret_uuid;
"${name}/volume_tmp_dir": value => $volume_tmp_dir;
}
create_resources('cinder_config', $extra_options)

View File

@ -37,7 +37,7 @@
#
# [*backup_mount_options*]
# (optional) The mount options that are passed to the NFS client.
# Defaults to undef
# Defaults to '<SERVICE DEFAULT>'
#
# [*backup_container*]
# (optional) Custom container to use for backups.
@ -75,24 +75,15 @@ class cinder::backup::nfs (
$backup_sha_block_size_bytes = 32768,
$backup_enable_progress_timer = true,
$backup_mount_point_base = '$state_path/backup_mount',
$backup_mount_options = undef,
$backup_mount_options = '<SERVICE DEFAULT>',
$backup_container = undef,
$backup_compression_algorithm = 'zlib',
) {
validate_string($backup_share)
if $backup_mount_options {
cinder_config {
'DEFAULT/backup_mount_options': value => $backup_mount_options;
}
} else {
cinder_config {
'DEFAULT/backup_mount_options': ensure => absent;
}
}
cinder_config {
'DEFAULT/backup_mount_options': value => $backup_mount_options;
'DEFAULT/backup_share': value => $backup_share;
'DEFAULT/backup_driver': value => $backup_driver;
'DEFAULT/backup_file_size': value => $backup_file_size;

View File

@ -35,7 +35,7 @@
#
# [*database_max_pool_size*]
# Maximum number of SQL connections to keep open in a pool.
# (Optional) Defaults to undef.
# (Optional) Defaults to '<SERVICE DEFAULT>'
#
# [*database_max_retries*]
# Maximum db connection retries during startup.
@ -48,7 +48,7 @@
#
# [*database_max_overflow*]
# If set, use this value for max_overflow with sqlalchemy.
# (Optional) Defaults to undef.
# (Optional) Defaults to "<SERVICE DEFAULT>'
#
# [*rpc_backend*]
# (Optional) Use these options to configure the RabbitMQ message system.
@ -105,21 +105,21 @@
#
# [*kombu_ssl_ca_certs*]
# (optional) SSL certification authority file (valid only if SSL enabled).
# Defaults to undef
# Defaults to '<SERVICE DEFAULT>'
#
# [*kombu_ssl_certfile*]
# (optional) SSL cert file (valid only if SSL enabled).
# Defaults to undef
# Defaults to '<SERVICE DEFAULT>'
#
# [*kombu_ssl_keyfile*]
# (optional) SSL key file (valid only if SSL enabled).
# Defaults to undef
# Defaults to '<SERVICE DEFAULT>'
#
# [*kombu_ssl_version*]
# (optional) SSL version to use (valid only if SSL enabled).
# Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be
# available on some distributions.
# Defaults to 'TLSv1'
# Defaults to '<SERVICE DEFAULT>'
#
# [*amqp_durable_queues*]
# Use durable queues in amqp.
@ -184,7 +184,7 @@
# [*log_dir*]
# (optional) Directory where logs should be stored.
# If set to boolean false, it will not log to any directory.
# Defaults to '/var/log/cinder'
# Defaults to '<SERVICE DEFAULT>'
#
# [*use_ssl*]
# (optional) Enable SSL on the API server
@ -200,7 +200,7 @@
#
# [*ca_file*]
# (optional) CA certificate file to use to verify connecting clients
# Defaults to false, not set_
# Defaults to '<SERVICE DEFAULT>'
#
# [*storage_availability_zone*]
# (optional) Availability zone of the node.
@ -239,10 +239,10 @@ class cinder (
$database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite',
$database_idle_timeout = '3600',
$database_min_pool_size = '1',
$database_max_pool_size = undef,
$database_max_pool_size = '<SERVICE DEFAULT>',
$database_max_retries = '10',
$database_retry_interval = '10',
$database_max_overflow = undef,
$database_max_overflow = '<SERVICE DEFAULT>',
$rpc_backend = 'cinder.openstack.common.rpc.impl_kombu',
$control_exchange = 'openstack',
$rabbit_host = '127.0.0.1',
@ -254,10 +254,10 @@ class cinder (
$rabbit_userid = 'guest',
$rabbit_password = false,
$rabbit_use_ssl = false,
$kombu_ssl_ca_certs = undef,
$kombu_ssl_certfile = undef,
$kombu_ssl_keyfile = undef,
$kombu_ssl_version = 'TLSv1',
$kombu_ssl_ca_certs = '<SERVICE DEFAULT>',
$kombu_ssl_certfile = '<SERVICE DEFAULT>',
$kombu_ssl_keyfile = '<SERVICE DEFAULT>',
$kombu_ssl_version = '<SERVICE DEFAULT>',
$amqp_durable_queues = false,
$qpid_hostname = 'localhost',
$qpid_port = '5672',
@ -275,14 +275,14 @@ class cinder (
$qpid_tcp_nodelay = true,
$package_ensure = 'present',
$use_ssl = false,
$ca_file = false,
$ca_file = '<SERVICE DEFAULT>',
$cert_file = false,
$key_file = false,
$api_paste_config = '/etc/cinder/api-paste.ini',
$use_syslog = false,
$use_stderr = true,
$log_facility = 'LOG_USER',
$log_dir = '/var/log/cinder',
$log_dir = '<SERVICE DEFAULT>',
$verbose = false,
$debug = false,
$storage_availability_zone = 'nova',
@ -331,6 +331,10 @@ class cinder (
'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid;
'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host;
'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl;
'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version;
'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs;
'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile;
'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile;
'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold;
'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate;
'DEFAULT/control_exchange': value => $control_exchange;
@ -349,35 +353,6 @@ class cinder (
cinder_config { 'oslo_messaging_rabbit/rabbit_ha_queues': value => false }
}
if $rabbit_use_ssl {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version }
if $kombu_ssl_ca_certs {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs }
} else {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent}
}
if $kombu_ssl_certfile {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile }
} else {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent}
}
if $kombu_ssl_keyfile {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile }
} else {
cinder_config { 'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent}
}
} else {
cinder_config {
'oslo_messaging_rabbit/kombu_ssl_ca_certs': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_certfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_keyfile': ensure => absent;
'oslo_messaging_rabbit/kombu_ssl_version': ensure => absent;
}
}
}
if $rpc_backend == 'cinder.openstack.common.rpc.impl_qpid' {
@ -430,6 +405,9 @@ class cinder (
'database/min_pool_size': value => $database_min_pool_size;
'database/max_retries': value => $database_max_retries;
'database/retry_interval': value => $database_retry_interval;
'database/max_pool_size': value => $database_max_pool_size;
'database/max_overflow': value => $database_max_overflow;
'DEFAULT/log_dir': value => $log_dir;
'DEFAULT/verbose': value => $verbose;
'DEFAULT/debug': value => $debug;
'DEFAULT/use_stderr': value => $use_stderr;
@ -439,26 +417,6 @@ class cinder (
'DEFAULT/default_availability_zone': value => $default_availability_zone_real;
}
if $database_max_pool_size {
cinder_config {
'database/max_pool_size': value => $database_max_pool_size;
}
} else {
cinder_config {
'database/max_pool_size': ensure => absent;
}
}
if $database_max_overflow {
cinder_config {
'database/max_overflow': value => $database_max_overflow;
}
} else {
cinder_config {
'database/max_overflow': ensure => absent;
}
}
if($database_connection =~ /mysql:\/\/\S+:\S+@\S+\/\S+/) {
require 'mysql::bindings'
require 'mysql::bindings::python'
@ -470,30 +428,12 @@ class cinder (
fail("Invalid db connection ${database_connection}")
}
if $log_dir {
cinder_config {
'DEFAULT/log_dir': value => $log_dir;
}
} else {
cinder_config {
'DEFAULT/log_dir': ensure => absent;
}
}
# SSL Options
if $use_ssl {
cinder_config {
'DEFAULT/ssl_cert_file' : value => $cert_file;
'DEFAULT/ssl_key_file' : value => $key_file;
}
if $ca_file {
cinder_config { 'DEFAULT/ssl_ca_file' :
value => $ca_file,
}
} else {
cinder_config { 'DEFAULT/ssl_ca_file' :
ensure => absent,
}
'DEFAULT/ssl_ca_file' : value => $ca_file;
}
} else {
cinder_config {

View File

@ -6,29 +6,29 @@
#
# [*logging_context_format_string*]
# (Optional) Format string to use for log messages with context.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
#
# [*logging_default_format_string*]
# (Optional) Format string to use for log messages without context.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
# [-] %(instance)s%(message)s'
#
# [*logging_debug_format_suffix*]
# (Optional) Formatted data to append to log format when level is DEBUG.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: '%(funcName)s %(pathname)s:%(lineno)d'
#
# [*logging_exception_prefix*]
# (Optional) Prefix each line of exception output with this format.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
#
# [*log_config_append*]
# The name of an additional logging configuration file.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# See https://docs.python.org/2/howto/logging.html
#
# [*default_log_levels*]
@ -42,167 +42,65 @@
#
# [*publish_errors*]
# (optional) Publish error events (boolean value).
# Defaults to undef (false if unconfigured).
# Defaults to '<SERVICE DEFAULT>'
#
# [*fatal_deprecations*]
# (optional) Make deprecations fatal (boolean value)
# Defaults to undef (false if unconfigured).
# Defaults to '<SERVICE DEFAULT>'
#
# [*instance_format*]
# (optional) If an instance is passed with the log message, format it
# like this (string value).
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: '[instance: %(uuid)s] '
#
# [*instance_uuid_format*]
# (optional) If an instance UUID is passed with the log message, format
# it like this (string value).
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: instance_uuid_format='[instance: %(uuid)s] '
#
# [*log_date_format*]
# (optional) Format string for %%(asctime)s in log records.
# Defaults to undef.
# Defaults to '<SERVICE DEFAULT>'
# Example: 'Y-%m-%d %H:%M:%S'
#
class cinder::logging(
$logging_context_format_string = undef,
$logging_default_format_string = undef,
$logging_debug_format_suffix = undef,
$logging_exception_prefix = undef,
$log_config_append = undef,
$logging_context_format_string = '<SERVICE DEFAULT>',
$logging_default_format_string = '<SERVICE DEFAULT>',
$logging_debug_format_suffix = '<SERVICE DEFAULT>',
$logging_exception_prefix = '<SERVICE DEFAULT>',
$log_config_append = '<SERVICE DEFAULT>',
$default_log_levels = undef,
$publish_errors = undef,
$fatal_deprecations = undef,
$instance_format = undef,
$instance_uuid_format = undef,
$log_date_format = undef,
$publish_errors = '<SERVICE DEFAULT>',
$fatal_deprecations = '<SERVICE DEFAULT>',
$instance_format = '<SERVICE DEFAULT>',
$instance_uuid_format = '<SERVICE DEFAULT>',
$log_date_format = '<SERVICE DEFAULT>',
) {
if $logging_context_format_string {
cinder_config {
'DEFAULT/logging_context_format_string' :
value => $logging_context_format_string;
}
}
else {
cinder_config {
'DEFAULT/logging_context_format_string' : ensure => absent;
}
}
if $logging_default_format_string {
cinder_config {
'DEFAULT/logging_default_format_string' :
value => $logging_default_format_string;
}
}
else {
cinder_config {
'DEFAULT/logging_default_format_string' : ensure => absent;
}
}
if $logging_debug_format_suffix {
cinder_config {
'DEFAULT/logging_debug_format_suffix' :
value => $logging_debug_format_suffix;
}
}
else {
cinder_config {
'DEFAULT/logging_debug_format_suffix' : ensure => absent;
}
}
if $logging_exception_prefix {
cinder_config {
'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix;
}
}
else {
cinder_config {
'DEFAULT/logging_exception_prefix' : ensure => absent;
}
}
if $log_config_append {
cinder_config {
'DEFAULT/log_config_append' : value => $log_config_append;
}
}
else {
cinder_config {
'DEFAULT/log_config_append' : ensure => absent;
}
}
cinder_config {
'DEFAULT/logging_context_format_string' : value => $logging_context_format_string;
'DEFAULT/logging_default_format_string' : value => $logging_default_format_string;
'DEFAULT/logging_debug_format_suffix' : value => $logging_debug_format_suffix;
'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix;
'DEFAULT/log_config_append' : value => $log_config_append;
'DEFAULT/publish_errors' : value => $publish_errors;
'DEFAULT/fatal_deprecations' : value => $fatal_deprecations;
'DEFAULT/instance_format' : value => $instance_format;
'DEFAULT/instance_uuid_format' : value => $instance_uuid_format;
'DEFAULT/log_date_format' : value => $log_date_format;
}
if $default_log_levels {
cinder_config {
'DEFAULT/default_log_levels' :
value => join(sort(join_keys_to_values($default_log_levels, '=')), ',');
}
}
else {
} else {
cinder_config {
'DEFAULT/default_log_levels' : ensure => absent;
}
}
if $publish_errors {
cinder_config {
'DEFAULT/publish_errors' : value => $publish_errors;
}
}
else {
cinder_config {
'DEFAULT/publish_errors' : ensure => absent;
}
}
if $fatal_deprecations {
cinder_config {
'DEFAULT/fatal_deprecations' : value => $fatal_deprecations;
}
}
else {
cinder_config {
'DEFAULT/fatal_deprecations' : ensure => absent;
}
}
if $instance_format {
cinder_config {
'DEFAULT/instance_format' : value => $instance_format;
}
}
else {
cinder_config {
'DEFAULT/instance_format' : ensure => absent;
}
}
if $instance_uuid_format {
cinder_config {
'DEFAULT/instance_uuid_format' : value => $instance_uuid_format;
}
}
else {
cinder_config {
'DEFAULT/instance_uuid_format' : ensure => absent;
}
}
if $log_date_format {
cinder_config {
'DEFAULT/log_date_format' : value => $log_date_format;
}
}
else {
cinder_config {
'DEFAULT/log_date_format' : ensure => absent;
}
}
}
}

View File

@ -6,7 +6,7 @@
#
# [*scheduler_driver*]
# (Optional) Default scheduler driver to use
# Defaults to 'false'.
# Defaults to '<SERVICE DEFAULT>'.
#
# [*package_ensure*]
# (Optioanl) The state of the package.
@ -22,7 +22,7 @@
#
#
class cinder::scheduler (
$scheduler_driver = false,
$scheduler_driver = '<SERVICE DEFAULT>',
$package_ensure = 'present',
$enabled = true,
$manage_service = true
@ -34,15 +34,7 @@ class cinder::scheduler (
Cinder_api_paste_ini<||> ~> Service['cinder-scheduler']
Exec<| title == 'cinder-manage db_sync' |> ~> Service['cinder-scheduler']
if $scheduler_driver {
cinder_config {
'DEFAULT/scheduler_driver': value => $scheduler_driver;
}
} else {
cinder_config {
'DEFAULT/scheduler_driver': ensure => absent;
}
}
cinder_config { 'DEFAULT/scheduler_driver': value => $scheduler_driver; }
if $::cinder::params::scheduler_package {
Package['cinder-scheduler'] -> Service['cinder-scheduler']

View File

@ -38,7 +38,10 @@ describe 'cinder::api' do
:value => 'compute:Compute Service:adminURL'
)
is_expected.to contain_cinder_config('DEFAULT/default_volume_type').with(
:ensure => 'absent'
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_cinder_config('DEFAULT/os_region_name').with(
:value => '<SERVICE DEFAULT>'
)
is_expected.to contain_cinder_api_paste_ini('filter:authtoken/service_protocol').with(
:value => 'http'
@ -75,7 +78,6 @@ describe 'cinder::api' do
:value => 'http://localhost:5000/'
)
is_expected.to_not contain_cinder_config('DEFAULT/os_region_name')
end
end

View File

@ -34,10 +34,6 @@ describe 'cinder::logging' do
it_configures 'logging params set'
end
context 'without extended logging options' do
it_configures 'logging params unset'
end
end
shared_examples_for 'logging params set' do
@ -76,18 +72,6 @@ describe 'cinder::logging' do
end
end
shared_examples_for 'logging params unset' do
[ :logging_context_format_string, :logging_default_format_string,
:logging_debug_format_suffix, :logging_exception_prefix,
:log_config_append, :publish_errors,
:default_log_levels, :fatal_deprecations,
:instance_format, :instance_uuid_format,
:log_date_format, ].each { |param|
it { is_expected.to contain_cinder_config("DEFAULT/#{param}").with_ensure('absent') }
}
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }

View File

@ -11,7 +11,7 @@ describe 'cinder::scheduler' do
describe 'with default parameters' do
it { is_expected.to contain_class('cinder::params') }
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_ensure('absent') }
it { is_expected.to contain_cinder_config('DEFAULT/scheduler_driver').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_package('cinder-scheduler').with(
:name => 'cinder-scheduler',

View File

@ -35,17 +35,17 @@ describe 'cinder' do
is_expected.to contain_cinder_config('database/connection').with(:value => 'mysql://user:password@host/database', :secret => true)
is_expected.to contain_cinder_config('database/idle_timeout').with(:value => '3600')
is_expected.to contain_cinder_config('database/min_pool_size').with(:value => '1')
is_expected.to contain_cinder_config('database/max_pool_size').with_ensure('absent')
is_expected.to contain_cinder_config('database/max_pool_size').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('database/max_retries').with(:value => '10')
is_expected.to contain_cinder_config('database/retry_interval').with(:value => '10')
is_expected.to contain_cinder_config('database/max_overflow').with_ensure('absent')
is_expected.to contain_cinder_config('database/max_overflow').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/verbose').with(:value => false)
is_expected.to contain_cinder_config('DEFAULT/debug').with(:value => false)
is_expected.to contain_cinder_config('DEFAULT/use_stderr').with(:value => true)
is_expected.to contain_cinder_config('DEFAULT/storage_availability_zone').with(:value => 'nova')
is_expected.to contain_cinder_config('DEFAULT/default_availability_zone').with(:value => 'nova')
is_expected.to contain_cinder_config('DEFAULT/api_paste_config').with(:value => '/etc/cinder/api-paste.ini')
is_expected.to contain_cinder_config('DEFAULT/log_dir').with(:value => '/var/log/cinder')
is_expected.to contain_cinder_config('DEFAULT/log_dir').with(:value => '<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('DEFAULT/lock_path').with(:value => '/var/lock/cinder')
end
@ -181,10 +181,10 @@ describe 'cinder' do
it do
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('true')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('TLSv1')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end
end
@ -192,19 +192,19 @@ describe 'cinder' do
let :params do
req_params.merge!({
:rabbit_use_ssl => false,
:kombu_ssl_ca_certs => 'undef',
:kombu_ssl_certfile => 'undef',
:kombu_ssl_keyfile => 'undef',
:kombu_ssl_version => 'TLSv1'
:kombu_ssl_ca_certs => '<SERVICE DEFAULT>',
:kombu_ssl_certfile => '<SERVICE DEFAULT>',
:kombu_ssl_keyfile => '<SERVICE DEFAULT>',
:kombu_ssl_version => '<SERVICE DEFAULT>'
})
end
it do
is_expected.to contain_cinder_config('oslo_messaging_rabbit/rabbit_use_ssl').with_value('false')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_ensure('absent')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_ca_certs').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_certfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_keyfile').with_value('<SERVICE DEFAULT>')
is_expected.to contain_cinder_config('oslo_messaging_rabbit/kombu_ssl_version').with_value('<SERVICE DEFAULT>')
end
end
@ -239,11 +239,6 @@ describe 'cinder' do
it { is_expected.to contain_cinder_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
end
describe 'with log_dir disabled' do
let(:params) { req_params.merge!({:log_dir => false}) }
it { is_expected.to contain_cinder_config('DEFAULT/log_dir').with_ensure('absent') }
end
describe 'with different lock_path' do
let(:params) { req_params.merge!({:lock_path => '/var/run/cinder.locks'}) }
it { is_expected.to contain_cinder_config('DEFAULT/lock_path').with_value('/var/run/cinder.locks') }

View File

@ -30,7 +30,7 @@ describe 'cinder::volume::netapp' do
:thres_avl_size_perc_stop => '60',
:nfs_shares_config => '/etc/cinder/shares.conf',
:netapp_eseries_host_type => 'linux_dm_mp',
:nfs_mount_options => nil,
:nfs_mount_options => '<SERVICE DEFAULT>',
:netapp_webservice_path => '/devmgr/v2',
}
end

View File

@ -5,10 +5,10 @@ describe 'cinder::volume::rbd' do
{
:rbd_pool => 'volumes',
:rbd_user => 'test',
:rbd_secret_uuid => '0123456789',
:rbd_secret_uuid => '<SERVICE DEFAULT>',
:rbd_ceph_conf => '/foo/boo/zoo/ceph.conf',
:rbd_flatten_volume_from_snapshot => true,
:volume_tmp_dir => '/foo/tmp',
:volume_tmp_dir => '<SERVICE DEFAULT>',
:rbd_max_clone_depth => '0',
}
end
@ -42,16 +42,6 @@ describe 'cinder::volume::rbd' do
:notify => 'Service[cinder-volume]')
end
context 'with rbd_secret_uuid disabled' do
let(:params) { req_params.merge!({:rbd_secret_uuid => false}) }
it { is_expected.to contain_cinder_config('DEFAULT/rbd_secret_uuid').with_ensure('absent') }
end
context 'with volume_tmp_dir disabled' do
let(:params) { req_params.merge!({:volume_tmp_dir => false}) }
it { is_expected.to contain_cinder_config('DEFAULT/volume_tmp_dir').with_ensure('absent') }
end
end
describe 'rbd volume driver with additional configuration' do

View File

@ -33,7 +33,7 @@ describe 'cinder::backend::netapp' do
:thres_avl_size_perc_stop => '60',
:nfs_shares_config => '/etc/cinder/shares.conf',
:netapp_eseries_host_type => 'linux_dm_mp',
:nfs_mount_options => nil,
:nfs_mount_options => '<SERVICE DEFAULT>',
:netapp_webservice_path => '/devmgr/v2',
}
end

View File

@ -9,10 +9,10 @@ describe 'cinder::backend::rbd' do
:volume_backend_name => 'rbd-ssd',
:rbd_pool => 'volumes',
:rbd_user => 'test',
:rbd_secret_uuid => '0123456789',
:rbd_secret_uuid => '<SERVICE DEFAULT>',
:rbd_ceph_conf => '/foo/boo/zoo/ceph.conf',
:rbd_flatten_volume_from_snapshot => true,
:volume_tmp_dir => '/foo/tmp',
:volume_tmp_dir => '<SERVICE DEFAULT>',
:rbd_max_clone_depth => '0'
}
end
@ -45,16 +45,6 @@ describe 'cinder::backend::rbd' do
:notify => 'Service[cinder-volume]')
end
context 'with rbd_secret_uuid disabled' do
let(:params) { req_params.merge!({:rbd_secret_uuid => false}) }
it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/rbd_secret_uuid").with_ensure('absent') }
end
context 'with volume_tmp_dir disabled' do
let(:params) { req_params.merge!({:volume_tmp_dir => false}) }
it { is_expected.to contain_cinder_config("#{req_params[:volume_backend_name]}/volume_tmp_dir").with_ensure('absent') }
end
context 'with another RBD backend' do
let :pre_condition do
"cinder::backend::rbd { 'ceph2':