From ab50eeef0cb33743a14558f56031aafb9842726a Mon Sep 17 00:00:00 2001 From: Denis Egorenko Date: Fri, 13 Nov 2015 20:13:08 +0300 Subject: [PATCH] Use $::os_service_default where is possible This is a second part of switching to $::os_service_default fact. Switch to $::os_service_default all params, which are possible to use with $::os_service_default fact. Related-bug: #1515273 Change-Id: I54609f09998f29e8dffc12ca4591044dbf67b09b --- manifests/db.pp | 26 +++--- manifests/init.pp | 94 +++++++++++---------- manifests/logging.pp | 16 ++-- manifests/notify.pp | 14 +-- manifests/notify/qpid.pp | 46 +++++----- manifests/notify/rabbitmq.pp | 64 +++++++------- manifests/notify/zeromq.pp | 26 +++--- manifests/service/api.pp | 4 +- spec/classes/sahara_api_spec.rb | 2 +- spec/classes/sahara_db_spec.rb | 20 ++--- spec/classes/sahara_init_spec.rb | 51 ++++++----- spec/classes/sahara_logging_spec.rb | 8 +- spec/classes/sahara_notify_qpid_spec.rb | 14 +-- spec/classes/sahara_notify_rabbitmq_spec.rb | 25 +++--- spec/classes/sahara_notify_spec.rb | 10 +-- 15 files changed, 214 insertions(+), 206 deletions(-) diff --git a/manifests/db.pp b/manifests/db.pp index 32925b8e..5a5ee95d 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -6,41 +6,41 @@ # # [*database_connection*] # (Optional) The connection string to use to connect to the database. -# Defaults to 'mysql://sahara:secrete@localhost:3306/sahara' +# Defaults to mysql://sahara:secrete@localhost:3306/sahara. # # [*database_max_retries*] # (Optional) Maximum number of database connection retries during startup. # Set to -1 to specify an infinite retry count. -# Defaults to 10. +# Defaults to $::os_service_default. # # [*database_idle_timeout*] # (Optional) Timeout before idle SQL connections are reaped. -# Defaults to 3600. +# Defaults to $::os_service_default. # # [*database_retry_interval*] # (optional) Interval between retries of opening a database connection. -# Defaults to 10. +# Defaults to $::os_service_default. # # [*database_min_pool_size*] # (optional) Minimum number of SQL connections to keep open in a pool. -# Defaults to 1. +# Defaults to $::os_service_default. # # [*database_max_pool_size*] # (optional) Maximum number of SQL connections to keep open in a pool. -# Defaults to 10. +# Defaults to $::os_service_default. # # [*database_max_overflow*] # (optional) If set, use this value for max_overflow with sqlalchemy. -# Defaults to 20. +# Defaults to $::os_service_default. # class sahara::db ( $database_connection = 'mysql://sahara:secrete@localhost:3306/sahara', - $database_idle_timeout = 3600, - $database_min_pool_size = 1, - $database_max_pool_size = 10, - $database_max_retries = 10, - $database_retry_interval = 10, - $database_max_overflow = 20, + $database_idle_timeout = $::os_service_default, + $database_min_pool_size = $::os_service_default, + $database_max_pool_size = $::os_service_default, + $database_max_retries = $::os_service_default, + $database_retry_interval = $::os_service_default, + $database_max_overflow = $::os_service_default, ) { # NOTE(degorenko): In order to keep backward compatibility we rely on the pick function diff --git a/manifests/init.pp b/manifests/init.pp index 098887cc..a69b63ac 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,11 +35,11 @@ # # [*host*] # (Optional) Hostname for sahara to listen on -# Defaults to '0.0.0.0'. +# Defaults to $::os_service_default. # # [*port*] # (Optional) Port for sahara to listen on -# Defaults to 8386. +# Defaults to $::os_service_default. # # [*plugins*] # (Optional) List of plugins to be loaded. @@ -303,12 +303,12 @@ class sahara( $use_stderr = undef, $log_facility = undef, $log_dir = undef, - $host = '0.0.0.0', - $port = '8386', + $host = $::os_service_default, + $port = $::os_service_default, $plugins = $::os_service_default, - $use_neutron = false, - $use_floating_ips = true, - $use_ssl = false, + $use_neutron = $::os_service_default, + $use_floating_ips = $::os_service_default, + $use_ssl = $::os_service_default, $ca_file = $::os_service_default, $cert_file = $::os_service_default, $key_file = $::os_service_default, @@ -327,43 +327,43 @@ class sahara( $auth_uri = 'http://127.0.0.1:5000/v2.0/', $identity_uri = 'http://127.0.0.1:35357/', $rpc_backend = $::os_service_default, - $amqp_durable_queues = false, - $rabbit_ha_queues = false, - $rabbit_host = 'localhost', - $rabbit_hosts = false, - $rabbit_port = 5672, - $rabbit_use_ssl = false, - $rabbit_userid = 'guest', - $rabbit_password = 'guest', - $rabbit_login_method = 'AMQPLAIN', - $rabbit_virtual_host = '/', - $rabbit_retry_interval = 1, - $rabbit_retry_backoff = 2, - $rabbit_max_retries = 0, - $qpid_hostname = 'localhost', - $qpid_port = 5672, - $qpid_hosts = false, + $amqp_durable_queues = $::os_service_default, + $rabbit_ha_queues = $::os_service_default, + $rabbit_host = $::os_service_default, + $rabbit_hosts = $::os_service_default, + $rabbit_port = $::os_service_default, + $rabbit_use_ssl = $::os_service_default, + $rabbit_userid = $::os_service_default, + $rabbit_password = $::os_service_default, + $rabbit_login_method = $::os_service_default, + $rabbit_virtual_host = $::os_service_default, + $rabbit_retry_interval = $::os_service_default, + $rabbit_retry_backoff = $::os_service_default, + $rabbit_max_retries = $::os_service_default, + $qpid_hostname = $::os_service_default, + $qpid_port = $::os_service_default, + $qpid_hosts = $::os_service_default, $qpid_username = 'guest', $qpid_password = 'guest', - $qpid_sasl_mechanisms = '', - $qpid_heartbeat = 60, - $qpid_protocol = 'tcp', - $qpid_tcp_nodelay = true, - $qpid_receiver_capacity = 1, - $qpid_topology_version = 2, - $zeromq_bind_address = '*', - $zeromq_port = 9501, - $zeromq_contexts = 1, - $zeromq_topic_backlog = 'None', - $zeromq_ipc_dir = '/var/run/openstack', + $qpid_sasl_mechanisms = $::os_service_default, + $qpid_heartbeat = $::os_service_default, + $qpid_protocol = $::os_service_default, + $qpid_tcp_nodelay = $::os_service_default, + $qpid_receiver_capacity = $::os_service_default, + $qpid_topology_version = $::os_service_default, + $zeromq_bind_address = $::os_service_default, + $zeromq_contexts = $::os_service_default, + $zeromq_topic_backlog = $::os_service_default, + $zeromq_ipc_dir = $::os_service_default, $zeromq_host = 'sahara', - $cast_timeout = 30, + $cast_timeout = $::os_service_default, $kombu_ssl_version = $::os_service_default, $kombu_ssl_keyfile = $::os_service_default, $kombu_ssl_certfile = $::os_service_default, $kombu_ssl_ca_certs = $::os_service_default, - $kombu_reconnect_delay = '1.0', + $kombu_reconnect_delay = $::os_service_default, # DEPRECATED PARAMETERS + $zeromq_port = undef, $manage_service = undef, $enabled = undef, ) { @@ -401,9 +401,9 @@ class sahara( } if $rpc_backend == 'rabbit' or is_service_default($rpc_backend) { - if $rabbit_hosts { + if ! is_service_default($rabbit_hosts) and $rabbit_hosts { sahara_config { - 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ','); + 'oslo_messaging_rabbit/rabbit_hosts': value => join(any2array($rabbit_hosts), ','); 'oslo_messaging_rabbit/rabbit_ha_queues': value => true; } } else { @@ -411,7 +411,7 @@ class sahara( 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues; - 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; + 'oslo_messaging_rabbit/rabbit_hosts': ensure => absent; } } sahara_config { @@ -437,15 +437,17 @@ class sahara( if $rpc_backend == 'qpid' { - if $qpid_hosts { + warning('Default values for qpid_username and qpid_password parameters are different from OpenStack project defaults') + + if ! is_service_default($qpid_hosts) and $qpid_hosts { sahara_config { - 'oslo_messaging_qpid/qpid_hosts': value => join($qpid_hosts, ','); + 'oslo_messaging_qpid/qpid_hosts': value => join(any2array($qpid_hosts), ','); } } else { sahara_config { 'oslo_messaging_qpid/qpid_hostname': value => $qpid_hostname; 'oslo_messaging_qpid/qpid_port': value => $qpid_port; - 'oslo_messaging_qpid/qpid_hosts': value => "${qpid_hostname}:${qpid_port}"; + 'oslo_messaging_qpid/qpid_hosts': ensure => absent; } } @@ -466,10 +468,14 @@ class sahara( } if $rpc_backend == 'zmq' { + + if $zeromq_port { + warning('The zeromq_port parameter is deprecated and has no effect.') + } + sahara_config { 'DEFAULT/rpc_backend': value => 'zmq'; 'DEFAULT/rpc_zmq_bind_address': value => $zeromq_bind_address; - 'DEFAULT/rpc_zmq_port': value => $zeromq_port; 'DEFAULT/rpc_zmq_contexts': value => $zeromq_contexts; 'DEFAULT/rpc_zmq_topic_backlog': value => $zeromq_topic_backlog; 'DEFAULT/rpc_zmq_ipc_dir': value => $zeromq_ipc_dir; @@ -478,7 +484,7 @@ class sahara( } } - if $use_ssl { + if ! is_service_default($use_ssl) and $use_ssl { if is_service_default($ca_file) { fail('The ca_file parameter is required when use_ssl is set to true') } diff --git a/manifests/logging.pp b/manifests/logging.pp index de6fc03d..eacad183 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -6,19 +6,19 @@ # # [*verbose*] # (Optional) Should the daemons log verbose messages -# Defaults to 'false'. +# Defaults to $::os_service_default. # # [*debug*] # (Optional) Should the daemons log debug messages -# Defaults to 'false'. +# Defaults to $::os_service_default. # # [*use_syslog*] # Use syslog for logging. -# (Optional) Defaults to 'false'. +# (Optional) Defaults to $::os_service_default. # # [*use_stderr*] # (optional) Use stderr for logging -# Defaults to 'true' +# Defaults to $::os_service_default. # # [*log_facility*] # Syslog facility to receive log lines. @@ -91,10 +91,10 @@ # Example: 'Y-%m-%d %H:%M:%S' # class sahara::logging( - $verbose = false, - $debug = false, - $use_syslog = false, - $use_stderr = true, + $verbose = $::os_service_default, + $debug = $::os_service_default, + $use_syslog = $::os_service_default, + $use_stderr = $::os_service_default, $log_facility = $::os_service_default, $log_dir = '/var/log/sahara', $logging_context_format_string = $::os_service_default, diff --git a/manifests/notify.pp b/manifests/notify.pp index c90d9c83..95f5b338 100644 --- a/manifests/notify.pp +++ b/manifests/notify.pp @@ -6,7 +6,7 @@ # # [*control_exchange*] # (Optional) The default exchange to scope topics. -# Defaults to 'openstack'. +# Defaults to $::os_service_default. # # [*enable_notifications*] # (Optional) Enables sending notifications to Ceilometer. @@ -18,22 +18,24 @@ # # [*notification_topics*] # (Optional) Topic to use for notifications. -# Defaults to 'notifications'. +# Defaults to $::os_service_default. # # [*notification_level*] # (Optional) Notification level for outgoing notifications. -# Defaults to 'INFO'. +# Defaults to $::os_service_default. # class sahara::notify ( - $control_exchange = 'openstack', + $control_exchange = $::os_service_default, $enable_notifications = false, $notification_driver = 'messaging', - $notification_topics = 'notifications', - $notification_level = 'INFO', + $notification_topics = $::os_service_default, + $notification_level = $::os_service_default, ) { if $enable_notifications { + warning('The puppet default for notification_driver parameter is different from OpenStack project default') + sahara_config { 'DEFAULT/control_exchange': value => $control_exchange; 'DEFAULT/enable_notifications': value => $enable_notifications; diff --git a/manifests/notify/qpid.pp b/manifests/notify/qpid.pp index e1c95d8d..876e548b 100644 --- a/manifests/notify/qpid.pp +++ b/manifests/notify/qpid.pp @@ -7,15 +7,15 @@ # # [*durable_queues*] # (Optional) Use durable queues in broker. -# Defaults to false. +# Defaults to $::os_service_default. # # [*qpid_hostname*] # (Optional) IP or hostname of the qpid server. -# Defaults to '127.0.0.1'. +# Defaults to $::os_service_default. # # [*qpid_port*] # (Optional) Port of the qpid server. -# Defaults to 5672. +# Defaults to $::os_service_default. # # [*qpid_username*] # (Optional) User to connect to the qpid server. @@ -27,35 +27,35 @@ # # [*qpid_sasl_mechanisms*] # (Optional) String of SASL mechanisms to use. -# Defaults to ''. +# Defaults to $::os_service_default. # # [*qpid_heartbeat*] # (Optional) Seconds between connection keepalive heartbeats. -# Defaults to 60. +# Defaults to $::os_service_default. # # [*qpid_protocol*] # (Optional) Protocol to use for qpid (tcp/ssl). -# Defaults to tcp. +# Defaults to $::os_service_default. # # [*qpid_tcp_nodelay*] # (Optional) Whether to disable the Nagle algorithm. -# Defaults to true. +# Defaults to $::os_service_default. # # [*qpid_receiver_capacity*] # (Optional) Number of prefetched messages to hold. -# Defaults to 1. +# Defaults to $::os_service_default. # # [*qpid_topology_version*] # (Optional) Version of qpid toplogy to use. -# Defaults to 2. +# Defaults to $::os_service_default. # # [*notification_topics*] # (Optional) Topic to use for notifications. -# Defaults to 'notifications'. +# Defaults to $::os_service_default. # # [*control_exchange*] # (Optional) The default exchange to scope topics. -# Defaults to 'openstack'. +# Defaults to $::os_service_default. # # == DEPRECATED PARAMETERS # @@ -82,19 +82,19 @@ # Defaults to undef # class sahara::notify::qpid( - $durable_queues = false, - $qpid_hostname = 'localhost', - $qpid_port = 5672, + $durable_queues = $::os_service_default, + $qpid_hostname = $::os_service_default, + $qpid_port = $::os_service_default, $qpid_username = 'guest', $qpid_password = 'guest', - $qpid_sasl_mechanisms = '', - $qpid_heartbeat = 60, - $qpid_protocol = 'tcp', - $qpid_tcp_nodelay = true, - $qpid_receiver_capacity = 1, - $qpid_topology_version = 2, - $notification_topics = 'notifications', - $control_exchange = 'openstack', + $qpid_sasl_mechanisms = $::os_service_default, + $qpid_heartbeat = $::os_service_default, + $qpid_protocol = $::os_service_default, + $qpid_tcp_nodelay = $::os_service_default, + $qpid_receiver_capacity = $::os_service_default, + $qpid_topology_version = $::os_service_default, + $notification_topics = $::os_service_default, + $control_exchange = $::os_service_default, # DEPRECATED PARAMETERS $kombu_ssl_version = undef, $kombu_ssl_keyfile = undef, @@ -105,6 +105,7 @@ class sahara::notify::qpid( warning('This class is deprecated. Use sahara::init for configuration rpc options instead') warning('This class is deprecated. Use sahara::notify for configuration ceilometer notifications instead') + warning('Default values for qpid_username and qpid_password parameters are different from OpenStack project defaults') if $kombu_ssl_version { warning('The kombu_ssl_version parameter is deprecated and has no effect.') @@ -128,7 +129,6 @@ class sahara::notify::qpid( sahara_config { 'DEFAULT/rpc_backend': value => 'qpid'; - 'oslo_messaging_qpid/qpid_hosts': value => '$qpid_hostname:$qpid_port'; 'oslo_messaging_qpid/amqp_durable_queues': value => $durable_queues; 'oslo_messaging_qpid/qpid_hostname': value => $qpid_hostname; diff --git a/manifests/notify/rabbitmq.pp b/manifests/notify/rabbitmq.pp index 963eb157..9ce7988a 100644 --- a/manifests/notify/rabbitmq.pp +++ b/manifests/notify/rabbitmq.pp @@ -7,60 +7,60 @@ # # [*durable_queues*] # (Optional) Use durable queues in broker. -# Defaults to false. +# Defaults to $::os_service_default. # # [*rabbit_host*] # (Optional) IP or hostname of the rabbit server. -# Defaults to '127.0.0.1'. +# Defaults to $::os_service_default. # # [*rabbit_port*] # (Optional) Port of the rabbit server. -# Defaults to 5672. +# Defaults to $::os_service_default. # # [*rabbit_hosts*] # (Optional) IP or hostname of the rabbits servers. # comma separated array (ex: ['1.0.0.10:5672','1.0.0.11:5672']) -# Defaults to false. +# Defaults to $::os_service_default. # # [*rabbit_use_ssl*] # (Optional) Connect over SSL for RabbitMQ. -# Defaults to false. +# Defaults to $::os_service_default. # # [*rabbit_userid*] # (Optional) User to connect to the rabbit server. -# Defaults to 'guest'. +# Defaults to $::os_service_default. # # [*rabbit_password*] # (Optional) Password to connect to the rabbit server. -# Defaults to 'guest'. +# Defaults to $::os_service_default. # # [*rabbit_login_method*] # (Optional) Method to auth with the rabbit server. -# Defaults to 'AMQPLAIN'. +# Defaults to $::os_service_default. # # [*rabbit_virtual_host*] # (Optional) Virtual host to use. -# Defaults to '/'. +# Defaults to $::os_service_default. # # [*rabbit_retry_interval*] # (Optional) Reconnection attempt frequency for rabbit. -# Defaults to 1. +# Defaults to $::os_service_default. # # [*rabbit_retry_backoff*] # (Optional) Backoff between reconnection attempts for rabbit. -# Defaults to 2. +# Defaults to $::os_service_default. # # [*rabbit_max_retries*] # (Optional) Number of times to retry (0 == no limit). -# Defaults to 0. +# Defaults to $::os_service_default. # # [*notification_topics*] # (Optional) Topic to use for notifications. -# Defaults to 'notifications'. +# Defaults to $::os_service_default. # # [*control_exchange*] # (Optional) The default exchange to scope topics. -# Defaults to 'openstack'. +# Defaults to $::os_service_default. # # [*kombu_ssl_version*] # (optional) SSL version to use (valid only if SSL enabled). @@ -82,34 +82,34 @@ # # [*kombu_reconnect_delay*] # (Optional) Backoff on cancel notification (valid only if SSL enabled). -# Defaults to '1.0'; floating-point value. +# Defaults to '$::os_service_default; floating-point value. # class sahara::notify::rabbitmq( - $durable_queues = false, - $rabbit_host = 'localhost', - $rabbit_hosts = false, - $rabbit_port = 5672, - $rabbit_use_ssl = false, - $rabbit_userid = 'guest', - $rabbit_password = 'guest', - $rabbit_login_method = 'AMQPLAIN', - $rabbit_virtual_host = '/', - $rabbit_retry_interval = 1, - $rabbit_retry_backoff = 2, - $rabbit_max_retries = 0, - $notification_topics = 'notifications', - $control_exchange = 'openstack', + $durable_queues = $::os_service_default, + $rabbit_host = $::os_service_default, + $rabbit_hosts = $::os_service_default, + $rabbit_port = $::os_service_default, + $rabbit_use_ssl = $::os_service_default, + $rabbit_userid = $::os_service_default, + $rabbit_password = $::os_service_default, + $rabbit_login_method = $::os_service_default, + $rabbit_virtual_host = $::os_service_default, + $rabbit_retry_interval = $::os_service_default, + $rabbit_retry_backoff = $::os_service_default, + $rabbit_max_retries = $::os_service_default, + $notification_topics = $::os_service_default, + $control_exchange = $::os_service_default, $kombu_ssl_version = $::os_service_default, $kombu_ssl_keyfile = $::os_service_default, $kombu_ssl_certfile = $::os_service_default, $kombu_ssl_ca_certs = $::os_service_default, - $kombu_reconnect_delay = '1.0', + $kombu_reconnect_delay = $::os_service_default, ) { warning('This class is deprecated. Use sahara::init for configuration rpc options instead') warning('This class is deprecated. Use sahara::notify for configuration ceilometer notifications instead') - if $rabbit_hosts { + if ! is_service_default($rabbit_hosts) and $rabbit_hosts { sahara_config { 'oslo_messaging_rabbit/rabbit_hosts': value => join($rabbit_hosts, ','); 'oslo_messaging_rabbit/rabbit_ha_queues': value => true; @@ -119,7 +119,7 @@ class sahara::notify::rabbitmq( 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; 'oslo_messaging_rabbit/rabbit_ha_queues': value => false; - 'oslo_messaging_rabbit/rabbit_hosts': value => "${rabbit_host}:${rabbit_port}"; + 'oslo_messaging_rabbit/rabbit_hosts': ensure => absent; } } diff --git a/manifests/notify/zeromq.pp b/manifests/notify/zeromq.pp index 3a17fbf2..55d02156 100644 --- a/manifests/notify/zeromq.pp +++ b/manifests/notify/zeromq.pp @@ -9,10 +9,6 @@ # (Optional) Bind address; wildcard, ethernet, or ip address. # Defaults to '*'. # -# [*zeromq_port*] -# (Optional) Receiver listening port. -# Defaults to 9501. -# # [*zeromq_contexts*] # (Optional) Number of contexsts for zeromq. # Defaults to 1. @@ -35,6 +31,10 @@ # # == DEPRECATED PARAMETERS # +# [*zeromq_port*] +# (Optional) Receiver listening port. +# Defaults to undef. +# # [*kombu_ssl_version*] # (optional) SSL version to use (valid only if SSL enabled). # Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be @@ -58,14 +58,14 @@ # Defaults to undef # class sahara::notify::zeromq( - $zeromq_bind_address = '*', - $zeromq_port = 9501, - $zeromq_contexts = 1, - $zeromq_topic_backlog = 'None', - $zeromq_ipc_dir = '/var/run/openstack', + $zeromq_bind_address = $::os_service_default, + $zeromq_contexts = $::os_service_default, + $zeromq_topic_backlog = $::os_service_default, + $zeromq_ipc_dir = $::os_service_default, $zeromq_host = 'sahara', - $cast_timeout = 30, + $cast_timeout = $::os_service_default, # DEPRECATED PARAMETERS + $zeromq_port = undef, $kombu_ssl_version = undef, $kombu_ssl_keyfile = undef, $kombu_ssl_certfile = undef, @@ -74,6 +74,11 @@ class sahara::notify::zeromq( ) { warning('This class is deprecated. Use sahara::init for configuration rpc options instead') + warning('The default for zeromq_host parameter is different from OpenStack project default') + + if $zeromq_port { + warning('The zeromq_port parameter is deprecated and has no effect.') + } if $kombu_ssl_version { warning('The kombu_ssl_version parameter is deprecated and has no effect.') @@ -98,7 +103,6 @@ class sahara::notify::zeromq( sahara_config { 'DEFAULT/rpc_backend': value => 'zmq'; 'DEFAULT/rpc_zmq_bind_address': value => $zeromq_bind_address; - 'DEFAULT/rpc_zmq_port': value => $zeromq_port; 'DEFAULT/rpc_zmq_contexts': value => $zeromq_contexts; 'DEFAULT/rpc_zmq_topic_backlog': value => $zeromq_topic_backlog; 'DEFAULT/rpc_zmq_ipc_dir': value => $zeromq_ipc_dir; diff --git a/manifests/service/api.pp b/manifests/service/api.pp index 1979c3c7..ca8fb1ec 100644 --- a/manifests/service/api.pp +++ b/manifests/service/api.pp @@ -7,7 +7,7 @@ # [*api_workers*] # (Optional) Number of workers for Sahara API service # 0 means all-in-one-thread configuration -# Defaults to 0 +# Defaults to $::os_service_default # # [*enabled*] # (Optional) Should the service be enabled. @@ -22,7 +22,7 @@ # Defaults to 'present' # class sahara::service::api ( - $api_workers = 0, + $api_workers = $::os_service_default, $enabled = true, $manage_service = true, $package_ensure = 'present', diff --git a/spec/classes/sahara_api_spec.rb b/spec/classes/sahara_api_spec.rb index e78d37be..c15b3868 100644 --- a/spec/classes/sahara_api_spec.rb +++ b/spec/classes/sahara_api_spec.rb @@ -9,7 +9,7 @@ describe 'sahara::service::api' do end context 'default params' do - it { is_expected.to contain_sahara_config('DEFAULT/api_workers').with_value('0') } + it { is_expected.to contain_sahara_config('DEFAULT/api_workers').with_value('') } end context 'passing params' do diff --git a/spec/classes/sahara_db_spec.rb b/spec/classes/sahara_db_spec.rb index c39f3b6c..9e19e6d1 100644 --- a/spec/classes/sahara_db_spec.rb +++ b/spec/classes/sahara_db_spec.rb @@ -5,12 +5,12 @@ describe 'sahara::db' do shared_examples 'sahara::db' do context 'with default parameters' do it { is_expected.to contain_sahara_config('database/connection').with_value('mysql://sahara:secrete@localhost:3306/sahara').with_secret(true) } - it { is_expected.to contain_sahara_config('database/idle_timeout').with_value('3600') } - it { is_expected.to contain_sahara_config('database/min_pool_size').with_value('1') } - it { is_expected.to contain_sahara_config('database/max_retries').with_value('10') } - it { is_expected.to contain_sahara_config('database/retry_interval').with_value('10') } - it { is_expected.to contain_sahara_config('database/max_pool_size').with_value('10') } - it { is_expected.to contain_sahara_config('database/max_overflow').with_value('20') } + it { is_expected.to contain_sahara_config('database/idle_timeout').with_value('') } + it { is_expected.to contain_sahara_config('database/min_pool_size').with_value('') } + it { is_expected.to contain_sahara_config('database/max_retries').with_value('') } + it { is_expected.to contain_sahara_config('database/retry_interval').with_value('') } + it { is_expected.to contain_sahara_config('database/max_pool_size').with_value('') } + it { is_expected.to contain_sahara_config('database/max_overflow').with_value('') } end context 'with specific parameters' do @@ -56,10 +56,10 @@ describe 'sahara::db' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian', + @default_facts.merge({ :osfamily => 'Debian', :operatingsystem => 'Debian', :operatingsystemrelease => 'jessie', - } + }) end it_configures 'sahara::db' @@ -67,9 +67,9 @@ describe 'sahara::db' do context 'on Redhat platforms' do let :facts do - { :osfamily => 'RedHat', + @default_facts.merge({ :osfamily => 'RedHat', :operatingsystemrelease => '7.1', - } + }) end it_configures 'sahara::db' diff --git a/spec/classes/sahara_init_spec.rb b/spec/classes/sahara_init_spec.rb index 069b3ee0..6d6e8786 100644 --- a/spec/classes/sahara_init_spec.rb +++ b/spec/classes/sahara_init_spec.rb @@ -22,10 +22,10 @@ describe 'sahara' do shared_examples_for 'sahara config' do context 'with default params' do - it { is_expected.to contain_sahara_config('DEFAULT/use_neutron').with_value('false') } - it { is_expected.to contain_sahara_config('DEFAULT/use_floating_ips').with_value('true') } - it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('0.0.0.0') } - it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('8386') } + it { is_expected.to contain_sahara_config('DEFAULT/use_neutron').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/use_floating_ips').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/host').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/port').with_value('') } it { is_expected.to contain_sahara_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/v2.0/') } it { is_expected.to contain_sahara_config('keystone_authtoken/identity_uri').with_value('http://127.0.0.1:35357/') } it { is_expected.to contain_sahara_config('keystone_authtoken/admin_user').with_value('sahara') } @@ -69,14 +69,14 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('DEFAULT/rpc_backend').with_value('rabbit') } context 'when defaults with rabbit pass specified' do - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value('guest').with_secret(true) } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value('').with_secret(true) } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } end context 'when passing params' do @@ -97,6 +97,7 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } end context 'with rabbit ssl cert parameters' do @@ -147,8 +148,8 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } end context 'when passing params for multiple rabbit hosts' do @@ -178,11 +179,11 @@ describe 'sahara' do context 'when default params' do it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest') } it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value('guest').with_secret(true) } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5672') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hosts').with_value('localhost:5672') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/amqp_durable_queues').with_value('false') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/amqp_durable_queues').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hosts').with_ensure('absent') } end context 'when passing params' do @@ -202,6 +203,7 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost2') } it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5673') } it { is_expected.to contain_sahara_config('oslo_messaging_qpid/amqp_durable_queues').with_value('true') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hosts').with_ensure('absent') } end context 'when passing params for multiple qpid hosts' do @@ -226,20 +228,18 @@ describe 'sahara' do it { is_expected.to contain_sahara_config('DEFAULT/rpc_backend').with_value('zmq') } context 'with default params' do - it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_bind_address').with_value('*') } - it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_port').with_value('9501') } - it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_contexts').with_value('1') } - it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_topic_backlog').with_value('None') } - it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_ipc_dir').with_value('/var/run/openstack') } + it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_bind_address').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_contexts').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_topic_backlog').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_ipc_dir').with_value('') } it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_host').with_value('sahara') } - it { is_expected.to contain_sahara_config('DEFAULT/rpc_cast_timeout').with_value('30') } + it { is_expected.to contain_sahara_config('DEFAULT/rpc_cast_timeout').with_value('') } end context 'when passing params' do before do params.merge!({ :zeromq_bind_address => '*', - :zeromq_port => '9501', :zeromq_host => 'localhost', :cast_timeout => '30', :rpc_backend => 'zmq', @@ -247,7 +247,6 @@ describe 'sahara' do end it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_bind_address').with_value('*') } - it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_port').with_value('9501') } it { is_expected.to contain_sahara_config('DEFAULT/rpc_zmq_host').with_value('localhost') } it { is_expected.to contain_sahara_config('DEFAULT/rpc_cast_timeout').with_value('30') } end diff --git a/spec/classes/sahara_logging_spec.rb b/spec/classes/sahara_logging_spec.rb index a04007b6..1a02851e 100644 --- a/spec/classes/sahara_logging_spec.rb +++ b/spec/classes/sahara_logging_spec.rb @@ -61,10 +61,10 @@ describe 'sahara::logging' do shared_examples_for 'basic logging options defaults' do context 'with defaults' do - it { is_expected.to contain_sahara_config('DEFAULT/use_stderr').with_value(true) } - it { is_expected.to contain_sahara_config('DEFAULT/use_syslog').with_value(false) } - it { is_expected.to contain_sahara_config('DEFAULT/debug').with_value(false) } - it { is_expected.to contain_sahara_config('DEFAULT/verbose').with_value(false) } + it { is_expected.to contain_sahara_config('DEFAULT/use_stderr').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/use_syslog').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/debug').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/verbose').with_value('') } it { is_expected.to contain_sahara_config('DEFAULT/log_dir').with_value('/var/log/sahara') } end diff --git a/spec/classes/sahara_notify_qpid_spec.rb b/spec/classes/sahara_notify_qpid_spec.rb index 3cb51fcb..951ef937 100644 --- a/spec/classes/sahara_notify_qpid_spec.rb +++ b/spec/classes/sahara_notify_qpid_spec.rb @@ -1,9 +1,9 @@ require 'spec_helper' describe 'sahara::notify::qpid' do let :facts do - { + @default_facts.merge({ :osfamily => 'Debian' - } + }) end describe 'when default params and qpid_password' do @@ -12,11 +12,10 @@ describe 'sahara::notify::qpid' do end it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value('pass') } it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_password').with_value(params[:qpid_password]).with_secret(true) } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('localhost') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('5672') } - it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('tcp') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_hostname').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_port').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_protocol').with_value('') } end describe 'when passing params' do @@ -25,7 +24,8 @@ describe 'sahara::notify::qpid' do :qpid_password => 'pass2', :qpid_username => 'guest2', :qpid_hostname => 'localhost2', - :qpid_port => '5673' + :qpid_port => '5673', + :qpid_protocol => 'tcp', } end it { is_expected.to contain_sahara_config('oslo_messaging_qpid/qpid_username').with_value('guest2') } diff --git a/spec/classes/sahara_notify_rabbitmq_spec.rb b/spec/classes/sahara_notify_rabbitmq_spec.rb index 694525de..ee6844da 100644 --- a/spec/classes/sahara_notify_rabbitmq_spec.rb +++ b/spec/classes/sahara_notify_rabbitmq_spec.rb @@ -7,20 +7,16 @@ describe 'sahara::notify::rabbitmq' do end describe 'when defaults with rabbit pass specified' do - let :params do - {:rabbit_password => 'pass'} - end - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value('pass') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value(params[:rabbit_password]).with_secret(true) } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost:5672') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_password').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('false') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('false') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('/') } - it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('openstack') } - it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('notifications') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_virtual_host').with_value('') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } + it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('') } end describe 'when passing params' do @@ -36,6 +32,7 @@ describe 'sahara::notify::rabbitmq' do it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_durable_queues').with_value('true') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } end end @@ -86,8 +83,8 @@ describe 'sahara::notify::rabbitmq' do it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest2') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_host').with_value('localhost2') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_port').with_value('5673') } - it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_value('localhost2:5673') } it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('true') } + it { is_expected.to contain_sahara_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } end describe 'when passing params for multiple rabbit hosts' do diff --git a/spec/classes/sahara_notify_spec.rb b/spec/classes/sahara_notify_spec.rb index ba0b9c1e..38148693 100644 --- a/spec/classes/sahara_notify_spec.rb +++ b/spec/classes/sahara_notify_spec.rb @@ -1,19 +1,19 @@ require 'spec_helper' describe 'sahara::notify' do let :facts do - { + @default_facts.merge({ :osfamily => 'Debian' - } + }) end describe 'when defaults with notify enabled' do let :params do {:enable_notifications => 'true'} end - it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('openstack') } + it { is_expected.to contain_sahara_config('DEFAULT/control_exchange').with_value('') } it { is_expected.to contain_sahara_config('DEFAULT/notification_driver').with_value('messaging') } - it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('notifications') } - it { is_expected.to contain_sahara_config('DEFAULT/notification_level').with_value('INFO') } + it { is_expected.to contain_sahara_config('DEFAULT/notification_topics').with_value('') } + it { is_expected.to contain_sahara_config('DEFAULT/notification_level').with_value('') } end describe 'when passing params' do