diff --git a/manifests/db.pp b/manifests/db.pp index 2a4ea7a4..2c6de99b 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -95,14 +95,14 @@ class heat::db ( } } - heat_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; + oslo::db { 'heat_config': + connection => $database_connection_real, + idle_timeout => $database_idle_timeout_real, + min_pool_size => $database_min_pool_size_real, + max_pool_size => $database_max_pool_size_real, + max_retries => $database_max_retries_real, + retry_interval => $database_retry_interval_real, + max_overflow => $database_max_overflow_real, } if $sync_db_real { diff --git a/manifests/init.pp b/manifests/init.pp index 067b9972..3bf6d825 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -359,51 +359,27 @@ class heat( } if $rpc_backend == 'rabbit' or is_service_default($rpc_backend) { - - if ! is_service_default($rabbit_hosts) and $rabbit_hosts { - heat_config { - 'oslo_messaging_rabbit/rabbit_hosts': value => join(any2array($rabbit_hosts), ','); - 'oslo_messaging_rabbit/rabbit_host': ensure => absent; - 'oslo_messaging_rabbit/rabbit_port': ensure => absent; - } - if size($rabbit_hosts) > 1 and is_service_default($rabbit_ha_queues) { - heat_config { - 'oslo_messaging_rabbit/rabbit_ha_queues': value => true; - } - } else { - heat_config { - 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues; - } - } - } else { - heat_config { - 'oslo_messaging_rabbit/rabbit_host': value => $rabbit_host; - 'oslo_messaging_rabbit/rabbit_port': value => $rabbit_port; - 'oslo_messaging_rabbit/rabbit_hosts': ensure => absent; - 'oslo_messaging_rabbit/rabbit_ha_queues': value => $rabbit_ha_queues; - } - } if $rabbit_heartbeat_timeout_threshold == 0 { warning('Default value for rabbit_heartbeat_timeout_threshold parameter is different from OpenStack project defaults') } - heat_config { - 'oslo_messaging_rabbit/rabbit_userid': value => $rabbit_userid; - 'oslo_messaging_rabbit/rabbit_password': value => $rabbit_password, secret => true; - 'oslo_messaging_rabbit/rabbit_virtual_host': value => $rabbit_virtual_host; - 'oslo_messaging_rabbit/heartbeat_timeout_threshold': value => $rabbit_heartbeat_timeout_threshold; - 'oslo_messaging_rabbit/heartbeat_rate': value => $rabbit_heartbeat_rate; - 'oslo_messaging_rabbit/rabbit_use_ssl': value => $rabbit_use_ssl; - 'oslo_messaging_rabbit/amqp_durable_queues': value => $amqp_durable_queues; - 'oslo_messaging_rabbit/kombu_ssl_ca_certs': value => $kombu_ssl_ca_certs; - 'oslo_messaging_rabbit/kombu_ssl_certfile': value => $kombu_ssl_certfile; - 'oslo_messaging_rabbit/kombu_ssl_keyfile': value => $kombu_ssl_keyfile; - 'oslo_messaging_rabbit/kombu_ssl_version': value => $kombu_ssl_version; + + oslo::messaging::rabbit { 'heat_config': + kombu_ssl_version => $kombu_ssl_version, + kombu_ssl_keyfile => $kombu_ssl_keyfile, + kombu_ssl_certfile => $kombu_ssl_certfile, + kombu_ssl_ca_certs => $kombu_ssl_ca_certs, + rabbit_userid => $rabbit_userid, + rabbit_password => $rabbit_password, + rabbit_virtual_host => $rabbit_virtual_host, + heartbeat_timeout_threshold => $rabbit_heartbeat_timeout_threshold, + heartbeat_rate => $rabbit_heartbeat_rate, + rabbit_use_ssl => $rabbit_use_ssl, + amqp_durable_queues => $amqp_durable_queues, + rabbit_host => $rabbit_host, + rabbit_port => $rabbit_port, + rabbit_hosts => $rabbit_hosts, + rabbit_ha_queues => $rabbit_ha_queues, } - - } - - if $rpc_backend == 'qpid' { - warning('Qpid driver is removed from Oslo.messaging in the Mitaka release') } if $auth_plugin { @@ -451,11 +427,8 @@ class heat( } heat_config { - 'DEFAULT/rpc_backend': value => $rpc_backend; - 'DEFAULT/rpc_response_timeout': value => $rpc_response_timeout; 'DEFAULT/max_template_size': value => $max_template_size; 'DEFAULT/max_json_body_size': value => $max_json_body_size; - 'DEFAULT/notification_driver': value => $notification_driver; 'DEFAULT/region_name_for_services': value => $region_name; 'DEFAULT/enable_stack_abandon': value => $enable_stack_abandon; 'DEFAULT/enable_stack_adopt': value => $enable_stack_adopt; @@ -463,6 +436,14 @@ class heat( 'paste_deploy/flavor': value => $flavor; } + oslo::messaging::notifications { 'heat_config': + driver => $notification_driver, + } + + oslo::messaging::default { 'heat_config': + rpc_response_timeout => $rpc_response_timeout, + } + # instance_user # special case for empty string since it's a valid value if $instance_user == '' { diff --git a/manifests/logging.pp b/manifests/logging.pp index 8efa890b..84efd0bd 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -121,30 +121,23 @@ class heat::logging( $verbose_real = pick($::heat::verbose,$verbose) $debug_real = pick($::heat::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, '=')), ',') + oslo::log { 'heat_config': + debug => $debug_real, + verbose => $verbose_real, + log_config_append => $log_config_append, + log_date_format => $log_date_format, + log_dir => $log_dir_real, + use_syslog => $use_syslog_real, + syslog_log_facility => $log_facility_real, + use_stderr => $use_stderr_real, + logging_context_format_string => $logging_context_format_string, + logging_default_format_string => $logging_default_format_string, + logging_debug_format_suffix => $logging_debug_format_suffix, + logging_exception_prefix => $logging_exception_prefix, + default_log_levels => $default_log_levels, + publish_errors => $publish_errors, + instance_format => $instance_format, + instance_uuid_format => $instance_uuid_format, + fatal_deprecations => $fatal_deprecations, } - - heat_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/syslog_log_facility': value => $log_facility_real; - 'DEFAULT/default_log_levels': value => $default_log_levels_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/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/metadata.json b/metadata.json index 62caa19d..26f7a558 100644 --- a/metadata.json +++ b/metadata.json @@ -34,6 +34,7 @@ { "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" }, { "name": "openstack/keystone", "version_requirement": ">=8.0.0 <9.0.0" }, { "name": "puppetlabs/stdlib", "version_requirement": ">=4.0.0 <5.0.0" }, - { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" } + { "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" }, + { "name": "openstack/puppet-oslo", "version_requirement": "<9.0.0" } ] } diff --git a/releasenotes/notes/switch_to_oslo-33725628dde94d4a.yaml b/releasenotes/notes/switch_to_oslo-33725628dde94d4a.yaml new file mode 100644 index 00000000..fc6923a0 --- /dev/null +++ b/releasenotes/notes/switch_to_oslo-33725628dde94d4a.yaml @@ -0,0 +1,4 @@ +--- +features: + - Switch to puppet-oslo resource usage (instead of + manual configuration file editing). diff --git a/spec/classes/heat_init_spec.rb b/spec/classes/heat_init_spec.rb index 6c264de4..453bda0b 100644 --- a/spec/classes/heat_init_spec.rb +++ b/spec/classes/heat_init_spec.rb @@ -122,7 +122,7 @@ describe 'heat' do it { is_expected.to contain_heat_config('paste_deploy/flavor').with_value('keystone') } it 'configures notification_driver' do - is_expected.to contain_heat_config('DEFAULT/notification_driver').with_value('') + is_expected.to contain_heat_config('oslo_messaging_notifications/driver').with_value('') end it_configures "with default auth method" @@ -144,7 +144,7 @@ describe 'heat' do end it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_host').with_value( params[:rabbit_host] ) } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_port').with_value( params[:rabbit_port] ) } - it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_hosts').with_ensure('absent') } + it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_hosts').with_value('') } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') } it { is_expected.to contain_heat_config('DEFAULT/rpc_response_timeout').with_value('') } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') } @@ -164,8 +164,8 @@ describe 'heat' do is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') end - it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') } - it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') } + it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_host').with_value('') } + it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_port').with_value('') } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('') } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/amqp_durable_queues').with_value('') } @@ -185,8 +185,8 @@ describe 'heat' do is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_timeout_threshold').with_value('0') is_expected.to contain_heat_config('oslo_messaging_rabbit/heartbeat_rate').with_value('') end - it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_host').with_ensure('absent') } - it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_port').with_ensure('absent') } + it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_host').with_value('') } + it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_port').with_value('') } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_hosts').with_value( params[:rabbit_hosts].join(',') ) } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/rabbit_ha_queues').with_value('true') } it { is_expected.to contain_heat_config('oslo_messaging_rabbit/amqp_durable_queues').with_value(true) } @@ -432,7 +432,7 @@ describe 'heat' do end it 'has notification_driver set when specified' do - is_expected.to contain_heat_config('DEFAULT/notification_driver').with_value('bar.foo.rpc_notifier') + is_expected.to contain_heat_config('oslo_messaging_notifications/driver').with_value('bar.foo.rpc_notifier') end end