Merge "Add type definitions for log parameters"

This commit is contained in:
Zuul
2025-09-22 22:48:58 +00:00
committed by Gerrit Code Review
15 changed files with 141 additions and 104 deletions

View File

@@ -66,22 +66,22 @@
# Defaults to 'yes'
#
class swift::bench (
$auth_url = 'http://localhost:8080/auth/v1.0',
$swift_user = 'test:tester',
$swift_key = 'testing',
$auth_version = '1.0',
$log_level = 'INFO',
$test_timeout = '10',
$put_concurrency = '10',
$get_concurrency = '10',
$del_concurrency = '10',
$lower_object_size = '10',
$upper_object_size = '10',
$object_size = '1',
$num_objects = '1000',
$num_gets = '10000',
$num_containers = '20',
$delete = 'yes',
$auth_url = 'http://localhost:8080/auth/v1.0',
$swift_user = 'test:tester',
$swift_key = 'testing',
$auth_version = '1.0',
Swift::LogLevel $log_level = 'INFO',
$test_timeout = '10',
$put_concurrency = '10',
$get_concurrency = '10',
$del_concurrency = '10',
$lower_object_size = '10',
$upper_object_size = '10',
$object_size = '1',
$num_objects = '1000',
$num_gets = '10000',
$num_containers = '20',
$delete = 'yes',
) {
include swift::deps

View File

@@ -129,10 +129,10 @@ class swift::containerreconciler (
$cache_tls_cafile = $facts['os_service_default'],
$cache_tls_certfile = $facts['os_service_default'],
$cache_tls_keyfile = $facts['os_service_default'],
$log_name = 'container-reconciler',
$log_level = 'INFO',
$log_facility = 'LOG_LOCAL2',
$log_address = '/dev/log',
String[1] $log_name = 'container-reconciler',
Swift::LogLevel $log_level = 'INFO',
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
String[1] $log_address = '/dev/log',
$log_max_line_length = $facts['os_service_default'],
Boolean $purge_config = false,
) inherits swift::params {

View File

@@ -149,10 +149,10 @@ class swift::objectexpirer (
$cache_tls_cafile = $facts['os_service_default'],
$cache_tls_certfile = $facts['os_service_default'],
$cache_tls_keyfile = $facts['os_service_default'],
$log_name = 'object-expirer',
$log_level = 'INFO',
$log_facility = 'LOG_LOCAL2',
$log_address = '/dev/log',
String[1] $log_name = 'object-expirer',
Swift::LogLevel $log_level = 'INFO',
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
String[1] $log_address = '/dev/log',
$log_max_line_length = $facts['os_service_default'],
Boolean $purge_config = false,
# DEPRECATED PARAMETERS

View File

@@ -220,11 +220,11 @@ class swift::proxy (
$log_headers = $facts['os_service_default'],
$log_udp_host = $facts['os_service_default'],
$log_udp_port = $facts['os_service_default'],
$log_address = '/dev/log',
$log_level = 'INFO',
$log_facility = 'LOG_LOCAL2',
String[1] $log_address = '/dev/log',
Swift::LogLevel $log_level = 'INFO',
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
$log_handoffs = $facts['os_service_default'],
$log_name = 'proxy-server',
String[1] $log_name = 'proxy-server',
$log_max_line_length = $facts['os_service_default'],
$cors_allow_origin = $facts['os_service_default'],
$strict_cors_mode = $facts['os_service_default'],

View File

@@ -43,25 +43,34 @@
#
#
class swift::proxy::cname_lookup (
$log_name = $facts['os_service_default'],
$log_facility = $facts['os_service_default'],
$log_level = $facts['os_service_default'],
$log_headers = $facts['os_service_default'],
$log_address = $facts['os_service_default'],
$storage_domain = $facts['os_service_default'],
$lookup_depth = $facts['os_service_default'],
$nameservers = $facts['os_service_default'],
$log_name = $facts['os_service_default'],
Optional[Swift::LogFacility] $log_facility = undef,
Optional[Swift::LogLevel] $log_level = undef,
$log_headers = $facts['os_service_default'],
$log_address = $facts['os_service_default'],
$storage_domain = $facts['os_service_default'],
$lookup_depth = $facts['os_service_default'],
$nameservers = $facts['os_service_default'],
) {
include swift::deps
include swift::params
Package['python3-dnspython'] ~> Service<| tag == 'swift-proxy-service' |>
$log_facility_real = $log_facility ? {
undef => $facts['os_service_default'],
default => $log_facility,
}
$log_level_real = $log_level ? {
undef => $facts['os_service_default'],
default => $log_level,
}
swift_proxy_config {
'filter:cname_lookup/use': value => 'egg:swift#cname_lookup';
'filter:cname_lookup/set log_name': value => $log_name;
'filter:cname_lookup/set log_facility': value => $log_facility;
'filter:cname_lookup/set log_level': value => $log_level;
'filter:cname_lookup/set log_facility': value => $log_facility_real;
'filter:cname_lookup/set log_level': value => $log_level_real;
'filter:cname_lookup/set log_headers': value => $log_headers;
'filter:cname_lookup/set log_address': value => $log_address;
'filter:cname_lookup/storage_domain' : value => $storage_domain;

View File

@@ -68,26 +68,35 @@
#
#
class swift::proxy::domain_remap (
$log_name = $facts['os_service_default'],
$log_facility = $facts['os_service_default'],
$log_level = $facts['os_service_default'],
$log_headers = $facts['os_service_default'],
$log_address = $facts['os_service_default'],
$storage_domain = $facts['os_service_default'],
$path_root = $facts['os_service_default'],
$reseller_prefixes = $facts['os_service_default'],
$default_reseller_prefix = $facts['os_service_default'],
$mangle_client_paths = $facts['os_service_default'],
$log_name = $facts['os_service_default'],
Optional[Swift::LogFacility] $log_facility = undef,
Optional[Swift::LogLevel] $log_level = undef,
$log_headers = $facts['os_service_default'],
$log_address = $facts['os_service_default'],
$storage_domain = $facts['os_service_default'],
$path_root = $facts['os_service_default'],
$reseller_prefixes = $facts['os_service_default'],
$default_reseller_prefix = $facts['os_service_default'],
$mangle_client_paths = $facts['os_service_default'],
) {
include swift::deps
$reseller_prefixes_real = join(any2array($reseller_prefixes), ',')
$log_facility_real = $log_facility ? {
undef => $facts['os_service_default'],
default => $log_facility,
}
$log_level_real = $log_level ? {
undef => $facts['os_service_default'],
default => $log_level,
}
swift_proxy_config {
'filter:domain_remap/use': value => 'egg:swift#domain_remap';
'filter:domain_remap/set log_name': value => $log_name;
'filter:domain_remap/set log_facility': value => $log_facility;
'filter:domain_remap/set log_level': value => $log_level;
'filter:domain_remap/set log_facility': value => $log_facility_real;
'filter:domain_remap/set log_level': value => $log_level_real;
'filter:domain_remap/set log_headers': value => $log_headers;
'filter:domain_remap/set log_address': value => $log_address;
'filter:domain_remap/storage_domain' : value => $storage_domain;

View File

@@ -46,13 +46,13 @@
# Copyright 2014 UnitedStack licensing@unitedstack.com
#
class swift::proxy::gatekeeper (
$shunt_inbound_x_timestamp = $facts['os_service_default'],
$allow_reserved_names_header = $facts['os_service_default'],
$log_name = 'gatekeeper',
$log_facility = 'LOG_LOCAL2',
$log_level = 'INFO',
$log_headers = $facts['os_service_default'],
$log_address = '/dev/log'
$shunt_inbound_x_timestamp = $facts['os_service_default'],
$allow_reserved_names_header = $facts['os_service_default'],
$log_name = 'gatekeeper',
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
Swift::LogLevel $log_level = 'INFO',
$log_headers = $facts['os_service_default'],
$log_address = '/dev/log'
) {
include swift::deps

View File

@@ -142,39 +142,39 @@
#
class swift::storage::all (
$storage_local_net_ip,
$devices = '/srv/node',
$object_port = 6000,
$container_port = 6001,
$account_port = 6002,
$object_pipeline = undef,
$container_pipeline = undef,
$account_pipeline = undef,
$mount_check = true,
$log_facility = 'LOG_LOCAL2',
$log_level = 'INFO',
Boolean $log_name_per_daemon = false,
$log_udp_host = undef,
$log_udp_port = undef,
$log_requests = true,
$max_connections = 25,
$hosts_allow = undef,
$hosts_deny = undef,
$incoming_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
$outgoing_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
$statsd_enabled = false,
$log_statsd_host = 'localhost',
$log_statsd_port = $facts['os_service_default'],
$log_statsd_default_sample_rate = $facts['os_service_default'],
$log_statsd_sample_rate_factor = $facts['os_service_default'],
$log_statsd_metric_prefix = $facts['os_service_default'],
$account_server_workers = $facts['os_workers'],
$container_server_workers = $facts['os_workers'],
$object_server_workers = $facts['os_workers'],
$object_server_mb_per_sync = $facts['os_service_default'],
$rsync_timeout = $facts['os_service_default'],
$rsync_bwlimit = $facts['os_service_default'],
$splice = false,
$rsync_use_xinetd = $swift::params::xinetd_available,
$devices = '/srv/node',
$object_port = 6000,
$container_port = 6001,
$account_port = 6002,
$object_pipeline = undef,
$container_pipeline = undef,
$account_pipeline = undef,
$mount_check = true,
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
Swift::LogLevel $log_level = 'INFO',
Boolean $log_name_per_daemon = false,
$log_udp_host = undef,
$log_udp_port = undef,
$log_requests = true,
$max_connections = 25,
$hosts_allow = undef,
$hosts_deny = undef,
$incoming_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
$outgoing_chmod = 'Du=rwx,g=rx,o=rx,Fu=rw,g=r,o=r',
$statsd_enabled = false,
$log_statsd_host = 'localhost',
$log_statsd_port = $facts['os_service_default'],
$log_statsd_default_sample_rate = $facts['os_service_default'],
$log_statsd_sample_rate_factor = $facts['os_service_default'],
$log_statsd_metric_prefix = $facts['os_service_default'],
$account_server_workers = $facts['os_workers'],
$container_server_workers = $facts['os_workers'],
$object_server_workers = $facts['os_workers'],
$object_server_mb_per_sync = $facts['os_service_default'],
$rsync_timeout = $facts['os_service_default'],
$rsync_bwlimit = $facts['os_service_default'],
$splice = false,
$rsync_use_xinetd = $swift::params::xinetd_available,
) inherits swift::params {
include swift::deps

View File

@@ -110,10 +110,10 @@ class swift::storage::drive_audit (
$weekday = '*',
Integer[0] $maxdelay = 0,
# drive-audit.conf options
$log_facility = 'LOG_LOCAL2',
$log_level = 'INFO',
$log_address = '/dev/log',
$log_name = 'drive-audit',
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
Swift::LogLevel $log_level = 'INFO',
String[1] $log_address = '/dev/log',
String[1] $log_name = 'drive-audit',
$log_udp_host = $facts['os_service_default'],
$log_udp_port = $facts['os_service_default'],
$log_max_line_length = $facts['os_service_default'],

View File

@@ -329,10 +329,10 @@ define swift::storage::server (
$reaper_interval = $facts['os_service_default'],
$reaper_conn_timeout = $facts['os_service_default'],
$reaper_node_timeout = $facts['os_service_default'],
$log_facility = 'LOG_LOCAL2',
$log_level = 'INFO',
$log_address = '/dev/log',
$log_name = "${type}-server",
Swift::LogFacility $log_facility = 'LOG_LOCAL2',
Swift::LogLevel $log_level = 'INFO',
String[1] $log_address = '/dev/log',
String[1] $log_name = "${type}-server",
Boolean $log_name_per_daemon = false,
$log_udp_host = $facts['os_service_default'],
$log_udp_port = $facts['os_service_default'],

View File

@@ -23,7 +23,7 @@ describe 'swift::proxy::cname_lookup' do
{
:log_name => 'newcname_lookup',
:log_facility => 'LOG_LOCAL3',
:log_level => 'WARN',
:log_level => 'WARNING',
:log_headers => 'True',
:log_address => '/var/log',
:storage_domain => 'example.com',
@@ -34,7 +34,7 @@ describe 'swift::proxy::cname_lookup' do
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/set log_name').with_value('newcname_lookup') }
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/set log_facility').with_value('LOG_LOCAL3') }
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/set log_level').with_value('WARN') }
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/set log_level').with_value('WARNING') }
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/set log_headers').with_value('True') }
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/set log_address').with_value('/var/log') }
it { is_expected.to contain_swift_proxy_config('filter:cname_lookup/storage_domain').with_value('example.com') }

View File

@@ -21,7 +21,7 @@ describe 'swift::proxy::domain_remap' do
{
:log_name => 'newdomain_remap',
:log_facility => 'LOG_LOCAL3',
:log_level => 'WARN',
:log_level => 'WARNING',
:log_headers => 'True',
:log_address => '/var/log',
:storage_domain => 'example.com',
@@ -34,7 +34,7 @@ describe 'swift::proxy::domain_remap' do
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/set log_name').with_value('newdomain_remap') }
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/set log_facility').with_value('LOG_LOCAL3') }
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/set log_level').with_value('WARN') }
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/set log_level').with_value('WARNING') }
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/set log_headers').with_value('True') }
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/set log_address').with_value('/var/log') }
it { is_expected.to contain_swift_proxy_config('filter:domain_remap/storage_domain').with_value('example.com') }

View File

@@ -21,7 +21,7 @@ describe 'swift::proxy::gatekeeper' do
:log_name => 'newgatekeeper',
:log_headers => false,
:log_facility => 'LOG_LOCAL3',
:log_level => 'WARN',
:log_level => 'WARNING',
}
end
@@ -29,7 +29,7 @@ describe 'swift::proxy::gatekeeper' do
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/allow_reserved_names_header').with_value(false) }
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('newgatekeeper') }
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL3') }
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('WARN') }
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('WARNING') }
it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_headers').with_value(false) }
end
end

10
types/logfacility.pp Normal file
View File

@@ -0,0 +1,10 @@
type Swift::Logfacility = Enum[
'LOG_LOCAL0',
'LOG_LOCAL1',
'LOG_LOCAL2',
'LOG_LOCAL3',
'LOG_LOCAL4',
'LOG_LOCAL5',
'LOG_LOCAL6',
'LOG_LOCAL7',
]

9
types/loglevel.pp Normal file
View File

@@ -0,0 +1,9 @@
type Swift::LogLevel = Enum[
'DEBUG',
'INFO',
'WARNING',
'WARN',
'ERROR',
'CRITICAL',
'FATAL',
]