diff --git a/lib/puppet/type/cinder_api_paste_ini.rb b/lib/puppet/type/cinder_api_paste_ini.rb index c923389f..ca2e0457 100644 --- a/lib/puppet/type/cinder_api_paste_ini.rb +++ b/lib/puppet/type/cinder_api_paste_ini.rb @@ -40,6 +40,11 @@ Puppet::Type.newtype(:cinder_api_paste_ini) do defaultto false end + newparam(:ensure_absent_val) do + desc 'A value that is specified as the value property will behave as if ensure => absent was specified' + defaultto('') + end + autorequire(:package) do 'cinder' end diff --git a/manifests/api.pp b/manifests/api.pp index cfef1c08..d7ba9f10 100644 --- a/manifests/api.pp +++ b/manifests/api.pp @@ -60,7 +60,7 @@ # (optional) Some operations require cinder to make API requests # to Nova. This sets the keystone region to be used for these # requests. For example, boot-from-volume. -# Defaults to ''. +# Defaults to $::os_service_default # # [*nova_catalog_info*] # (optional) Match this value when searching for nova in the service @@ -128,7 +128,7 @@ # This should contain the name of the default volume type to use. # If not configured, it produces an error when creating a volume # without specifying a type. -# Defaults to ''. +# Defaults to $::os_service_default. # # [*validate*] # (optional) Whether to validate the service is working after any service refreshes @@ -163,7 +163,7 @@ class cinder::api ( $identity_uri = false, $nova_catalog_info = 'compute:Compute Service:publicURL', $nova_catalog_admin_info = 'compute:Compute Service:adminURL', - $os_region_name = '', + $os_region_name = $::os_service_default, $privileged_user = false, $os_privileged_user_name = undef, $os_privileged_user_password = undef, @@ -175,7 +175,7 @@ class cinder::api ( $enabled = true, $manage_service = true, $ratelimits = undef, - $default_volume_type = '', + $default_volume_type = $::os_service_default, $ratelimits_factory = 'cinder.api.v1.limits:RateLimitingMiddleware.factory', $validate = false, diff --git a/manifests/backend/netapp.pp b/manifests/backend/netapp.pp index 36dbf23a..a6b5cd99 100644 --- a/manifests/backend/netapp.pp +++ b/manifests/backend/netapp.pp @@ -112,7 +112,7 @@ # [*nfs_mount_options*] # (optional) Mount options passed to the nfs client. See section # of the nfs man page for details. -# Defaults to '' +# Defaults to $::os_service_default # # [*netapp_copyoffload_tool_path*] # (optional) This option specifies the path of the NetApp Copy Offload tool @@ -197,7 +197,7 @@ define cinder::backend::netapp ( $thres_avl_size_perc_stop = '60', $nfs_shares = undef, $nfs_shares_config = '/etc/cinder/shares.conf', - $nfs_mount_options = '', + $nfs_mount_options = $::os_service_default, $netapp_copyoffload_tool_path = undef, $netapp_controller_ips = undef, $netapp_sa_password = undef, diff --git a/manifests/backend/rbd.pp b/manifests/backend/rbd.pp index 4ba62b22..cc98244e 100644 --- a/manifests/backend/rbd.pp +++ b/manifests/backend/rbd.pp @@ -25,12 +25,12 @@ # # [*rbd_secret_uuid*] # (optional) A required parameter to use cephx. -# Defaults to '' +# Defaults to $::os_service_default # # [*volume_tmp_dir*] # (optional) Location to store temporary image files if the volume # driver does not write them directly to the volume -# Defaults to '' +# Defaults to $::os_service_default # # [*rbd_max_clone_depth*] # (optional) Maximum number of nested clones that can be taken of a @@ -50,8 +50,8 @@ define cinder::backend::rbd ( $volume_backend_name = $name, $rbd_ceph_conf = '/etc/ceph/ceph.conf', $rbd_flatten_volume_from_snapshot = false, - $rbd_secret_uuid = '', - $volume_tmp_dir = '', + $rbd_secret_uuid = $::os_service_default, + $volume_tmp_dir = $::os_service_default, $rbd_max_clone_depth = '5', $extra_options = {}, ) { diff --git a/manifests/backup/nfs.pp b/manifests/backup/nfs.pp index d541bfc6..95fe83c7 100644 --- a/manifests/backup/nfs.pp +++ b/manifests/backup/nfs.pp @@ -37,11 +37,11 @@ # # [*backup_mount_options*] # (optional) The mount options that are passed to the NFS client. -# Defaults to '' +# Defaults to $::os_service_default # # [*backup_container*] # (optional) Custom container to use for backups. -# Defaults to undef +# Defaults to $::os_service_default # # [*backup_compression_algorithm*] # (optional) Compression algorithm to use when writing backup data. @@ -75,8 +75,8 @@ class cinder::backup::nfs ( $backup_sha_block_size_bytes = 32768, $backup_enable_progress_timer = true, $backup_mount_point_base = '$state_path/backup_mount', - $backup_mount_options = '', - $backup_container = undef, + $backup_mount_options = $::os_service_default, + $backup_container = $::os_service_default, $backup_compression_algorithm = 'zlib', ) { diff --git a/manifests/db.pp b/manifests/db.pp index 7ce9802c..326343db 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 '' +# (Optional) Defaults to $::os_service_default # # [*database_min_pool_size*] # Minimum number of SQL connections to keep open in a pool. -# (Optional) Defaults to '' +# (Optional) Defaults to $::os_service_default # # [*database_max_pool_size*] # Maximum number of SQL connections to keep open in a pool. -# (Optional) Defaults to '' +# (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 '' +# (Optional) Defaults to $::os_service_default # # [*database_retry_interval*] # Interval between retries of opening a sql connection. -# (Optional) Defaults to '' +# (Optional) Defaults to $::os_service_default # # [*database_max_overflow*] # If set, use this value for max_overflow with sqlalchemy. -# (Optional) Defaults to '' +# (Optional) Defaults to $::os_service_default # class cinder::db ( $database_connection = 'sqlite:////var/lib/cinder/cinder.sqlite', - $database_idle_timeout = '', - $database_min_pool_size = '', - $database_max_pool_size = '', - $database_max_retries = '', - $database_retry_interval = '', - $database_max_overflow = '', + $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 diff --git a/manifests/init.pp b/manifests/init.pp index dc4329b8..18102b1b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -75,21 +75,21 @@ # # [*kombu_ssl_ca_certs*] # (optional) SSL certification authority file (valid only if SSL enabled). -# Defaults to '' +# Defaults to $::os_service_default # # [*kombu_ssl_certfile*] # (optional) SSL cert file (valid only if SSL enabled). -# Defaults to '' +# Defaults to $::os_service_default # # [*kombu_ssl_keyfile*] # (optional) SSL key file (valid only if SSL enabled). -# Defaults to '' +# Defaults to $::os_service_default # # [*kombu_ssl_version*] # (optional) SSL version to use (valid only if SSL enabled). # Valid values are TLSv1, SSLv23 and SSLv3. SSLv2 may be # available on some distributions. -# Defaults to '' +# Defaults to $::os_service_default # # [*amqp_durable_queues*] # Use durable queues in amqp. @@ -183,7 +183,7 @@ # [*log_dir*] # (optional) Directory where logs should be stored. # If set to boolean false, it will not log to any directory. -# Defaults to '' +# Defaults to $::os_service_default # # [*use_ssl*] # (optional) Enable SSL on the API server @@ -199,7 +199,7 @@ # # [*ca_file*] # (optional) CA certificate file to use to verify connecting clients -# Defaults to '' +# Defaults to $::os_service_default # # [*storage_availability_zone*] # (optional) Availability zone of the node. @@ -253,10 +253,10 @@ class cinder ( $rabbit_userid = 'guest', $rabbit_password = false, $rabbit_use_ssl = false, - $kombu_ssl_ca_certs = '', - $kombu_ssl_certfile = '', - $kombu_ssl_keyfile = '', - $kombu_ssl_version = '', + $kombu_ssl_ca_certs = $::os_service_default, + $kombu_ssl_certfile = $::os_service_default, + $kombu_ssl_keyfile = $::os_service_default, + $kombu_ssl_version = $::os_service_default, $amqp_durable_queues = false, $qpid_hostname = 'localhost', $qpid_port = '5672', @@ -274,14 +274,14 @@ class cinder ( $qpid_tcp_nodelay = true, $package_ensure = 'present', $use_ssl = false, - $ca_file = '', + $ca_file = $::os_service_default, $cert_file = false, $key_file = false, $api_paste_config = '/etc/cinder/api-paste.ini', $use_syslog = false, $use_stderr = true, $log_facility = 'LOG_USER', - $log_dir = '', + $log_dir = $::os_service_default, $verbose = false, $debug = false, $storage_availability_zone = 'nova', diff --git a/manifests/logging.pp b/manifests/logging.pp index 7765ac78..2e8cbad2 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -6,29 +6,29 @@ # # [*logging_context_format_string*] # (Optional) Format string to use for log messages with context. -# Defaults to '' +# 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 '' +# 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 '' +# 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 '' +# 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 '' +# Defaults to $::os_service_default # See https://docs.python.org/2/howto/logging.html # # [*default_log_levels*] @@ -42,41 +42,41 @@ # # [*publish_errors*] # (optional) Publish error events (boolean value). -# Defaults to '' +# Defaults to $::os_service_default # # [*fatal_deprecations*] # (optional) Make deprecations fatal (boolean value) -# Defaults to '' +# 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 '' +# 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 '' +# 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 '' +# Defaults to $::os_service_default # Example: 'Y-%m-%d %H:%M:%S' # class cinder::logging( - $logging_context_format_string = '', - $logging_default_format_string = '', - $logging_debug_format_suffix = '', - $logging_exception_prefix = '', - $log_config_append = '', + $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 = undef, - $publish_errors = '', - $fatal_deprecations = '', - $instance_format = '', - $instance_uuid_format = '', - $log_date_format = '', + $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, ) { cinder_config { diff --git a/manifests/scheduler.pp b/manifests/scheduler.pp index a3f66ae4..08f1732f 100644 --- a/manifests/scheduler.pp +++ b/manifests/scheduler.pp @@ -6,7 +6,7 @@ # # [*scheduler_driver*] # (Optional) Default scheduler driver to use -# Defaults to ''. +# Defaults to $::os_service_default. # # [*package_ensure*] # (Optioanl) The state of the package. @@ -22,7 +22,7 @@ # # class cinder::scheduler ( - $scheduler_driver = '', + $scheduler_driver = $::os_service_default, $package_ensure = 'present', $enabled = true, $manage_service = true diff --git a/spec/classes/cinder_api_spec.rb b/spec/classes/cinder_api_spec.rb index a108640a..7bd4bd6e 100644 --- a/spec/classes/cinder_api_spec.rb +++ b/spec/classes/cinder_api_spec.rb @@ -6,8 +6,10 @@ describe 'cinder::api' do {:keystone_password => 'foo'} end let :facts do - {:osfamily => 'Debian', - :processorcount => 8 } + @default_facts.merge!({ + :osfamily => 'Debian', + :processorcount => 8 + }) end describe 'with only required params' do diff --git a/spec/classes/cinder_backup_nfs_spec.rb b/spec/classes/cinder_backup_nfs_spec.rb index 92bab079..d0146011 100644 --- a/spec/classes/cinder_backup_nfs_spec.rb +++ b/spec/classes/cinder_backup_nfs_spec.rb @@ -37,6 +37,8 @@ describe 'cinder::backup::nfs' do :backup_sha_block_size_bytes => 32768, :backup_enable_progress_timer => true, :backup_mount_point_base => '$state_path/backup_mount', + :backup_mount_options => '', + :backup_container => '', :backup_compression_algorithm => 'zlib', } end @@ -67,7 +69,7 @@ describe 'cinder::backup::nfs' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge!({:osfamily => 'Debian'}) end it_configures 'cinder backup with nfs' @@ -75,7 +77,7 @@ describe 'cinder::backup::nfs' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge!({:osfamily => 'RedHat'}) end it_configures 'cinder backup with nfs' diff --git a/spec/classes/cinder_db_spec.rb b/spec/classes/cinder_db_spec.rb index 06756a37..7b61a237 100644 --- a/spec/classes/cinder_db_spec.rb +++ b/spec/classes/cinder_db_spec.rb @@ -43,7 +43,7 @@ describe 'cinder::db' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge!({ :osfamily => 'Debian' }) end it_configures 'cinder::db' @@ -51,7 +51,7 @@ describe 'cinder::db' do context 'on Redhat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge!({ :osfamily => 'RedHat' }) end it_configures 'cinder::db' diff --git a/spec/classes/cinder_logging_spec.rb b/spec/classes/cinder_logging_spec.rb index f8ee7ee3..0bc39b2b 100644 --- a/spec/classes/cinder_logging_spec.rb +++ b/spec/classes/cinder_logging_spec.rb @@ -74,7 +74,7 @@ describe 'cinder::logging' do context 'on Debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge!({ :osfamily => 'Debian' }) end it_configures 'cinder-logging' @@ -82,7 +82,7 @@ describe 'cinder::logging' do context 'on RedHat platforms' do let :facts do - { :osfamily => 'RedHat' } + @default_facts.merge!({ :osfamily => 'RedHat' }) end it_configures 'cinder-logging' diff --git a/spec/classes/cinder_scheduler_spec.rb b/spec/classes/cinder_scheduler_spec.rb index 4416b3e3..491cc07d 100644 --- a/spec/classes/cinder_scheduler_spec.rb +++ b/spec/classes/cinder_scheduler_spec.rb @@ -5,7 +5,7 @@ describe 'cinder::scheduler' do describe 'on debian platforms' do let :facts do - { :osfamily => 'Debian' } + @default_facts.merge!({ :osfamily => 'Debian' }) end describe 'with default parameters' do diff --git a/spec/classes/cinder_spec.rb b/spec/classes/cinder_spec.rb index ae75df18..093948d0 100644 --- a/spec/classes/cinder_spec.rb +++ b/spec/classes/cinder_spec.rb @@ -9,7 +9,7 @@ describe 'cinder' do end let :facts do - {:osfamily => 'Debian'} + @default_facts.merge!({:osfamily => 'Debian'}) end describe 'with only required params' do diff --git a/spec/classes/cinder_volume_netapp_spec.rb b/spec/classes/cinder_volume_netapp_spec.rb index 8ccc8acb..fe336489 100644 --- a/spec/classes/cinder_volume_netapp_spec.rb +++ b/spec/classes/cinder_volume_netapp_spec.rb @@ -2,6 +2,10 @@ require 'spec_helper' describe 'cinder::volume::netapp' do + let :facts do + @default_facts.merge!({}) + end + let :params do { :netapp_login => 'netapp', diff --git a/spec/classes/cinder_volume_spec.rb b/spec/classes/cinder_volume_spec.rb index 63112372..a836d1b2 100644 --- a/spec/classes/cinder_volume_spec.rb +++ b/spec/classes/cinder_volume_spec.rb @@ -7,7 +7,7 @@ describe 'cinder::volume' do end let :facts do - {:osfamily => 'Debian'} + @default_facts.merge!({:osfamily => 'Debian'}) end it { is_expected.to contain_package('cinder-volume').with_ensure('present') } diff --git a/spec/defines/cinder_backend_netapp_spec.rb b/spec/defines/cinder_backend_netapp_spec.rb index 37d38f9f..d94986ea 100644 --- a/spec/defines/cinder_backend_netapp_spec.rb +++ b/spec/defines/cinder_backend_netapp_spec.rb @@ -4,6 +4,10 @@ describe 'cinder::backend::netapp' do let(:title) {'netapp'} + let :facts do + @default_facts.merge!({}) + end + let :params do { :volume_backend_name => 'netapp-cdot-nfs', diff --git a/spec/defines/cinder_backend_rbd_spec.rb b/spec/defines/cinder_backend_rbd_spec.rb index b0d54e4b..4cdb60b4 100644 --- a/spec/defines/cinder_backend_rbd_spec.rb +++ b/spec/defines/cinder_backend_rbd_spec.rb @@ -4,6 +4,10 @@ describe 'cinder::backend::rbd' do let(:title) {'rbd-ssd'} + let :facts do + @default_facts.merge!({}) + end + let :req_params do { :volume_backend_name => 'rbd-ssd', 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! }