Use oslo module to configure oslo related parameters
Configure database, logging and policy options using puppet-oslo module Change-Id: Ia7ed3484c0b3cce92728471cf70f6dc9a7ca3c6e
This commit is contained in:
@@ -118,29 +118,24 @@ class barbican::api::logging(
|
|||||||
$log_date_format = $::os_service_default,
|
$log_date_format = $::os_service_default,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if is_service_default($default_log_levels) {
|
oslo::log { 'barbican_config':
|
||||||
$default_log_levels_real = $default_log_levels
|
debug => $debug,
|
||||||
} else {
|
verbose => $verbose,
|
||||||
$default_log_levels_real = join(sort(join_keys_to_values($default_log_levels, '=')), ',')
|
use_syslog => $use_syslog,
|
||||||
|
use_stderr => $use_stderr,
|
||||||
|
log_dir => $log_dir,
|
||||||
|
syslog_log_facility => $log_facility,
|
||||||
|
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,
|
||||||
|
log_date_format => $log_date_format,
|
||||||
|
instance_uuid_format => $instance_uuid_format,
|
||||||
|
instance_format => $instance_format,
|
||||||
}
|
}
|
||||||
|
|
||||||
barbican_config {
|
|
||||||
'DEFAULT/debug': value => $debug;
|
|
||||||
'DEFAULT/verbose': value => $verbose;
|
|
||||||
'DEFAULT/use_stderr': value => $use_stderr;
|
|
||||||
'DEFAULT/use_syslog': value => $use_syslog;
|
|
||||||
'DEFAULT/log_dir': value => $log_dir;
|
|
||||||
'DEFAULT/syslog_log_facility': value => $log_facility;
|
|
||||||
'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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ class barbican::db (
|
|||||||
$database_max_overflow = $::os_service_default,
|
$database_max_overflow = $::os_service_default,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include ::barbican::params
|
|
||||||
|
|
||||||
$database_connection_real = pick($::barbican::database_connection, $database_connection)
|
$database_connection_real = pick($::barbican::database_connection, $database_connection)
|
||||||
$database_idle_timeout_real = pick($::barbican::database_idle_timeout, $database_idle_timeout)
|
$database_idle_timeout_real = pick($::barbican::database_idle_timeout, $database_idle_timeout)
|
||||||
$database_min_pool_size_real = pick($::barbican::database_min_pool_size, $database_min_pool_size)
|
$database_min_pool_size_real = pick($::barbican::database_min_pool_size, $database_min_pool_size)
|
||||||
@@ -56,44 +54,14 @@ class barbican::db (
|
|||||||
validate_re($database_connection_real,
|
validate_re($database_connection_real,
|
||||||
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
'^(sqlite|mysql(\+pymysql)?|postgresql):\/\/(\S+:\S+@\S+\/\S+)?')
|
||||||
|
|
||||||
case $database_connection_real {
|
oslo::db { 'barbican_config':
|
||||||
/^mysql(\+pymysql)?:\/\//: {
|
connection => $database_connection_real,
|
||||||
require 'mysql::bindings'
|
idle_timeout => $database_idle_timeout_real,
|
||||||
require 'mysql::bindings::python'
|
min_pool_size => $database_min_pool_size_real,
|
||||||
if $database_connection_real =~ /^mysql\+pymysql/ {
|
max_pool_size => $database_max_pool_size_real,
|
||||||
$backend_package = $::barbican::params::pymysql_package_name
|
max_retries => $database_max_retries_real,
|
||||||
} else {
|
retry_interval => $database_retry_interval_real,
|
||||||
$backend_package = false
|
max_overflow => $database_max_overflow_real,
|
||||||
}
|
|
||||||
}
|
|
||||||
/^postgresql:\/\//: {
|
|
||||||
$backend_package = false
|
|
||||||
require 'postgresql::lib::python'
|
|
||||||
}
|
|
||||||
/^sqlite:\/\//: {
|
|
||||||
$backend_package = $::barbican::params::sqlite_package_name
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
fail('Unsupported backend configured')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if $backend_package and !defined(Package[$backend_package]) {
|
|
||||||
package {'barbican-backend-package':
|
|
||||||
ensure => present,
|
|
||||||
name => $backend_package,
|
|
||||||
tag => 'openstack',
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
barbican_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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,22 +11,18 @@ class barbican::params {
|
|||||||
$worker_service_name = 'openstack-barbican-worker'
|
$worker_service_name = 'openstack-barbican-worker'
|
||||||
$client_package_name = 'python-barbicanclient'
|
$client_package_name = 'python-barbicanclient'
|
||||||
$barbican_wsgi_script_path = '/var/www/cgi-bin/barbican'
|
$barbican_wsgi_script_path = '/var/www/cgi-bin/barbican'
|
||||||
$sqlite_package_name = undef
|
|
||||||
$barbican_wsgi_script_source = '/usr/share/barbican/barbican.wsgi'
|
$barbican_wsgi_script_source = '/usr/share/barbican/barbican.wsgi'
|
||||||
$paste_config = '/etc/barbican/barbican-api-paste.ini'
|
$paste_config = '/etc/barbican/barbican-api-paste.ini'
|
||||||
$dogtag_client_package = 'pki-base'
|
$dogtag_client_package = 'pki-base'
|
||||||
$pymysql_package_name = undef
|
|
||||||
}
|
}
|
||||||
'Debian': {
|
'Debian': {
|
||||||
$package_name = 'openstack-barbican'
|
$package_name = 'openstack-barbican'
|
||||||
$service_name = 'openstack-barbican'
|
$service_name = 'openstack-barbican'
|
||||||
$client_package_name = 'python-barbicanclient'
|
$client_package_name = 'python-barbicanclient'
|
||||||
$barbican_wsgi_script_path = '/var/www/cgi-bin/barbican'
|
$barbican_wsgi_script_path = '/var/www/cgi-bin/barbican'
|
||||||
$sqlite_package_name = 'python-pysqlite2'
|
|
||||||
$barbican_wsgi_script_source = '/usr/share/barbican/barbican.wsgi'
|
$barbican_wsgi_script_source = '/usr/share/barbican/barbican.wsgi'
|
||||||
$paste_config = '/etc/barbican/barbican-api-paste.ini'
|
$paste_config = '/etc/barbican/barbican-api-paste.ini'
|
||||||
$dogtag_client_package = 'pki-base'
|
$dogtag_client_package = 'pki-base'
|
||||||
$pymysql_package_name = 'python-pymysql'
|
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
fail("Unsupported osfamily: ${::osfamily} operating system")
|
fail("Unsupported osfamily: ${::osfamily} operating system")
|
||||||
|
|||||||
@@ -36,4 +36,6 @@ class barbican::policy (
|
|||||||
|
|
||||||
create_resources('openstacklib::policy::base', $policies)
|
create_resources('openstacklib::policy::base', $policies)
|
||||||
|
|
||||||
|
oslo::policy { 'barbican_config': policy_file => $policy_path }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@
|
|||||||
"dependencies": [
|
"dependencies": [
|
||||||
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
|
{ "name": "puppetlabs/inifile", "version_requirement": ">=1.0.0 <2.0.0" },
|
||||||
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.2.0 <5.0.0" },
|
{ "name": "puppetlabs/stdlib", "version_requirement": ">= 4.2.0 <5.0.0" },
|
||||||
{ "name": "openstack/openstacklib", "version_requirement": ">=6.0.0 <7.0.0" }
|
{ "name": "openstack/openstacklib", "version_requirement": ">=8.0.0 <9.0.0" },
|
||||||
|
{ "name": "openstack/oslo", "version_requirement": "<9.0.0" }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ describe 'barbican::db' do
|
|||||||
|
|
||||||
context 'with default parameters' do
|
context 'with default parameters' do
|
||||||
|
|
||||||
it { is_expected.to contain_class('barbican::params') }
|
|
||||||
it { is_expected.to contain_barbican_config('database/connection').with_value('sqlite:////var/lib/barbican/barbican.sqlite') }
|
it { is_expected.to contain_barbican_config('database/connection').with_value('sqlite:////var/lib/barbican/barbican.sqlite') }
|
||||||
it { is_expected.to contain_barbican_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
it { is_expected.to contain_barbican_config('database/idle_timeout').with_value('<SERVICE DEFAULT>') }
|
||||||
it { is_expected.to contain_barbican_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
it { is_expected.to contain_barbican_config('database/min_pool_size').with_value('<SERVICE DEFAULT>') }
|
||||||
@@ -25,7 +24,6 @@ describe 'barbican::db' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.to contain_class('barbican::params') }
|
|
||||||
it { is_expected.to contain_barbican_config('database/connection').with_value('mysql+pymysql://barbican:barbican@localhost/barbican').with_secret(true) }
|
it { is_expected.to contain_barbican_config('database/connection').with_value('mysql+pymysql://barbican:barbican@localhost/barbican').with_secret(true) }
|
||||||
it { is_expected.to contain_barbican_config('database/idle_timeout').with_value('3601') }
|
it { is_expected.to contain_barbican_config('database/idle_timeout').with_value('3601') }
|
||||||
it { is_expected.to contain_barbican_config('database/min_pool_size').with_value('2') }
|
it { is_expected.to contain_barbican_config('database/min_pool_size').with_value('2') }
|
||||||
@@ -85,7 +83,7 @@ describe 'barbican::db' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'install the proper backend package' do
|
it 'install the proper backend package' do
|
||||||
is_expected.to contain_package('barbican-backend-package').with(
|
is_expected.to contain_package('db_backend_package').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:name => 'python-pysqlite2',
|
:name => 'python-pysqlite2',
|
||||||
:tag => 'openstack'
|
:tag => 'openstack'
|
||||||
@@ -100,7 +98,7 @@ describe 'barbican::db' do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it 'install the proper backend package' do
|
it 'install the proper backend package' do
|
||||||
is_expected.to contain_package('barbican-backend-package').with(
|
is_expected.to contain_package('db_backend_package').with(
|
||||||
:ensure => 'present',
|
:ensure => 'present',
|
||||||
:name => 'python-pymysql',
|
:name => 'python-pymysql',
|
||||||
:tag => 'openstack'
|
:tag => 'openstack'
|
||||||
@@ -123,7 +121,7 @@ describe 'barbican::db' do
|
|||||||
{ :database_connection => 'mysql+pymysql://barbican:barbican@localhost/barbican', }
|
{ :database_connection => 'mysql+pymysql://barbican:barbican@localhost/barbican', }
|
||||||
end
|
end
|
||||||
|
|
||||||
it { is_expected.not_to contain_package('barbican-backend-package') }
|
it { is_expected.not_to contain_package('db_backend_package') }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ describe 'barbican::policy' do
|
|||||||
:key => 'context_is_admin',
|
:key => 'context_is_admin',
|
||||||
:value => 'foo:bar'
|
:value => 'foo:bar'
|
||||||
})
|
})
|
||||||
|
is_expected.to contain_barbican_config('oslo_policy/policy_file').with_value('/etc/barbican/policy.json')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user