diff --git a/manifests/db.pp b/manifests/db.pp index 9a2a9fb2..9a3f53c4 100644 --- a/manifests/db.pp +++ b/manifests/db.pp @@ -35,16 +35,15 @@ # class trove::db ( $database_connection = 'sqlite:////var/lib/trove/trove.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, ) { include ::trove::deps - include ::trove::params # NOTE(spredzy): In order to keep backward compatibility we rely on the pick function # to use trove:: if trove::db:: isn't specified. @@ -59,46 +58,13 @@ class trove::db ( validate_re($database_connection_real, '^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?') - if $database_connection_real { - case $database_connection_real { - /^mysql(\+pymysql)?:\/\//: { - require 'mysql::bindings' - require 'mysql::bindings::python' - if $database_connection_real =~ /^mysql\+pymysql/ { - $backend_package = $::trove::params::pymysql_package_name - } else { - $backend_package = false - } - } - /^postgresql:\/\//: { - $backend_package = false - require 'postgresql::lib::python' - } - /^sqlite:\/\//: { - $backend_package = $::trove::params::sqlite_package_name - } - default: { - fail('Unsupported backend configured') - } - } - - if $backend_package and !defined(Package[$backend_package]) { - package {'trove-backend-package': - ensure => present, - name => $backend_package, - tag => ['openstack', 'trove-package'], - } - } - - trove_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 { 'trove_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 } - } diff --git a/manifests/logging.pp b/manifests/logging.pp index fca1d23c..9f8577c0 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -127,30 +127,24 @@ class trove::logging( $verbose_real = pick($::trove::api::verbose, $verbose) $debug_real = pick($::trove::api::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, '=')), ',') - } - - trove_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/log_file' : value => $log_file_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; + oslo::log { 'trove_config': + debug => $debug_real, + verbose => $verbose_real, + use_stderr => $use_stderr_real, + use_syslog => $use_syslog_real, + log_dir => $log_dir_real, + log_file => $log_file_real, + syslog_log_facility => $log_facility_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, + log_config_append => $log_config_append, + default_log_levels => $default_log_levels, + publish_errors => $publish_errors, + fatal_deprecations => $fatal_deprecations, + instance_format => $instance_format, + instance_uuid_format => $instance_uuid_format, + log_date_format => $log_date_format } } diff --git a/manifests/params.pp b/manifests/params.pp index 809f5d2f..71fad88e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -14,8 +14,6 @@ class trove::params { $guestagent_service_name = 'openstack-trove-guestagent' $taskmanager_package_name = 'openstack-trove-taskmanager' $taskmanager_service_name = 'openstack-trove-taskmanager' - $sqlite_package_name = undef - $pymysql_package_name = undef } 'Debian': { $client_package_name = 'python-troveclient' @@ -28,8 +26,6 @@ class trove::params { $guestagent_service_name = 'trove-guestagent' $taskmanager_package_name = 'trove-taskmanager' $taskmanager_service_name = 'trove-taskmanager' - $sqlite_package_name = 'python-pysqlite2' - $pymysql_package_name = 'python-pymysql' } default: { fail("Unsupported osfamily: ${::osfamily} operatingsystem") diff --git a/spec/classes/trove_db_spec.rb b/spec/classes/trove_db_spec.rb index c72624a8..c657034f 100644 --- a/spec/classes/trove_db_spec.rb +++ b/spec/classes/trove_db_spec.rb @@ -7,12 +7,12 @@ describe 'trove::db' do context 'with default parameters' do it { is_expected.to contain_trove_config('database/connection').with_value('sqlite:////var/lib/trove/trove.sqlite').with_secret(true) } - it { is_expected.to contain_trove_config('database/idle_timeout').with_value('3600') } - it { is_expected.to contain_trove_config('database/min_pool_size').with_value('1') } - it { is_expected.to contain_trove_config('database/max_pool_size').with_value('10') } - it { is_expected.to contain_trove_config('database/max_overflow').with_value('20') } - it { is_expected.to contain_trove_config('database/max_retries').with_value('10') } - it { is_expected.to contain_trove_config('database/retry_interval').with_value('10') } + it { is_expected.to contain_trove_config('database/idle_timeout').with_value('') } + it { is_expected.to contain_trove_config('database/min_pool_size').with_value('') } + it { is_expected.to contain_trove_config('database/max_pool_size').with_value('') } + it { is_expected.to contain_trove_config('database/max_overflow').with_value('') } + it { is_expected.to contain_trove_config('database/max_retries').with_value('') } + it { is_expected.to contain_trove_config('database/retry_interval').with_value('') } end @@ -90,10 +90,10 @@ describe 'trove::db' do end it 'install the proper backend package' do - is_expected.to contain_package('trove-backend-package').with( + is_expected.to contain_package('db_backend_package').with( :ensure => 'present', :name => 'python-pymysql', - :tag => ['openstack', 'trove-package'], + :tag => 'openstack', ) end end @@ -114,7 +114,7 @@ describe 'trove::db' do { :database_connection => 'mysql+pymysql://trove:trove@localhost/trove', } end - it { is_expected.not_to contain_package('trove-backend-package') } + it { is_expected.not_to contain_package('db_backend_package') } end end