Add parameter type validations
Some parameters accept only certain parameter types/values. This adds validations in parameter input to return sensible errors to users. Change-Id: Ie6c0cf7956c228fead74dcb59e94111402303a56
This commit is contained in:
@@ -89,27 +89,31 @@
|
|||||||
# Defaults to $facts['os_service_default']
|
# Defaults to $facts['os_service_default']
|
||||||
#
|
#
|
||||||
class swift::containerreconciler(
|
class swift::containerreconciler(
|
||||||
Boolean $manage_service = true,
|
Boolean $manage_service = true,
|
||||||
Boolean $enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
Swift::Pipeline $pipeline = ['catch_errors', 'proxy-logging', 'cache', 'proxy-server'],
|
Swift::Pipeline $pipeline = ['catch_errors', 'proxy-logging', 'cache', 'proxy-server'],
|
||||||
$interval = $facts['os_service_default'],
|
$interval = $facts['os_service_default'],
|
||||||
$concurrency = $facts['os_service_default'],
|
$concurrency = $facts['os_service_default'],
|
||||||
$process = $facts['os_service_default'],
|
$process = $facts['os_service_default'],
|
||||||
$processes = $facts['os_service_default'],
|
$processes = $facts['os_service_default'],
|
||||||
$reclaim_age = $facts['os_service_default'],
|
$reclaim_age = $facts['os_service_default'],
|
||||||
$request_tries = $facts['os_service_default'],
|
$request_tries = $facts['os_service_default'],
|
||||||
$service_provider = $::swift::params::service_provider,
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider,
|
||||||
$memcache_servers = ['127.0.0.1:11211'],
|
$memcache_servers = ['127.0.0.1:11211'],
|
||||||
$cache_tls_enabled = $facts['os_service_default'],
|
$cache_tls_enabled = $facts['os_service_default'],
|
||||||
$cache_tls_cafile = $facts['os_service_default'],
|
$cache_tls_cafile = $facts['os_service_default'],
|
||||||
$cache_tls_certfile = $facts['os_service_default'],
|
$cache_tls_certfile = $facts['os_service_default'],
|
||||||
$cache_tls_keyfile = $facts['os_service_default'],
|
$cache_tls_keyfile = $facts['os_service_default'],
|
||||||
) inherits swift::params {
|
) inherits swift::params {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
Swift_container_reconciler_config<||> ~> Service['swift-container-reconciler']
|
Swift_container_reconciler_config<||> ~> Service['swift-container-reconciler']
|
||||||
|
|
||||||
|
if $pipeline[-1] != 'proxy-server' {
|
||||||
|
fail('proxy-server must be the last element in pipeline')
|
||||||
|
}
|
||||||
|
|
||||||
# only add memcache servers if 'cache' is included in the pipeline
|
# only add memcache servers if 'cache' is included in the pipeline
|
||||||
if !empty(grep(any2array($pipeline), 'cache')) {
|
if !empty(grep(any2array($pipeline), 'cache')) {
|
||||||
|
|
||||||
|
@@ -102,10 +102,10 @@
|
|||||||
# Defaults to 'LOG_LOCAL2'.
|
# Defaults to 'LOG_LOCAL2'.
|
||||||
#
|
#
|
||||||
class swift::objectexpirer(
|
class swift::objectexpirer(
|
||||||
$manage_service = true,
|
Boolean $manage_service = true,
|
||||||
$enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$pipeline = ['catch_errors', 'proxy-logging', 'cache', 'proxy-server'],
|
Swift::Pipeline $pipeline = ['catch_errors', 'proxy-logging', 'cache', 'proxy-server'],
|
||||||
$concurrency = $facts['os_service_default'],
|
$concurrency = $facts['os_service_default'],
|
||||||
$expiring_objects_account_name = $facts['os_service_default'],
|
$expiring_objects_account_name = $facts['os_service_default'],
|
||||||
$interval = $facts['os_service_default'],
|
$interval = $facts['os_service_default'],
|
||||||
@@ -137,6 +137,10 @@ class swift::objectexpirer(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if $pipeline[-1] != 'proxy-server' {
|
||||||
|
fail('proxy-server must be the last element in pipeline')
|
||||||
|
}
|
||||||
|
|
||||||
# only add memcache servers if 'cache' is included in the pipeline
|
# only add memcache servers if 'cache' is included in the pipeline
|
||||||
if !empty(grep(any2array($pipeline), 'cache')) {
|
if !empty(grep(any2array($pipeline), 'cache')) {
|
||||||
|
|
||||||
|
@@ -152,38 +152,38 @@
|
|||||||
#
|
#
|
||||||
class swift::proxy(
|
class swift::proxy(
|
||||||
$proxy_local_net_ip,
|
$proxy_local_net_ip,
|
||||||
$port = '8080',
|
$port = '8080',
|
||||||
Swift::Pipeline $pipeline = [
|
Swift::Pipeline $pipeline = [
|
||||||
'catch_errors', 'gatekeeper', 'healthcheck', 'proxy-logging', 'cache',
|
'catch_errors', 'gatekeeper', 'healthcheck', 'proxy-logging', 'cache',
|
||||||
'listing_formats', 'tempauth', 'copy', 'proxy-logging', 'proxy-server'],
|
'listing_formats', 'tempauth', 'copy', 'proxy-logging', 'proxy-server'],
|
||||||
$workers = $facts['os_workers'],
|
$workers = $facts['os_workers'],
|
||||||
Boolean $allow_account_management = true,
|
Boolean $allow_account_management = true,
|
||||||
Boolean $account_autocreate = true,
|
Boolean $account_autocreate = true,
|
||||||
$log_headers = $facts['os_service_default'],
|
$log_headers = $facts['os_service_default'],
|
||||||
$log_udp_host = $facts['os_service_default'],
|
$log_udp_host = $facts['os_service_default'],
|
||||||
$log_udp_port = $facts['os_service_default'],
|
$log_udp_port = $facts['os_service_default'],
|
||||||
$log_address = '/dev/log',
|
$log_address = '/dev/log',
|
||||||
$log_level = 'INFO',
|
$log_level = 'INFO',
|
||||||
$log_facility = 'LOG_LOCAL2',
|
$log_facility = 'LOG_LOCAL2',
|
||||||
$log_handoffs = $facts['os_service_default'],
|
$log_handoffs = $facts['os_service_default'],
|
||||||
$log_name = 'proxy-server',
|
$log_name = 'proxy-server',
|
||||||
$cors_allow_origin = undef,
|
$cors_allow_origin = undef,
|
||||||
$strict_cors_mode = true,
|
$strict_cors_mode = true,
|
||||||
$object_chunk_size = $facts['os_service_default'],
|
$object_chunk_size = $facts['os_service_default'],
|
||||||
$client_chunk_size = $facts['os_service_default'],
|
$client_chunk_size = $facts['os_service_default'],
|
||||||
$max_containers_per_account = $facts['os_service_default'],
|
$max_containers_per_account = $facts['os_service_default'],
|
||||||
$max_containers_whitelist = $facts['os_service_default'],
|
$max_containers_whitelist = $facts['os_service_default'],
|
||||||
$read_affinity = undef,
|
$read_affinity = undef,
|
||||||
$write_affinity = undef,
|
$write_affinity = undef,
|
||||||
$write_affinity_node_count = $facts['os_service_default'],
|
$write_affinity_node_count = $facts['os_service_default'],
|
||||||
$client_timeout = $facts['os_service_default'],
|
$client_timeout = $facts['os_service_default'],
|
||||||
$node_timeout = $facts['os_service_default'],
|
$node_timeout = $facts['os_service_default'],
|
||||||
$recoverable_node_timeout = $facts['os_service_default'],
|
$recoverable_node_timeout = $facts['os_service_default'],
|
||||||
Boolean $manage_service = true,
|
Boolean $manage_service = true,
|
||||||
Boolean $enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$service_provider = $::swift::params::service_provider,
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider,
|
||||||
$purge_config = false,
|
Boolean $purge_config = false,
|
||||||
) inherits swift::params {
|
) inherits swift::params {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
@@ -42,14 +42,14 @@
|
|||||||
# (optional) Additional tag to be added to the service resource
|
# (optional) Additional tag to be added to the service resource
|
||||||
#
|
#
|
||||||
define swift::service(
|
define swift::service(
|
||||||
$os_family_service_name,
|
String[1] $os_family_service_name,
|
||||||
$config_file_name,
|
String[1] $config_file_name,
|
||||||
$service_ensure = undef,
|
$service_ensure = undef,
|
||||||
$enabled = true,
|
Boolean $enabled = true,
|
||||||
$service_provider = $::swift::params::service_provider,
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider,
|
||||||
$service_subscribe = undef,
|
$service_subscribe = undef,
|
||||||
$service_require = undef,
|
$service_require = undef,
|
||||||
$service_tag = undef,
|
Optional[String[1]] $service_tag = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
@@ -72,7 +72,7 @@ define swift::service(
|
|||||||
subscribe => $service_subscribe,
|
subscribe => $service_subscribe,
|
||||||
require => $service_require,
|
require => $service_require,
|
||||||
}
|
}
|
||||||
} elsif $service_provider == 'swiftinit' {
|
} else {
|
||||||
service { $name:
|
service { $name:
|
||||||
ensure => $service_ensure,
|
ensure => $service_ensure,
|
||||||
enable => $enabled,
|
enable => $enabled,
|
||||||
|
@@ -27,11 +27,11 @@
|
|||||||
# Defaults to $::swift::params::service_provider.
|
# Defaults to $::swift::params::service_provider.
|
||||||
#
|
#
|
||||||
class swift::storage::account(
|
class swift::storage::account(
|
||||||
$manage_service = true,
|
Boolean $manage_service = true,
|
||||||
$enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$config_file_name = 'account-server.conf',
|
String[1] $config_file_name = 'account-server.conf',
|
||||||
$service_provider = $::swift::params::service_provider
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider
|
||||||
) inherits swift::params {
|
) inherits swift::params {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
@@ -32,12 +32,12 @@
|
|||||||
# Defaults to $::swift::params::service_provider.
|
# Defaults to $::swift::params::service_provider.
|
||||||
#
|
#
|
||||||
class swift::storage::container(
|
class swift::storage::container(
|
||||||
$manage_service = true,
|
Boolean $manage_service = true,
|
||||||
$enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$allowed_sync_hosts = ['127.0.0.1'],
|
Array[String[1]] $allowed_sync_hosts = ['127.0.0.1'],
|
||||||
$config_file_name = 'container-server.conf',
|
String[1] $config_file_name = 'container-server.conf',
|
||||||
$service_provider = $::swift::params::service_provider
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider
|
||||||
) inherits swift::params {
|
) inherits swift::params {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
@@ -121,7 +121,7 @@ class swift::storage::drive_audit(
|
|||||||
$log_to_console = $facts['os_service_default'],
|
$log_to_console = $facts['os_service_default'],
|
||||||
$unmount_failed_device = $facts['os_service_default'],
|
$unmount_failed_device = $facts['os_service_default'],
|
||||||
Hash[String[1], String[1]] $regex_pattern = {},
|
Hash[String[1], String[1]] $regex_pattern = {},
|
||||||
$purge_config = false,
|
Boolean $purge_config = false,
|
||||||
) inherits swift::params {
|
) inherits swift::params {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
@@ -34,12 +34,12 @@
|
|||||||
# Requires Class[swift::storage]
|
# Requires Class[swift::storage]
|
||||||
#
|
#
|
||||||
define swift::storage::generic(
|
define swift::storage::generic(
|
||||||
Swift::StorageServerType $type = $name,
|
Swift::StorageServerType $type = $name,
|
||||||
Boolean $manage_service = true,
|
Boolean $manage_service = true,
|
||||||
Boolean $enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$config_file_name = "${name}-server.conf",
|
String[1] $config_file_name = "${name}-server.conf",
|
||||||
$service_provider = $::swift::params::service_provider
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
@@ -27,11 +27,11 @@
|
|||||||
# Defaults to $::swift::params::service_provider.
|
# Defaults to $::swift::params::service_provider.
|
||||||
#
|
#
|
||||||
class swift::storage::object(
|
class swift::storage::object(
|
||||||
$manage_service = true,
|
Boolean $manage_service = true,
|
||||||
$enabled = true,
|
Boolean $enabled = true,
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
$config_file_name = 'object-server.conf',
|
String[1] $config_file_name = 'object-server.conf',
|
||||||
$service_provider = $::swift::params::service_provider
|
Swift::ServiceProvider $service_provider = $::swift::params::service_provider
|
||||||
) inherits swift::params {
|
) inherits swift::params {
|
||||||
|
|
||||||
include swift::deps
|
include swift::deps
|
||||||
|
1
types/serviceprovider.pp
Normal file
1
types/serviceprovider.pp
Normal file
@@ -0,0 +1 @@
|
|||||||
|
type Swift::ServiceProvider = Optional[Enum['swiftinit', 'systemd']]
|
Reference in New Issue
Block a user