From e6ab8881eee1bae28a465f9ab51311eae8674f6e Mon Sep 17 00:00:00 2001 From: Iury Gregory Melo Ferreira Date: Tue, 24 Nov 2015 19:49:36 +0000 Subject: [PATCH] Manila $::os_service_default for db and log Switch to $::os_service_default all params in logging and db. Changes: logging.pp, db.pp and tests. Related-bug: #1515273 Change-Id: Idf7bc36d321328391a1b361add965c53627124a4 --- manifests/db.pp | 88 ++++---- manifests/logging.pp | 209 +++++------------- spec/classes/manila_api_spec.rb | 2 +- spec/classes/manila_backends_spec.rb | 4 +- spec/classes/manila_client_spec.rb | 2 +- spec/classes/manila_db_mysql_spec.rb | 2 +- spec/classes/manila_db_postgresql_spec.rb | 8 +- spec/classes/manila_db_spec.rb | 20 +- spec/classes/manila_db_sync_spec.rb | 2 +- spec/classes/manila_ganesha_spec.rb | 2 +- spec/classes/manila_logging_spec.rb | 14 +- spec/classes/manila_params_spec.rb | 2 +- spec/classes/manila_qpid_spec.rb | 4 +- spec/classes/manila_rabbitmq_spec.rb | 4 +- spec/classes/manila_scheduler_spec.rb | 4 +- spec/classes/manila_share_glusterfs_spec.rb | 4 +- spec/classes/manila_share_spec.rb | 4 +- spec/classes/manila_spec.rb | 6 +- spec/defines/manila_backend_glusterfs_spec.rb | 4 +- .../manila_backend_glusternative_spec.rb | 4 +- .../defines/manila_backend_glusternfs_spec.rb | 4 +- spec/spec_helper.rb | 3 + 22 files changed, 146 insertions(+), 250 deletions(-) diff --git a/manifests/db.pp b/manifests/db.pp index 823a98ac..70b7ab12 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -10,37 +10,37 @@ # # [*database_idle_timeout*] # Timeout when db connections should be reaped. -# (Optional) Defaults to 3600. +# (Optional) Defaults to $::os_service_default # # [*database_min_pool_size*] # Minimum number of SQL connections to keep open in a pool. -# (Optional) Defaults to 1. +# (Optional) Defaults to $::os_service_default # # [*database_max_pool_size*] # Maximum number of SQL connections to keep open in a pool. -# (Optional) Defaults to 10. +# (Optional) Defaults to $::os_service_default # # [*database_max_retries*] # Maximum db connection retries during startup. # Setting -1 implies an infinite retry count. -# (Optional) Defaults to 10. +# (Optional) Defaults to $::os_service_default # # [*database_retry_interval*] # Interval between retries of opening a sql connection. -# (Optional) Defaults to 10. +# (Optional) Defaults to $::os_service_default # # [*database_max_overflow*] # If set, use this value for max_overflow with sqlalchemy. -# (Optional) Defaults to 20. +# (Optional) Defaults to $::os_service_default # class manila::db ( $database_connection = 'sqlite:////var/lib/manila/manila.sqlite', - $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(spredzy): In order to keep backward compatibility we rely on the pick function @@ -56,42 +56,40 @@ class manila::db ( validate_re($database_connection_real, '(sqlite|mysql|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') - if $database_connection_real { - case $database_connection_real { - /^mysql:\/\//: { - $backend_package = false - require 'mysql::bindings' - require 'mysql::bindings::python' - } - /^postgresql:\/\//: { - $backend_package = false - require 'postgresql::lib::python' - } - /^sqlite:\/\//: { - $backend_package = $::manila::params::sqlite_package_name - } - default: { - fail('Unsupported backend configured') - } + case $database_connection_real { + /^mysql:\/\//: { + $backend_package = false + require 'mysql::bindings' + require 'mysql::bindings::python' } - - if $backend_package and !defined(Package[$backend_package]) { - package {'manila-backend-package': - ensure => present, - name => $backend_package, - tag => 'openstack', - } + /^postgresql:\/\//: { + $backend_package = false + require 'postgresql::lib::python' } - - manila_config { - 'database/connection': value => $database_connection_real, secret => true; - 'database/idle_timeout': value => $database_idle_timeout_real; - 'database/min_pool_size': value => $database_min_pool_size_real; - 'database/max_retries': value => $database_max_retries_real; - 'database/retry_interval': value => $database_retry_interval_real; - 'database/max_pool_size': value => $database_max_pool_size_real; - 'database/max_overflow': value => $database_max_overflow_real; + /^sqlite:\/\//: { + $backend_package = $::manila::params::sqlite_package_name + } + default: { + fail('Unsupported backend configured') } } + if $backend_package and !defined(Package[$backend_package]) { + package {'manila-backend-package': + ensure => present, + name => $backend_package, + tag => 'openstack', + } + } + + manila_config { + 'database/connection': value => $database_connection_real, secret => true; + 'database/idle_timeout': value => $database_idle_timeout_real; + 'database/min_pool_size': value => $database_min_pool_size_real; + 'database/max_retries': value => $database_max_retries_real; + 'database/retry_interval': value => $database_retry_interval_real; + 'database/max_pool_size': value => $database_max_pool_size_real; + 'database/max_overflow': value => $database_max_overflow_real; + } + } diff --git a/manifests/logging.pp b/manifests/logging.pp index 6b313601..9fd0a6f7 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -6,23 +6,23 @@ # # [*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*] # (Optional) Use syslog for logging. -# Defaults to 'false' +# Defaults to $::os_service_default # # [*use_stderr*] # (optional) Use stderr for logging -# Defaults to 'true' +# Defaults to $::os_service_default # # [*log_facility*] # (Optional) Syslog facility to receive log lines. -# Defaults to 'LOG_USER' +# Defaults to $::os_service_default # # [*log_dir*] # (optional) Directory where logs should be stored. @@ -31,34 +31,34 @@ # # [*logging_context_format_string*] # (optional) Format string to use for log messages with context. -# Defaults to undef. +# Defaults to $::os_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 $::os_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 $::os_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 $::os_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 $::os_service_default # See https://docs.python.org/2/howto/logging.html # # [*default_log_levels*] # (optional) Hash of logger (keys) and level (values) pairs. -# Defaults to undef. +# Defaults to $::os_service_default # Example: # { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN', # 'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO', @@ -67,47 +67,47 @@ # # [*publish_errors*] # (optional) Publish error events (boolean value). -# Defaults to undef (false if unconfigured). +# Defaults to $::os_service_default # # [*fatal_deprecations*] # (optional) Make deprecations fatal (boolean value) -# Defaults to undef (false if unconfigured). +# Defaults to $::os_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 $::os_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 $::os_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 $::os_service_default # Example: 'Y-%m-%d %H:%M:%S' class manila::logging( - $use_syslog = false, - $use_stderr = true, - $log_facility = 'LOG_USER', + $use_syslog = $::os_service_default, + $use_stderr = $::os_service_default, + $log_facility = $::os_service_default, $log_dir = '/var/log/manila', - $verbose = false, - $debug = false, - $logging_context_format_string = undef, - $logging_default_format_string = undef, - $logging_debug_format_suffix = undef, - $logging_exception_prefix = undef, - $log_config_append = undef, - $default_log_levels = undef, - $publish_errors = undef, - $fatal_deprecations = undef, - $instance_format = undef, - $instance_uuid_format = undef, - $log_date_format = undef, + $verbose = $::os_service_default, + $debug = $::os_service_default, + $logging_context_format_string = $::os_service_default, + $logging_default_format_string = $::os_service_default, + $logging_debug_format_suffix = $::os_service_default, + $logging_exception_prefix = $::os_service_default, + $log_config_append = $::os_service_default, + $default_log_levels = $::os_service_default, + $publish_errors = $::os_service_default, + $fatal_deprecations = $::os_service_default, + $instance_format = $::os_service_default, + $instance_uuid_format = $::os_service_default, + $log_date_format = $::os_service_default, ) { # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function @@ -119,6 +119,12 @@ class manila::logging( $verbose_real = pick($::manila::verbose,$verbose) $debug_real = pick($::manila::debug,$debug) + if is_service_default($default_log_levels) { + $default_log_levels_real = $default_log_levels + } else { + $default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',') + } + manila_config { 'DEFAULT/debug' : value => $debug_real; 'DEFAULT/verbose' : value => $verbose_real; @@ -128,130 +134,19 @@ class manila::logging( 'DEFAULT/syslog_log_facility': value => $log_facility_real; } - if $logging_context_format_string { - manila_config { - 'DEFAULT/logging_context_format_string' : - value => $logging_context_format_string; - } - } - else { - manila_config { - 'DEFAULT/logging_context_format_string' : ensure => absent; - } - } - - if $logging_default_format_string { - manila_config { - 'DEFAULT/logging_default_format_string' : - value => $logging_default_format_string; - } - } - else { - manila_config { - 'DEFAULT/logging_default_format_string' : ensure => absent; - } - } - - if $logging_debug_format_suffix { - manila_config { - 'DEFAULT/logging_debug_format_suffix' : - value => $logging_debug_format_suffix; - } - } - else { - manila_config { - 'DEFAULT/logging_debug_format_suffix' : ensure => absent; - } - } - - if $logging_exception_prefix { - manila_config { - 'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix; - } - } - else { - manila_config { - 'DEFAULT/logging_exception_prefix' : ensure => absent; - } - } - - if $log_config_append { - manila_config { - 'DEFAULT/log_config_append' : value => $log_config_append; - } - } - else { - manila_config { - 'DEFAULT/log_config_append' : ensure => absent; - } - } - - if $default_log_levels { - manila_config { - 'DEFAULT/default_log_levels' : - value => join(sort(join_keys_to_values($default_log_levels, '=')), ','); - } - } - else { - manila_config { - 'DEFAULT/default_log_levels' : ensure => absent; - } - } - - if $publish_errors { - manila_config { - 'DEFAULT/publish_errors' : value => $publish_errors; - } - } - else { - manila_config { - 'DEFAULT/publish_errors' : ensure => absent; - } - } - - if $fatal_deprecations { - manila_config { - 'DEFAULT/fatal_deprecations' : value => $fatal_deprecations; - } - } - else { - manila_config { - 'DEFAULT/fatal_deprecations' : ensure => absent; - } - } - - if $instance_format { - manila_config { - 'DEFAULT/instance_format' : value => $instance_format; - } - } - else { - manila_config { - 'DEFAULT/instance_format' : ensure => absent; - } - } - - if $instance_uuid_format { - manila_config { - 'DEFAULT/instance_uuid_format' : value => $instance_uuid_format; - } - } - else { - manila_config { - 'DEFAULT/instance_uuid_format' : ensure => absent; - } - } - - if $log_date_format { - manila_config { - 'DEFAULT/log_date_format' : value => $log_date_format; - } - } - else { - manila_config { - 'DEFAULT/log_date_format' : ensure => absent; - } - } + manila_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/default_log_levels': value => $default_log_levels_real; + '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; + } } diff --git a/spec/classes/manila_api_spec.rb b/spec/classes/manila_api_spec.rb index 086ec4b0..d0c19529 100644 --- a/spec/classes/manila_api_spec.rb +++ b/spec/classes/manila_api_spec.rb @@ -6,7 +6,7 @@ describe 'manila::api' do {:keystone_password => 'foo'} end let :facts do - {:osfamily => 'Debian'} + @default_facts.merge({:osfamily => 'Debian'}) end describe 'with only required params' do diff --git a/spec/classes/manila_backends_spec.rb b/spec/classes/manila_backends_spec.rb index fc5cb4df..0e5310f3 100644 --- a/spec/classes/manila_backends_spec.rb +++ b/spec/classes/manila_backends_spec.rb @@ -52,7 +52,7 @@ describe 'manila::backends' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'manila backends' @@ -60,7 +60,7 @@ describe 'manila::backends' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'manila backends' diff --git a/spec/classes/manila_client_spec.rb b/spec/classes/manila_client_spec.rb index d8732704..e5d0a223 100644 --- a/spec/classes/manila_client_spec.rb +++ b/spec/classes/manila_client_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'manila::client' do it { is_expected.to contain_package('python-manilaclient').with_ensure('present') } let :facts do - {:osfamily => 'Debian'} + @default_facts.merge({:osfamily => 'Debian'}) end context 'with params' do let :params do diff --git a/spec/classes/manila_db_mysql_spec.rb b/spec/classes/manila_db_mysql_spec.rb index 5ed2ddba..c4eeb43b 100644 --- a/spec/classes/manila_db_mysql_spec.rb +++ b/spec/classes/manila_db_mysql_spec.rb @@ -8,7 +8,7 @@ describe 'manila::db::mysql' do end let :facts do - {:osfamily => 'Debian'} + @default_facts.merge({:osfamily => 'Debian'}) end let :pre_condition do diff --git a/spec/classes/manila_db_postgresql_spec.rb b/spec/classes/manila_db_postgresql_spec.rb index 0c8f6a8a..5bdb3091 100644 --- a/spec/classes/manila_db_postgresql_spec.rb +++ b/spec/classes/manila_db_postgresql_spec.rb @@ -12,11 +12,11 @@ describe 'manila::db::postgresql' do context 'on a RedHat osfamily' do let :facts do - { + @default_facts.merge({ :osfamily => 'RedHat', :operatingsystemrelease => '7.0', :concat_basedir => '/var/lib/puppet/concat' - } + }) end context 'with only required parameters' do @@ -34,12 +34,12 @@ describe 'manila::db::postgresql' do context 'on a Debian osfamily' do let :facts do - { + @default_facts.merge({ :operatingsystemrelease => '7.8', :operatingsystem => 'Debian', :osfamily => 'Debian', :concat_basedir => '/var/lib/puppet/concat' - } + }) end context 'with only required parameters' do diff --git a/spec/classes/manila_db_spec.rb b/spec/classes/manila_db_spec.rb index 7f75fac1..1ab8d525 100644 --- a/spec/classes/manila_db_spec.rb +++ b/spec/classes/manila_db_spec.rb @@ -7,12 +7,12 @@ describe 'manila::db' do context 'with default parameters' do it { is_expected.to contain_manila_config('database/connection').with_value('sqlite:////var/lib/manila/manila.sqlite').with_secret(true) } - it { is_expected.to contain_manila_config('database/idle_timeout').with_value('3600') } - it { is_expected.to contain_manila_config('database/min_pool_size').with_value('1') } - it { is_expected.to contain_manila_config('database/max_pool_size').with_value('10') } - it { is_expected.to contain_manila_config('database/max_overflow').with_value('20') } - it { is_expected.to contain_manila_config('database/max_retries').with_value('10') } - it { is_expected.to contain_manila_config('database/retry_interval').with_value('10') } + it { is_expected.to contain_manila_config('database/idle_timeout').with_value('') } + it { is_expected.to contain_manila_config('database/min_pool_size').with_value('') } + it { is_expected.to contain_manila_config('database/max_pool_size').with_value('') } + it { is_expected.to contain_manila_config('database/max_overflow').with_value('') } + it { is_expected.to contain_manila_config('database/max_retries').with_value('') } + it { is_expected.to contain_manila_config('database/retry_interval').with_value('') } end @@ -60,10 +60,10 @@ describe 'manila::db' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian', + @default_facts.merge({ :osfamily => 'Debian', :operatingsystem => 'Debian', :operatingsystemrelease => 'jessie', - } + }) end it_configures 'manila::db' @@ -71,9 +71,9 @@ describe 'manila::db' do context 'on Redhat platforms' do let :facts do - { :osfamily => 'RedHat', + @default_facts.merge({ :osfamily => 'RedHat', :operatingsystemrelease => '7.1', - } + }) end it_configures 'manila::db' diff --git a/spec/classes/manila_db_sync_spec.rb b/spec/classes/manila_db_sync_spec.rb index bbdb6fff..36790f81 100644 --- a/spec/classes/manila_db_sync_spec.rb +++ b/spec/classes/manila_db_sync_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'manila::db::sync' do let :facts do - {:osfamily => 'Debian'} + @default_facts.merge({:osfamily => 'Debian'}) end it { is_expected.to contain_exec('manila-manage db_sync').with( :command => 'manila-manage db sync', diff --git a/spec/classes/manila_ganesha_spec.rb b/spec/classes/manila_ganesha_spec.rb index 478688fd..6d5c2944 100644 --- a/spec/classes/manila_ganesha_spec.rb +++ b/spec/classes/manila_ganesha_spec.rb @@ -27,7 +27,7 @@ describe 'manila::ganesha' do context 'on Red Hat platforms' do let :facts do - {:osfamily => 'RedHat'} + @default_facts.merge({:osfamily => 'RedHat'}) end it_configures 'manila NFS Ganesha options for share drivers' end diff --git a/spec/classes/manila_logging_spec.rb b/spec/classes/manila_logging_spec.rb index 0abc7664..f26b968c 100644 --- a/spec/classes/manila_logging_spec.rb +++ b/spec/classes/manila_logging_spec.rb @@ -57,11 +57,11 @@ describe 'manila::logging' do shared_examples 'basic default logging settings' do it 'configures manila logging settins with default values' do - is_expected.to contain_manila_config('DEFAULT/use_syslog').with(:value => 'false') - is_expected.to contain_manila_config('DEFAULT/use_stderr').with(:value => 'true') + is_expected.to contain_manila_config('DEFAULT/use_syslog').with(:value => '') + is_expected.to contain_manila_config('DEFAULT/use_stderr').with(:value => '') is_expected.to contain_manila_config('DEFAULT/log_dir').with(:value => '/var/log/manila') - is_expected.to contain_manila_config('DEFAULT/verbose').with(:value => 'false') - is_expected.to contain_manila_config('DEFAULT/debug').with(:value => 'false') + is_expected.to contain_manila_config('DEFAULT/verbose').with(:value => '') + is_expected.to contain_manila_config('DEFAULT/debug').with(:value => '') end end @@ -120,13 +120,13 @@ describe 'manila::logging' do :default_log_levels, :fatal_deprecations, :instance_format, :instance_uuid_format, :log_date_format, ].each { |param| - it { is_expected.to contain_manila_config("DEFAULT/#{param}").with_ensure('absent') } + it { is_expected.to contain_manila_config("DEFAULT/#{param}").with_value('') } } end context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'manila-logging' @@ -134,7 +134,7 @@ describe 'manila::logging' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'manila-logging' diff --git a/spec/classes/manila_params_spec.rb b/spec/classes/manila_params_spec.rb index 32a73c62..28cc30d3 100644 --- a/spec/classes/manila_params_spec.rb +++ b/spec/classes/manila_params_spec.rb @@ -3,7 +3,7 @@ require 'spec_helper' describe 'manila::params' do let :facts do - {:osfamily => 'Debian'} + @default_facts.merge({:osfamily => 'Debian'}) end it 'should compile' do subject diff --git a/spec/classes/manila_qpid_spec.rb b/spec/classes/manila_qpid_spec.rb index f3fec931..99706e41 100644 --- a/spec/classes/manila_qpid_spec.rb +++ b/spec/classes/manila_qpid_spec.rb @@ -3,8 +3,8 @@ require 'spec_helper' describe 'manila::qpid' do let :facts do - {:puppetversion => '2.7', - :osfamily => 'RedHat'} + @default_facts.merge({:puppetversion => '2.7', + :osfamily => 'RedHat'}) end describe 'with defaults' do diff --git a/spec/classes/manila_rabbitmq_spec.rb b/spec/classes/manila_rabbitmq_spec.rb index d9a47d3f..c96b5f08 100644 --- a/spec/classes/manila_rabbitmq_spec.rb +++ b/spec/classes/manila_rabbitmq_spec.rb @@ -3,9 +3,9 @@ require 'spec_helper' describe 'manila::rabbitmq' do let :facts do - { :puppetversion => '2.7', + @default_facts.merge({ :puppetversion => '2.7', :osfamily => 'Debian', - } + }) end describe 'with defaults' do diff --git a/spec/classes/manila_scheduler_spec.rb b/spec/classes/manila_scheduler_spec.rb index 9d3080be..d5cb523d 100644 --- a/spec/classes/manila_scheduler_spec.rb +++ b/spec/classes/manila_scheduler_spec.rb @@ -5,7 +5,7 @@ describe 'manila::scheduler' do describe 'on debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end describe 'with default parameters' do @@ -56,7 +56,7 @@ describe 'manila::scheduler' do describe 'on rhel platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end describe 'with default parameters' do diff --git a/spec/classes/manila_share_glusterfs_spec.rb b/spec/classes/manila_share_glusterfs_spec.rb index e63221ff..70d194d2 100644 --- a/spec/classes/manila_share_glusterfs_spec.rb +++ b/spec/classes/manila_share_glusterfs_spec.rb @@ -23,7 +23,7 @@ describe 'manila::share::glusterfs' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'glusterfs share driver' @@ -31,7 +31,7 @@ describe 'manila::share::glusterfs' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'glusterfs share driver' diff --git a/spec/classes/manila_share_spec.rb b/spec/classes/manila_share_spec.rb index c25f52ec..fea08001 100644 --- a/spec/classes/manila_share_spec.rb +++ b/spec/classes/manila_share_spec.rb @@ -29,7 +29,7 @@ describe 'manila::share' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end let :platform_params do @@ -41,7 +41,7 @@ describe 'manila::share' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end let :platform_params do diff --git a/spec/classes/manila_spec.rb b/spec/classes/manila_spec.rb index 19e6b9c7..de70a937 100644 --- a/spec/classes/manila_spec.rb +++ b/spec/classes/manila_spec.rb @@ -5,7 +5,7 @@ describe 'manila' do end let :facts do - {:osfamily => 'Debian'} + @default_facts.merge({:osfamily => 'Debian'}) end describe 'with only required params' do @@ -49,10 +49,10 @@ describe 'manila' do :value => 'guest' ) is_expected.to contain_manila_config('DEFAULT/verbose').with( - :value => false + :value => '' ) is_expected.to contain_manila_config('DEFAULT/debug').with( - :value => false + :value => '' ) is_expected.to contain_manila_config('DEFAULT/storage_availability_zone').with( :value => 'nova' diff --git a/spec/defines/manila_backend_glusterfs_spec.rb b/spec/defines/manila_backend_glusterfs_spec.rb index 447c300e..10d1f8bf 100644 --- a/spec/defines/manila_backend_glusterfs_spec.rb +++ b/spec/defines/manila_backend_glusterfs_spec.rb @@ -26,7 +26,7 @@ describe 'manila::backend::glusterfs' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'glusterfs share driver' @@ -34,7 +34,7 @@ describe 'manila::backend::glusterfs' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'glusterfs share driver' diff --git a/spec/defines/manila_backend_glusternative_spec.rb b/spec/defines/manila_backend_glusternative_spec.rb index 0ad65ab0..98277634 100644 --- a/spec/defines/manila_backend_glusternative_spec.rb +++ b/spec/defines/manila_backend_glusternative_spec.rb @@ -28,7 +28,7 @@ describe 'manila::backend::glusternative' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'glusternative volume driver' @@ -36,7 +36,7 @@ describe 'manila::backend::glusternative' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'glusternative volume driver' diff --git a/spec/defines/manila_backend_glusternfs_spec.rb b/spec/defines/manila_backend_glusternfs_spec.rb index 57a5ae59..8681e4eb 100644 --- a/spec/defines/manila_backend_glusternfs_spec.rb +++ b/spec/defines/manila_backend_glusternfs_spec.rb @@ -30,7 +30,7 @@ describe 'manila::backend::glusternfs' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'glusternfs volume driver' @@ -38,7 +38,7 @@ describe 'manila::backend::glusternfs' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'glusternfs volume driver' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3df4cede..9bc7bcf9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -5,6 +5,9 @@ require 'webmock/rspec' RSpec.configure do |c| c.alias_it_should_behave_like_to :it_configures, 'configures' c.alias_it_should_behave_like_to :it_raises, 'raises' + c.before :each do + @default_facts = { :os_service_default => '' } + end end at_exit { RSpec::Puppet::Coverage.report! }