Merge "Add syslog support to the glance module"
This commit is contained in:
commit
a1b2406c9c
@ -39,6 +39,8 @@
|
||||
# * enabled Whether to enable services. Optional. Defaults to true.
|
||||
# * sql_idle_timeout
|
||||
# * sql_connection db conection.
|
||||
# * use_syslog - Use syslog for logging.
|
||||
# * log_facility - Syslog facility to receive log lines.
|
||||
#
|
||||
class glance::api(
|
||||
$keystone_password,
|
||||
@ -63,7 +65,9 @@ class glance::api(
|
||||
$keystone_user = 'glance',
|
||||
$enabled = true,
|
||||
$sql_idle_timeout = '3600',
|
||||
$sql_connection = 'sqlite:///var/lib/glance/glance.sqlite'
|
||||
$sql_connection = 'sqlite:///var/lib/glance/glance.sqlite',
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
) inherits glance {
|
||||
|
||||
require keystone::python
|
||||
@ -186,6 +190,18 @@ class glance::api(
|
||||
}
|
||||
}
|
||||
|
||||
# Syslog
|
||||
if $use_syslog {
|
||||
glance_api_config {
|
||||
'DEFAULT/use_syslog' : value => true;
|
||||
'DEFAULT/syslog_log_facility' : value => $log_facility;
|
||||
}
|
||||
} else {
|
||||
glance_api_config {
|
||||
'DEFAULT/use_syslog': value => false;
|
||||
}
|
||||
}
|
||||
|
||||
file { ['/etc/glance/glance-api.conf',
|
||||
'/etc/glance/glance-api-paste.ini',
|
||||
'/etc/glance/glance-cache.conf']:
|
||||
|
@ -61,6 +61,15 @@
|
||||
# (optional) administrative user name to connect to keystone.
|
||||
# Defaults to 'glance'.
|
||||
#
|
||||
# [*use_syslog*]
|
||||
# (optional) Use syslog for logging.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*log_facility*]
|
||||
# (optional) Syslog facility to receive log lines.
|
||||
# Defaults to LOG_USER.
|
||||
#
|
||||
#
|
||||
# [*enabled*]
|
||||
# (optional) Should the service be enabled. Defaults to true.
|
||||
#
|
||||
@ -82,6 +91,8 @@ class glance::registry(
|
||||
$keystone_tenant = 'services',
|
||||
$keystone_user = 'glance',
|
||||
$pipeline = 'keystone',
|
||||
$use_syslog = false,
|
||||
$log_facility = 'LOG_USER',
|
||||
$enabled = true
|
||||
) inherits glance {
|
||||
|
||||
@ -169,6 +180,18 @@ class glance::registry(
|
||||
}
|
||||
}
|
||||
|
||||
# Syslog
|
||||
if $use_syslog {
|
||||
glance_registry_config {
|
||||
'DEFAULT/use_syslog': value => true;
|
||||
'DEFAULT/syslog_log_facility': value => $log_facility;
|
||||
}
|
||||
} else {
|
||||
glance_registry_config {
|
||||
'DEFAULT/use_syslog': value => false;
|
||||
}
|
||||
}
|
||||
|
||||
file { ['/etc/glance/glance-registry.conf',
|
||||
'/etc/glance/glance-registry-paste.ini']:
|
||||
}
|
||||
|
@ -207,4 +207,36 @@ describe 'glance::api' do
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with syslog disabled by default' do
|
||||
let :params do
|
||||
default_params
|
||||
end
|
||||
|
||||
it { should contain_glance_api_config('DEFAULT/use_syslog').with_value(false) }
|
||||
it { should_not contain_glance_api_config('DEFAULT/syslog_log_facility') }
|
||||
end
|
||||
|
||||
describe 'with syslog enabled' do
|
||||
let :params do
|
||||
default_params.merge({
|
||||
:use_syslog => 'true',
|
||||
})
|
||||
end
|
||||
|
||||
it { should contain_glance_api_config('DEFAULT/use_syslog').with_value(true) }
|
||||
it { should contain_glance_api_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
|
||||
end
|
||||
|
||||
describe 'with syslog enabled and custom settings' do
|
||||
let :params do
|
||||
default_params.merge({
|
||||
:use_syslog => 'true',
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
})
|
||||
end
|
||||
|
||||
it { should contain_glance_api_config('DEFAULT/use_syslog').with_value(true) }
|
||||
it { should contain_glance_api_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -187,4 +187,37 @@ describe 'glance::registry' do
|
||||
raise_error(Puppet::Error, /validate_re\(\): "#{auth_admin_prefix}" does not match/) }
|
||||
end
|
||||
end
|
||||
|
||||
describe 'with syslog disabled by default' do
|
||||
let :params do
|
||||
default_params
|
||||
end
|
||||
|
||||
it { should contain_glance_registry_config('DEFAULT/use_syslog').with_value(false) }
|
||||
it { should_not contain_glance_registry_config('DEFAULT/syslog_log_facility') }
|
||||
end
|
||||
|
||||
describe 'with syslog enabled' do
|
||||
let :params do
|
||||
default_params.merge({
|
||||
:use_syslog => 'true',
|
||||
})
|
||||
end
|
||||
|
||||
it { should contain_glance_registry_config('DEFAULT/use_syslog').with_value(true) }
|
||||
it { should contain_glance_registry_config('DEFAULT/syslog_log_facility').with_value('LOG_USER') }
|
||||
end
|
||||
|
||||
describe 'with syslog enabled and custom settings' do
|
||||
let :params do
|
||||
default_params.merge({
|
||||
:use_syslog => 'true',
|
||||
:log_facility => 'LOG_LOCAL0'
|
||||
})
|
||||
end
|
||||
|
||||
it { should contain_glance_registry_config('DEFAULT/use_syslog').with_value(true) }
|
||||
it { should contain_glance_registry_config('DEFAULT/syslog_log_facility').with_value('LOG_LOCAL0') }
|
||||
end
|
||||
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user