diff --git a/manifests/api.pp b/manifests/api.pp index 105b0ef..70fd57c 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -18,11 +18,11 @@ # # [*host*] # (Optional) Host on which murano api should listen -# Defaults to '127.0.0.1' +# Defaults to $::os_service_default. # # [*port*] # (Optional) Port on which murano api should listen -# Defaults to 8082 +# Defaults to $::os_service_default. # # [*sync_db*] # (Optional) Whether to sync database @@ -32,8 +32,8 @@ class murano::api( $manage_service = true, $enabled = true, $package_ensure = 'present', - $host = '127.0.0.1', - $port = 8082, + $host = $::os_service_default, + $port = $::os_service_default, $sync_db = true, ) { diff --git a/manifests/db.pp b/manifests/db.pp index a59bb8d..4dfa59f 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -11,36 +11,36 @@ # [*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 murano::db ( $database_connection = 'mysql://murano:secrete@localhost:3306/murano', - $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(aderyugin): In order to keep backward compatibility we rely on the pick function diff --git a/manifests/init.pp b/manifests/init.pp index 13e0f52..2f57d79 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -195,28 +195,28 @@ class murano( $log_facility = undef, $log_dir = undef, $data_dir = '/var/cache/murano', - $notification_driver = 'messagingv2', - $rabbit_os_host = '127.0.0.1', - $rabbit_os_port = '5672', + $notification_driver = $::os_service_default, + $rabbit_os_host = $::os_service_default, + $rabbit_os_port = $::os_service_default, $rabbit_os_user = 'guest', $rabbit_os_password = 'guest', - $rabbit_ha_queues = false, - $rabbit_own_host = '127.0.0.1', - $rabbit_own_port = '5672', + $rabbit_ha_queues = $::os_service_default, + $rabbit_own_host = $::os_service_default, + $rabbit_own_port = $::os_service_default, $rabbit_own_user = 'guest', $rabbit_own_password = 'guest', $rabbit_own_vhost = 'murano', $service_host = '127.0.0.1', $service_port = '8082', $use_ssl = false, - $cert_file = undef, - $key_file = undef, - $ca_file = undef, + $cert_file = $::os_service_default, + $key_file = $::os_service_default, + $ca_file = $::os_service_default, $use_neutron = false, $external_network = $::murano::params::default_external_network, - $default_router = 'murano-default-router', - $default_nameservers = '[]', - $use_trusts = false, + $default_router = $::os_service_default, + $default_nameservers = $::os_service_default, + $use_trusts = $::os_service_default, $database_connection = undef, $database_max_retries = undef, $database_idle_timeout = undef, @@ -251,26 +251,32 @@ class murano( default => 'http', } + murano_config { + 'networking/router_name': value => $default_router; + 'networking/create_router': value => $use_neutron; + } + if $use_neutron { + if is_service_default($default_router) { + fail('The default_router parameter is required when use_neutron is set to true') + } murano_config { - 'networking/external_network' : value => $external_network; - 'networking/router_name' : value => $default_router; - 'networking/create_router' : value => true; + 'networking/external_network': value => $external_network; } } else { murano_config { - 'networking/external_network' : ensure => absent; + 'networking/external_network': ensure => 'absent'; } } if $use_ssl { - if !$ca_file { + if is_service_default($ca_file) { fail('The ca_file parameter is required when use_ssl is set to true') } - if !$cert_file { + if is_service_default($cert_file) { fail('The cert_file parameter is required when use_ssl is set to true') } - if !$key_file { + if is_service_default($key_file) { fail('The key_file parameter is required when use_ssl is set to true') } murano_config { @@ -278,12 +284,6 @@ class murano( 'ssl/key_file' : value => $key_file; 'ssl/ca_file' : value => $ca_file; } - } else { - murano_config { - 'ssl/cert_file' : ensure => absent; - 'ssl/key_file' : ensure => absent; - 'ssl/ca_file' : ensure => absent; - } } murano_config { diff --git a/manifests/logging.pp b/manifests/logging.pp index e912b87..f9dc98a 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*] # 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. -# (Optional) Defaults to 'LOG_USER'. +# (Optional) 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 (false if unconfigured). # # [*fatal_deprecations*] # (optional) Make deprecations fatal (boolean value) -# Defaults to undef (false if unconfigured). +# Defaults to $::os_service_default (false if unconfigured). # # [*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 murano::logging( - $verbose = false, - $debug = false, - $use_syslog = false, - $use_stderr = true, - $log_facility = 'LOG_USER', + $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/murano', - $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, + $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(aderyugin): In order to keep backward compatibility we rely on the pick function @@ -119,133 +119,29 @@ class murano::logging( $verbose_real = pick($::murano::verbose, $verbose) $debug_real = pick($::murano::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, '=')), ',') + } + murano_config { - 'DEFAULT/debug': value => $debug_real; - 'DEFAULT/verbose': value => $verbose_real; - 'DEFAULT/use_stderr': value => $use_stderr_real; - 'DEFAULT/use_syslog': value => $use_syslog_real; - 'DEFAULT/log_dir': value => $log_dir_real; + 'DEFAULT/debug': value => $debug_real; + 'DEFAULT/verbose': value => $verbose_real; + 'DEFAULT/use_stderr': value => $use_stderr_real; + 'DEFAULT/use_syslog': value => $use_syslog_real; + 'DEFAULT/log_dir': value => $log_dir_real; + 'DEFAULT/syslog_log_facility': value => $log_facility_real; + '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; } - - if $use_syslog_real { - murano_config { - 'DEFAULT/syslog_log_facility': value => $log_facility_real; - } - } else { - murano_config { - 'DEFAULT/syslog_log_facility': ensure => absent; - } - } - - if $logging_context_format_string { - murano_config { - 'DEFAULT/logging_context_format_string': value => $logging_context_format_string; - } - } else { - murano_config { - 'DEFAULT/logging_context_format_string': ensure => absent; - } - } - - if $logging_default_format_string { - murano_config { - 'DEFAULT/logging_default_format_string': value => $logging_default_format_string; - } - } else { - murano_config { - 'DEFAULT/logging_default_format_string': ensure => absent; - } - } - - if $logging_debug_format_suffix { - murano_config { - 'DEFAULT/logging_debug_format_suffix': value => $logging_debug_format_suffix; - } - } else { - murano_config { - 'DEFAULT/logging_debug_format_suffix': ensure => absent; - } - } - - if $logging_exception_prefix { - murano_config { - 'DEFAULT/logging_exception_prefix': value => $logging_exception_prefix; - } - } else { - murano_config { - 'DEFAULT/logging_exception_prefix': ensure => absent; - } - } - - if $log_config_append { - murano_config { - 'DEFAULT/log_config_append': value => $log_config_append; - } - } else { - murano_config { - 'DEFAULT/log_config_append': ensure => absent; - } - } - - if $default_log_levels { - murano_config { - 'DEFAULT/default_log_levels': - value => join(sort(join_keys_to_values($default_log_levels, '=')), ','); - } - } else { - murano_config { - 'DEFAULT/default_log_levels': ensure => absent; - } - } - - if $publish_errors { - murano_config { - 'DEFAULT/publish_errors': value => $publish_errors; - } - } else { - murano_config { - 'DEFAULT/publish_errors': ensure => absent; - } - } - - if $fatal_deprecations { - murano_config { - 'DEFAULT/fatal_deprecations': value => $fatal_deprecations; - } - } else { - murano_config { - 'DEFAULT/fatal_deprecations': ensure => absent; - } - } - - if $instance_format { - murano_config { - 'DEFAULT/instance_format': value => $instance_format; - } - } else { - murano_config { - 'DEFAULT/instance_format': ensure => absent; - } - } - - if $instance_uuid_format { - murano_config { - 'DEFAULT/instance_uuid_format': value => $instance_uuid_format; - } - } else { - murano_config { - 'DEFAULT/instance_uuid_format': ensure => absent; - } - } - - if $log_date_format { - murano_config { - 'DEFAULT/log_date_format': value => $log_date_format; - } - } else { - murano_config { - 'DEFAULT/log_date_format': ensure => absent; - } - } - } diff --git a/spec/classes/murano_api_spec.rb b/spec/classes/murano_api_spec.rb index 0496f23..0af1dee 100644 --- a/spec/classes/murano_api_spec.rb +++ b/spec/classes/murano_api_spec.rb @@ -4,15 +4,29 @@ describe 'murano::api' do shared_examples_for 'murano-api' do it { is_expected.to contain_class('murano::api') } + + context 'with default params' do + it { is_expected.to contain_murano_config('DEFAULT/bind_host').with_value('') } + it { is_expected.to contain_murano_config('DEFAULT/bind_port').with_value('') } + end + + context 'with passed params' do + let :params do { + :host => 'localhost', + :port => '1111', + } end + it { is_expected.to contain_murano_config('DEFAULT/bind_host').with_value('localhost') } + it { is_expected.to contain_murano_config('DEFAULT/bind_port').with_value('1111') } + end end context 'on a RedHat osfamily' do let :facts do - { + @default_facts.merge({ :osfamily => 'RedHat', :operatingsystemrelease => '7.0', :concat_basedir => '/var/lib/puppet/concat' - } + }) end it_configures 'murano-api' @@ -26,12 +40,12 @@ describe 'murano::api' 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 it_configures 'murano-api' diff --git a/spec/classes/murano_db_spec.rb b/spec/classes/murano_db_spec.rb index e8d0c8c..0580881 100644 --- a/spec/classes/murano_db_spec.rb +++ b/spec/classes/murano_db_spec.rb @@ -5,12 +5,12 @@ describe 'murano::db' do shared_examples 'murano::db' do context 'with default parameters' do it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:secrete@localhost:3306/murano') } - it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3600') } - it { is_expected.to contain_murano_config('database/min_pool_size').with_value('1') } - it { is_expected.to contain_murano_config('database/max_retries').with_value('10') } - it { is_expected.to contain_murano_config('database/retry_interval').with_value('10') } - it { is_expected.to contain_murano_config('database/max_pool_size').with_value('10') } - it { is_expected.to contain_murano_config('database/max_overflow').with_value('20') } + it { is_expected.to contain_murano_config('database/idle_timeout').with_value('') } + it { is_expected.to contain_murano_config('database/min_pool_size').with_value('') } + it { is_expected.to contain_murano_config('database/max_retries').with_value('') } + it { is_expected.to contain_murano_config('database/retry_interval').with_value('') } + it { is_expected.to contain_murano_config('database/max_pool_size').with_value('') } + it { is_expected.to contain_murano_config('database/max_overflow').with_value('') } end context 'with specific parameters' do @@ -56,10 +56,10 @@ describe 'murano::db' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian', + @default_facts.merge({ :osfamily => 'Debian', :operatingsystem => 'Debian', :operatingsystemrelease => 'jessie', - } + }) end it_configures 'murano::db' @@ -67,9 +67,9 @@ describe 'murano::db' do context 'on Redhat platforms' do let :facts do - { :osfamily => 'RedHat', + @default_facts.merge({ :osfamily => 'RedHat', :operatingsystemrelease => '7.1', - } + }) end it_configures 'murano::db' diff --git a/spec/classes/murano_init_spec.rb b/spec/classes/murano_init_spec.rb index 34a9e46..55ce267 100644 --- a/spec/classes/murano_init_spec.rb +++ b/spec/classes/murano_init_spec.rb @@ -21,33 +21,25 @@ describe 'murano' do it { is_expected.to contain_class('mysql::bindings::python') } - it { is_expected.to contain_murano_config('DEFAULT/notification_driver').with_value('messagingv2') } + it { is_expected.to contain_murano_config('DEFAULT/notification_driver').with_value('') } it { is_expected.to contain_murano_config('murano/url').with_value('http://127.0.0.1:8082') } - it { is_expected.to contain_murano_config('engine/use_trusts').with_value(false) } - - it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:secrete@localhost:3306/murano') } - it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3600') } - it { is_expected.to contain_murano_config('database/min_pool_size').with_value('1') } - it { is_expected.to contain_murano_config('database/max_retries').with_value('10') } - it { is_expected.to contain_murano_config('database/retry_interval').with_value('10') } - it { is_expected.to contain_murano_config('database/max_pool_size').with_value('10') } - it { is_expected.to contain_murano_config('database/max_overflow').with_value('20') } + it { is_expected.to contain_murano_config('engine/use_trusts').with_value('') } it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_userid').with_value('guest') } it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_password').with_value('guest') } - it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_hosts').with_value('127.0.0.1') } - it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_port').with_value('5672') } - it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value(false) } + it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } + it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_port').with_value('') } + it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') } it { is_expected.to contain_murano_config('rabbitmq/login').with_value('guest') } it { is_expected.to contain_murano_config('rabbitmq/password').with_value('guest') } - it { is_expected.to contain_murano_config('rabbitmq/host').with_value('127.0.0.1') } - it { is_expected.to contain_murano_config('rabbitmq/port').with_value('5672') } + it { is_expected.to contain_murano_config('rabbitmq/host').with_value('') } + it { is_expected.to contain_murano_config('rabbitmq/port').with_value('') } it { is_expected.to contain_murano_config('rabbitmq/virtual_host').with_value('murano') } - it { is_expected.to contain_murano_config('networking/default_dns').with_value('[]') } + it { is_expected.to contain_murano_config('networking/default_dns').with_value('') } it { is_expected.to contain_murano_config('keystone_authtoken/auth_uri').with_value('http://127.0.0.1:5000/v2.0/') } it { is_expected.to contain_murano_config('keystone_authtoken/admin_user').with_value('admin') } @@ -86,13 +78,6 @@ describe 'murano' do :default_router => 'murano-router', :default_nameservers => '["8.8.8.8"]', :use_trusts => true, - :database_connection => 'mysql://murano:murano@localhost/murano', - :database_idle_timeout => '3601', - :database_min_pool_size => '2', - :database_max_retries => '11', - :database_retry_interval => '11', - :database_max_pool_size => '11', - :database_max_overflow => '21', :sync_db => false, :admin_user => 'murano', :admin_tenant_name => 'secrete', @@ -118,14 +103,6 @@ describe 'murano' do it { is_expected.to contain_murano_config('engine/use_trusts').with_value(true) } - it { is_expected.to contain_murano_config('database/connection').with_value('mysql://murano:murano@localhost/murano') } - it { is_expected.to contain_murano_config('database/idle_timeout').with_value('3601') } - it { is_expected.to contain_murano_config('database/min_pool_size').with_value('2') } - it { is_expected.to contain_murano_config('database/max_retries').with_value('11') } - it { is_expected.to contain_murano_config('database/retry_interval').with_value('11') } - it { is_expected.to contain_murano_config('database/max_pool_size').with_value('11') } - it { is_expected.to contain_murano_config('database/max_overflow').with_value('21') } - it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_userid').with_value('os') } it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_password').with_value('ossecrete') } it { is_expected.to contain_murano_config('oslo_messaging_rabbit/rabbit_hosts').with_value('10.255.0.1') } @@ -161,10 +138,10 @@ describe 'murano' do context 'on Debian platforms' do let :facts do - { + @default_facts.merge({ :osfamily => 'Debian', :operatingsystem => 'Debian' - } + }) end it_configures 'with default parameters' @@ -173,7 +150,7 @@ describe 'murano' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'with default parameters' diff --git a/spec/classes/murano_logging_spec.rb b/spec/classes/murano_logging_spec.rb index 24c79ae..3adb52a 100644 --- a/spec/classes/murano_logging_spec.rb +++ b/spec/classes/murano_logging_spec.rb @@ -61,10 +61,10 @@ describe 'murano::logging' do shared_examples_for 'basic logging options defaults' do context 'with defaults' do - it { is_expected.to contain_murano_config('DEFAULT/use_stderr').with_value(true) } - it { is_expected.to contain_murano_config('DEFAULT/use_syslog').with_value(false) } - it { is_expected.to contain_murano_config('DEFAULT/debug').with_value(false) } - it { is_expected.to contain_murano_config('DEFAULT/verbose').with_value(false) } + it { is_expected.to contain_murano_config('DEFAULT/use_stderr').with_value('') } + it { is_expected.to contain_murano_config('DEFAULT/use_syslog').with_value('') } + it { is_expected.to contain_murano_config('DEFAULT/debug').with_value('') } + it { is_expected.to contain_murano_config('DEFAULT/verbose').with_value('') } it { is_expected.to contain_murano_config('DEFAULT/log_dir').with_value('/var/log/murano') } end @@ -74,7 +74,7 @@ describe 'murano::logging' do end it { is_expected.to contain_murano_config('DEFAULT/use_syslog').with_value(true) } - it { is_expected.to contain_murano_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') } + it { is_expected.to contain_murano_config('DEFAULT/syslog_log_facility').with_value('') } end end @@ -120,13 +120,13 @@ describe 'murano::logging' do :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_murano_config("DEFAULT/#{param}").with_ensure('absent') } + it { is_expected.to contain_murano_config("DEFAULT/#{param}").with_value('') } } end context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge({ :osfamily => 'Debian' }) end it_configures 'murano-logging' @@ -134,7 +134,7 @@ describe 'murano::logging' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge({ :osfamily => 'RedHat' }) end it_configures 'murano-logging' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 3df4ced..9bc7bcf 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! }