From 6ea1a2842a1e8bf9d7aedf6794d38421a73938ab Mon Sep 17 00:00:00 2001 From: Tobias Wolter Date: Tue, 21 Dec 2021 12:29:25 +0100 Subject: [PATCH] Type aliases for all the things * Introduces type aliases for (most) variables to do some error checking. * --- manifests/client.pp | 16 +-- manifests/client/client.pp | 109 ++++++++-------- manifests/client/director.pp | 50 ++++---- manifests/client/messages.pp | 38 +++--- manifests/console.pp | 8 +- manifests/console/console.pp | 44 +++---- manifests/console/director.pp | 40 +++--- manifests/director.pp | 44 +++---- manifests/director/catalog.pp | 40 +++--- manifests/director/client.pp | 82 ++++++------ manifests/director/console.pp | 32 +++-- manifests/director/counter.pp | 16 +-- manifests/director/director.pp | 102 ++++++++------- manifests/director/fileset.pp | 16 +-- manifests/director/job.pp | 172 +++++++++++++------------- manifests/director/jobdefs.pp | 172 +++++++++++++------------- manifests/director/messages.pp | 38 +++--- manifests/director/pool.pp | 68 +++++----- manifests/director/profile.pp | 28 ++--- manifests/director/schedule.pp | 12 +- manifests/director/storage.pp | 72 +++++------ manifests/init.pp | 55 ++++---- manifests/monitor.pp | 8 +- manifests/monitor/client.pp | 16 +-- manifests/monitor/director.pp | 14 +-- manifests/monitor/monitor.pp | 20 ++- manifests/monitor/storage.pp | 20 ++- manifests/profile/client.pp | 6 +- manifests/profile/director.pp | 10 +- manifests/profile/director/storage.pp | 4 +- manifests/profile/storage.pp | 8 +- manifests/storage.pp | 24 ++-- manifests/storage/autochanger.pp | 14 +-- manifests/storage/device.pp | 130 ++++++++++--------- manifests/storage/director.pp | 42 +++---- manifests/storage/messages.pp | 39 +++--- manifests/storage/ndmp.pp | 16 +-- manifests/storage/storage.pp | 110 ++++++++-------- manifests/webui.pp | 31 +++-- manifests/webui/director.pp | 10 +- spec/settings_helper.rb | 23 +++- types/address.pp | 8 ++ types/addresses.pp | 21 ++++ types/auth/protocol.pp | 9 ++ types/auth/type.pp | 8 ++ types/boolean.pp | 8 +- types/compression.pp | 19 +++ types/device/type.pp | 10 ++ types/encryptioncipher.pp | 14 +++ types/excludeitem.pp | 6 + types/filesetoptions.pp | 45 +++++++ types/includeitem.pp | 9 ++ types/iodirection.pp | 8 ++ types/job/level.pp | 13 ++ types/job/migrationtype.pp | 14 +++ types/job/replaceoption.pp | 9 ++ types/job/type.pp | 12 ++ types/label.pp | 8 ++ types/list.pp | 2 - types/list/directory.pp | 6 + types/list/resource.pp | 6 + types/list/string.pp | 3 + types/module/catalogconfig.pp | 15 +++ types/module/ensure.pp | 7 ++ types/pool.pp | 11 ++ types/resource.pp | 2 + types/signature.pp | 9 ++ types/size.pp | 4 + types/speed.pp | 4 + types/time.pp | 7 ++ types/verifyoptions.pp | 4 + 71 files changed, 1151 insertions(+), 949 deletions(-) create mode 100644 types/address.pp create mode 100644 types/addresses.pp create mode 100644 types/auth/protocol.pp create mode 100644 types/auth/type.pp create mode 100644 types/compression.pp create mode 100644 types/device/type.pp create mode 100644 types/encryptioncipher.pp create mode 100644 types/excludeitem.pp create mode 100644 types/filesetoptions.pp create mode 100644 types/includeitem.pp create mode 100644 types/iodirection.pp create mode 100644 types/job/level.pp create mode 100644 types/job/migrationtype.pp create mode 100644 types/job/replaceoption.pp create mode 100644 types/job/type.pp create mode 100644 types/label.pp delete mode 100644 types/list.pp create mode 100644 types/list/directory.pp create mode 100644 types/list/resource.pp create mode 100644 types/list/string.pp create mode 100644 types/module/catalogconfig.pp create mode 100644 types/module/ensure.pp create mode 100644 types/pool.pp create mode 100644 types/signature.pp create mode 100644 types/size.pp create mode 100644 types/speed.pp create mode 100644 types/time.pp create mode 100644 types/verifyoptions.pp diff --git a/manifests/client.pp b/manifests/client.pp index 49e842d..422e7bb 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -5,14 +5,14 @@ # This class will be automatically included when a resource is defined. # It is not intended to be used directly by external resources like node definitions or other modules. class bareos::client ( - $manage_service = $bareos::manage_service, - $manage_package = $bareos::manage_package, - $package_name = $bareos::client_package_name, - $package_ensure = $bareos::package_ensure, - $service_name = $bareos::client_service_name, - $service_ensure = $bareos::service_ensure, - $service_enable = $bareos::service_enable, - $config_dir = "${bareos::config_dir}/bareos-fd.d" + Boolean $manage_service = $bareos::manage_service, + Boolean $manage_package = $bareos::manage_package, + Variant[String, Array[String]] $package_name = $bareos::client_package_name, + String $package_ensure = $bareos::package_ensure, + String $service_name = $bareos::client_service_name, + String $service_ensure = $bareos::service_ensure, + Boolean $service_enable = $bareos::service_enable, + String $config_dir = "${bareos::config_dir}/bareos-fd.d" ) inherits bareos { include bareos::client::client diff --git a/manifests/client/client.pp b/manifests/client/client.pp index 6254e7a..234d0bf 100644 --- a/manifests/client/client.pp +++ b/manifests/client/client.pp @@ -286,7 +286,9 @@ # Required: false # # [*tls_dh_file*] -# Tls Dh File: Path to PEM encoded Diffie-Hellman parameter file. If this directive is specified, DH key exchange will be used for the ephemeral keying, allowing for forward secrecy of communications. +# Tls Dh File: Path to PEM encoded Diffie-Hellman parameter file. If this +# directive is specified, DH key exchange will be used for the ephemeral +# keying, allowing for forward secrecy of communications. # # Bareos Datatype: directory # Bareos Default: Not set @@ -307,14 +309,17 @@ # Required: false # # [*tls_require*] -# Tls Require: Without setting this to yes, Bareos can fall back to use unencryption connections. Enabling this implicietly sets "TLS Enable = yes". +# Tls Require: Without setting this to yes, Bareos can fall back to use +# unencryption connections. Enabling this implicietly sets "TLS Enable = yes". # # Bareos Datatype: boolean # Bareos Default: false # Required: false # # [*tls_verify_peer*] -# Tls Verify Peer: If disabled, all certificates signed by a known CA will be accepted. If enabled, the CN of a certificate must the Address or in the "TLS Allowed CN" list. +# Tls Verify Peer: If disabled, all certificates signed by a known CA will be +# accepted. If enabled, the CN of a certificate must the Address or in the +# "TLS Allowed CN" list. # # Bareos Datatype: boolean # Bareos Default: true @@ -335,63 +340,59 @@ # Required: false # class bareos::client::client ( - $ensure = present, - $absolute_job_timeout = undef, - $allow_bandwidth_bursting = undef, - $allowed_job_command = undef, - $allowed_script_dir = undef, - $always_use_lmdb = undef, - $compatible = undef, - $description = undef, - $fd_address = undef, - $fd_addresses = undef, - $fd_port = undef, - $fd_source_address = undef, - $heartbeat_interval = undef, - $lmdb_threshold = undef, - $log_timestamp_format = undef, - $maximum_bandwidth_per_job = undef, - $maximum_concurrent_jobs = undef, - $maximum_connections = undef, - $maximum_network_buffer_size = undef, - $messages = undef, - $name_client = 'bareos-fd', - $pid_directory = undef, - $pki_cipher = undef, - $pki_encryption = undef, - $pki_key_pair = undef, - $pki_master_key = undef, - $pki_signatures = undef, - $pki_signer = undef, - $plugin_directory = undef, - $plugin_names = undef, - $scripts_directory = undef, - $sd_connect_timeout = undef, - $secure_erase_command = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, - $ver_id = undef, - $working_directory = undef, + Bareos::Resource $name_client = 'bareos-fd', + Bareos::Module::Ensure $ensure = present, + Optional[Integer[0]] $absolute_job_timeout = undef, + Optional[Boolean] $allow_bandwidth_bursting = undef, + Optional[Bareos::List::String] $allowed_job_command = undef, + Optional[Bareos::List::Directory] $allowed_script_dir = undef, + Optional[Boolean] $always_use_lmdb = undef, + Optional[Boolean] $compatible = undef, + Optional[String] $description = undef, + Optional[Bareos::Address] $fd_address = undef, + Optional[Bareos::Addresses] $fd_addresses = undef, + Optional[Stdlib::Port] $fd_port = undef, + Optional[Bareos::Address] $fd_source_address = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[Integer[0]] $lmdb_threshold = undef, + Optional[String] $log_timestamp_format = undef, + Optional[Bareos::Speed] $maximum_bandwidth_per_job = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Integer[0]] $maximum_connections = undef, + Optional[Integer[0]] $maximum_network_buffer_size = undef, + Optional[Bareos::Resource] $messages = undef, + Optional[String] $pid_directory = undef, + Optional[Bareos::EncryptionCipher] $pki_cipher = undef, + Optional[Bareos::Boolean] $pki_encryption = undef, + Optional[String] $pki_key_pair = undef, + Optional[Bareos::List::Directory] $pki_master_key = undef, + Optional[Bareos::Boolean] $pki_signatures = undef, + Optional[Bareos::List::Directory] $pki_signer = undef, + Optional[String] $plugin_directory = undef, + Optional[String] $plugin_names = undef, + Optional[String] $scripts_directory = undef, + Optional[Bareos::Time] $sd_connect_timeout = undef, + Optional[String] $secure_erase_command = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, + Optional[String] $ver_id = undef, + Optional[String] $working_directory = undef, ) { include bareos::client $_resource = 'Client' $_resource_dir = 'client' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_messages = $messages ? { undef => undef, default => Bareos::Client::Messages[$messages] } diff --git a/manifests/client/director.pp b/manifests/client/director.pp index 1b18403..eebea95 100644 --- a/manifests/client/director.pp +++ b/manifests/client/director.pp @@ -163,39 +163,35 @@ # Required: false # define bareos::client::director ( - $ensure = present, - $address = undef, - $allowed_job_command = undef, - $allowed_script_dir = undef, - $connection_from_client_to_director = undef, - $connection_from_director_to_client = undef, - $description = undef, - $maximum_bandwidth_per_job = undef, - $monitor = undef, - $password = undef, - $port = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[Bareos::List::String] $allowed_job_command = undef, + Optional[Bareos::List::Directory] $allowed_script_dir = undef, + Optional[Bareos::Boolean] $connection_from_client_to_director = undef, + Optional[Bareos::Boolean] $connection_from_director_to_client = undef, + Optional[String] $description = undef, + Optional[Bareos::Speed] $maximum_bandwidth_per_job = undef, + Optional[Bareos::Boolean] $monitor = undef, + Optional[String] $password = undef, + Optional[Stdlib::Port] $port = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, ) { include bareos::client $_resource = 'Director' $_resource_dir = 'director' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/client/messages.pp b/manifests/client/messages.pp index e577ace..5855eb9 100644 --- a/manifests/client/messages.pp +++ b/manifests/client/messages.pp @@ -130,33 +130,29 @@ # Required: false # define bareos::client::messages ( - $ensure = present, - $append = undef, - $catalog = undef, - $console = undef, - $description = undef, - $director = undef, - $file = undef, - $mail = undef, - $mail_command = undef, - $mail_on_error = undef, - $mail_on_success = undef, - $operator = undef, - $operator_command = undef, - $stderr = undef, - $stdout = undef, - $syslog = undef, - $timestamp_format = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::List::String] $append = undef, + Optional[Bareos::List::String] $catalog = undef, + Optional[Bareos::List::String] $console = undef, + Optional[String] $description = undef, + Optional[Bareos::List::String] $director = undef, + Optional[Bareos::List::String] $file = undef, + Optional[Bareos::List::String] $mail = undef, + Optional[String] $mail_command = undef, + Optional[Bareos::List::String] $mail_on_error = undef, + Optional[Bareos::List::String] $mail_on_success = undef, + Optional[Bareos::List::String] $operator = undef, + Optional[String] $operator_command = undef, + Optional[Bareos::List::String] $stderr = undef, + Optional[Bareos::List::String] $stdout = undef, + Optional[Bareos::List::String] $syslog = undef, + Optional[String] $timestamp_format = undef, ) { include bareos::client $_resource = 'Messages' $_resource_dir = 'messages' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/console.pp b/manifests/console.pp index d5507fa..6059211 100644 --- a/manifests/console.pp +++ b/manifests/console.pp @@ -5,10 +5,10 @@ # This class will be automatically included when a resource is defined. # It is not intended to be used directly by external resources like node definitions or other modules. class bareos::console ( - $manage_package = $bareos::manage_package, - $package_name = $bareos::console_package_name, - $package_ensure = $bareos::package_ensure, - $config_dir = "${bareos::config_dir}/bconsole.d" + Boolean $manage_package = $bareos::manage_package, + Variant[String, Array[String]] $package_name = $bareos::console_package_name, + String $package_ensure = $bareos::package_ensure, + String $config_dir = "${bareos::config_dir}/bconsole.d" ) inherits bareos { if $manage_package { package { $package_name: diff --git a/manifests/console/console.pp b/manifests/console/console.pp index e40a9b5..bceb6bc 100644 --- a/manifests/console/console.pp +++ b/manifests/console/console.pp @@ -139,36 +139,32 @@ # Required: false # define bareos::console::console ( - $ensure = present, - $description = undef, - $director = undef, - $heartbeat_interval = undef, - $history_file = undef, - $history_length = undef, - $password = undef, - $rc_file = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $description = undef, + Optional[Bareos::Resource] $director = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[String] $history_file = undef, + Optional[Integer[0]] $history_length = undef, + Optional[String] $password = undef, + Optional[String] $rc_file = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, ) { include bareos::console $_resource = 'Console' $_resource_dir = 'console' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/console/director.pp b/manifests/console/director.pp index 17a6450..96e2e68 100644 --- a/manifests/console/director.pp +++ b/manifests/console/director.pp @@ -128,34 +128,30 @@ # Required: false # define bareos::console::director ( - $ensure = present, - $address = undef, - $description = undef, - $dir_port = undef, - $heartbeat_interval = undef, - $password = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[String] $description = undef, + Optional[Stdlib::Port] $dir_port = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[String] $password = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, ) { include bareos::console $_resource = 'Director' $_resource_dir = 'director' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/director.pp b/manifests/director.pp index 02ed04c..1b874d9 100644 --- a/manifests/director.pp +++ b/manifests/director.pp @@ -5,29 +5,29 @@ # This class will be automatically included when a resource is defined. # It is not intended to be used directly by external resources like node definitions or other modules. class bareos::director ( - $manage_service = $bareos::manage_service, - $manage_package = $bareos::manage_package, - $manage_database = $bareos::manage_database, - $package_name = $bareos::director_package_name, - $package_ensure = $bareos::package_ensure, - $service_name = $bareos::director_service_name, - $service_allow_restart = $bareos::director_service_allow_restart, - $service_ensure = $bareos::service_ensure, - $service_enable = $bareos::service_enable, - $config_dir = "${bareos::config_dir}/bareos-dir.d", + Boolean $manage_service = $bareos::manage_service, + Boolean $manage_package = $bareos::manage_package, + Boolean $manage_database = $bareos::manage_database, + Variant[String, Array[String]] $package_name = $bareos::director_package_name, + String $package_ensure = $bareos::package_ensure, + String $service_name = $bareos::director_service_name, + Boolean $service_allow_restart = $bareos::director_service_allow_restart, + String $service_ensure = $bareos::service_ensure, + Boolean $service_enable = $bareos::service_enable, + String $config_dir = "${bareos::config_dir}/bareos-dir.d", Array[String] $managed_dirs = $bareos::director_managed_dirs, - Hash $catalogs = {}, - Hash $clients = {}, - Hash $consoles = {}, - Hash $counters = {}, - Hash $filesets = {}, - Hash $jobs = {}, - Hash $jobdefs = {}, - Hash $messages = {}, - Hash $pools = {}, - Hash $profiles = {}, - Hash $schedules = {}, - Hash $storages = {}, + Hash $catalogs = {}, + Hash $clients = {}, + Hash $consoles = {}, + Hash $counters = {}, + Hash $filesets = {}, + Hash $jobs = {}, + Hash $jobdefs = {}, + Hash $messages = {}, + Hash $pools = {}, + Hash $profiles = {}, + Hash $schedules = {}, + Hash $storages = {}, ) inherits bareos { include bareos::director::director diff --git a/manifests/director/catalog.pp b/manifests/director/catalog.pp index eccb2f4..b717e92 100644 --- a/manifests/director/catalog.pp +++ b/manifests/director/catalog.pp @@ -127,34 +127,30 @@ # Required: false # define bareos::director::catalog ( - $ensure = present, - $db_address = undef, - $db_driver = undef, - $db_name = undef, - $db_password = undef, - $db_port = undef, - $db_socket = undef, - $db_user = undef, - $description = undef, - $disable_batch_insert = undef, - $exit_on_fatal = undef, - $idle_timeout = undef, - $inc_connections = undef, - $max_connections = undef, - $min_connections = undef, - $multiple_connections = undef, - $reconnect = undef, - $validate_timeout = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $db_address = undef, + Optional[String] $db_driver = undef, + Optional[String] $db_name = undef, + Optional[String] $db_password = undef, + Optional[Stdlib::Port] $db_port = undef, + Optional[String] $db_socket = undef, + Optional[String] $db_user = undef, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $disable_batch_insert = undef, + Optional[Bareos::Boolean] $exit_on_fatal = undef, + Optional[Integer[0]] $idle_timeout = undef, + Optional[Integer[0]] $inc_connections = undef, + Optional[Integer[0]] $max_connections = undef, + Optional[Integer[0]] $min_connections = undef, + Optional[Bareos::Boolean] $multiple_connections = undef, + Optional[Bareos::Boolean] $reconnect = undef, + Optional[Integer[0]] $validate_timeout = undef, ) { include bareos::director $_resource = 'Catalog' $_resource_dir = 'catalog' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/director/client.pp b/manifests/director/client.pp index d982106..878144b 100644 --- a/manifests/director/client.pp +++ b/manifests/director/client.pp @@ -275,55 +275,51 @@ # Required: false # define bareos::director::client ( - $ensure = present, - $address = undef, - $auth_type = undef, - $auto_prune = undef, - $catalog = undef, - $connection_from_client_to_director = undef, - $connection_from_director_to_client = undef, - $description = undef, - $enabled = undef, - $file_retention = undef, - $hard_quota = undef, - $heartbeat_interval = undef, - $job_retention = undef, - $maximum_bandwidth_per_job = undef, - $maximum_concurrent_jobs = undef, - $ndmp_block_size = undef, - $ndmp_log_level = undef, - $ndmp_use_lmdb = undef, - $passive = undef, - $password = undef, - $port = undef, - $protocol = undef, - $quota_include_failed_jobs = undef, - $soft_quota = undef, - $soft_quota_grace_period = undef, - $strict_quotas = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, - $username = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[Bareos::Auth::Type] $auth_type = undef, + Optional[Bareos::Boolean] $auto_prune = undef, + Optional[Bareos::Resource] $catalog = undef, + Optional[Bareos::Boolean] $connection_from_client_to_director = undef, + Optional[Bareos::Boolean] $connection_from_director_to_client = undef, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $enabled = undef, + Optional[Bareos::Time] $file_retention = undef, + Optional[Bareos::Size] $hard_quota = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[Bareos::Time] $job_retention = undef, + Optional[Bareos::Speed] $maximum_bandwidth_per_job = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Integer[0]] $ndmp_block_size = undef, + Optional[Integer[0]] $ndmp_log_level = undef, + Optional[Bareos::Boolean] $ndmp_use_lmdb = undef, + Optional[Bareos::Boolean] $passive = undef, + Optional[String] $password = undef, + Optional[Stdlib::Port] $port = undef, + Optional[Bareos::Auth::Protocol] $protocol = undef, + Optional[Bareos::Boolean] $quota_include_failed_jobs = undef, + Optional[Bareos::Size] $soft_quota = undef, + Optional[Bareos::Time] $soft_quota_grace_period = undef, + Optional[Bareos::Boolean] $strict_quotas = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, + Optional[String] $username = undef, ) { include bareos::director $_resource = 'Client' $_resource_dir = 'client' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_catalog = $catalog ? { undef => undef, default => Bareos::Director::Catalog[$catalog] } diff --git a/manifests/director/console.pp b/manifests/director/console.pp index f75af11..7553f4d 100644 --- a/manifests/director/console.pp +++ b/manifests/director/console.pp @@ -198,21 +198,21 @@ # Required: false # define bareos::director::console ( - Enum['present', 'absent'] $ensure = present, - Optional[Bareos::List] $catalog_acl = undef, - Optional[Bareos::List] $client_acl = undef, - Optional[Bareos::List] $command_acl = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::List::String] $catalog_acl = undef, + Optional[Bareos::List::String] $client_acl = undef, + Optional[Bareos::List::String] $command_acl = undef, Optional[String] $description = undef, - Optional[Bareos::List] $file_set_acl = undef, - Optional[Bareos::List] $job_acl = undef, + Optional[Bareos::List::String] $file_set_acl = undef, + Optional[Bareos::List::String] $job_acl = undef, Optional[String] $password = undef, - Optional[Bareos::List] $plugin_options_acl = undef, - Optional[Bareos::List] $pool_acl = undef, - Optional[Bareos::List] $profile = undef, - Optional[Bareos::List] $run_acl = undef, - Optional[Bareos::List] $schedule_acl = undef, - Optional[Bareos::List] $storage_acl = undef, - Optional[Bareos::List] $tls_allowed_cn = undef, + Optional[Bareos::List::String] $plugin_options_acl = undef, + Optional[Bareos::List::String] $pool_acl = undef, + Optional[Bareos::List::String] $profile = undef, + Optional[Bareos::List::String] $run_acl = undef, + Optional[Bareos::List::String] $schedule_acl = undef, + Optional[Bareos::List::String] $storage_acl = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, Optional[Bareos::Boolean] $tls_authenticate = undef, Optional[String] $tls_ca_certificate_dir = undef, Optional[String] $tls_ca_certificate_file = undef, @@ -225,17 +225,13 @@ Optional[Bareos::Boolean] $tls_require = undef, Optional[Bareos::Boolean] $tls_verify_peer = undef, Optional[Bareos::Boolean] $use_pam_authentication = undef, - Optional[Bareos::List] $where_acl = undef, + Optional[Bareos::List::String] $where_acl = undef, ) { include bareos::director $_resource = 'Console' $_resource_dir = 'console' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_profiles = $profile ? { undef => undef, default => Bareos::Director::Profile[$profile] } diff --git a/manifests/director/counter.pp b/manifests/director/counter.pp index 6ac45aa..6ce3838 100644 --- a/manifests/director/counter.pp +++ b/manifests/director/counter.pp @@ -42,22 +42,18 @@ # Required: false # define bareos::director::counter ( - $ensure = present, - $catalog = undef, - $description = undef, - $maximum = undef, - $minimum = undef, - $wrap_counter = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::Resource] $catalog = undef, + Optional[String] $description = undef, + Optional[Integer[0]] $maximum = undef, + Optional[Integer] $minimum = undef, + Optional[Bareos::Resource] $wrap_counter = undef, ) { include bareos::director $_resource = 'Counter' $_resource_dir = 'counter' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_catalog = $catalog ? { undef => undef, default => Bareos::Director::Catalog[$catalog] } diff --git a/manifests/director/director.pp b/manifests/director/director.pp index e085b10..2221cf8 100644 --- a/manifests/director/director.pp +++ b/manifests/director/director.pp @@ -347,65 +347,61 @@ # Required: false # class bareos::director::director ( - $ensure = present, - $absolute_job_timeout = undef, - $audit_events = undef, - $auditing = undef, - $backend_directory = undef, - $description = undef, - $dir_address = undef, - $dir_addresses = undef, - $dir_port = undef, - $dir_source_address = undef, - $fd_connect_timeout = undef, - $heartbeat_interval = undef, - $key_encryption_key = undef, - $log_timestamp_format = undef, - $maximum_concurrent_jobs = undef, - $maximum_connections = undef, - $maximum_console_connections = undef, - $messages = undef, - $name_director = 'bareos-dir', - $ndmp_log_level = undef, - $ndmp_snooping = undef, - $omit_defaults = undef, - $optimize_for_size = undef, - $optimize_for_speed = undef, - $password = 'PleaseChangeMe', - $pid_directory = undef, - $plugin_directory = undef, - $plugin_names = undef, - $query_file = '/usr/lib/bareos/scripts/query.sql', - $scripts_directory = undef, - $sd_connect_timeout = undef, - $secure_erase_command = undef, - $statistics_collect_interval = undef, - $statistics_retention = undef, - $subscriptions = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, - $ver_id = undef, - $working_directory = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Integer[0]] $absolute_job_timeout = undef, + Optional[Bareos::List::String] $audit_events = undef, + Optional[Bareos::Boolean] $auditing = undef, + Optional[Bareos::List::Directory] $backend_directory = undef, + Optional[String] $description = undef, + Optional[Bareos::Address] $dir_address = undef, + Optional[Bareos::Addresses] $dir_addresses = undef, + Optional[Stdlib::Port] $dir_port = undef, + Optional[Bareos::Address] $dir_source_address = undef, + Optional[Bareos::Time] $fd_connect_timeout = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[String] $key_encryption_key = undef, + Optional[String] $log_timestamp_format = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Integer[0]] $maximum_connections = undef, + Optional[Integer[0]] $maximum_console_connections = undef, + Optional[Bareos::Resource] $messages = undef, + Bareos::Resource $name_director = 'bareos-dir', + Optional[Integer[0]] $ndmp_log_level = undef, + Optional[Bareos::Boolean] $ndmp_snooping = undef, + Optional[Bareos::Boolean] $omit_defaults = undef, + Optional[Bareos::Boolean] $optimize_for_size = undef, + Optional[Bareos::Boolean] $optimize_for_speed = undef, + String $password = 'PleaseChangeMe', + Optional[String] $pid_directory = undef, + Optional[String] $plugin_directory = undef, + Optional[String] $plugin_names = undef, + String $query_file = '/usr/lib/bareos/scripts/query.sql', + Optional[String] $scripts_directory = undef, + Optional[Bareos::Time] $sd_connect_timeout = undef, + Optional[String] $secure_erase_command = undef, + Optional[Integer[0]] $statistics_collect_interval = undef, + Optional[Bareos::Time] $statistics_retention = undef, + Optional[Integer[0]] $subscriptions = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, + Optional[String] $ver_id = undef, + Optional[String] $working_directory = undef, ) { include bareos::director $_resource = 'Director' $_resource_dir = 'director' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_messages = $messages ? { undef => undef, default => Bareos::Director::Messages[$messages] } diff --git a/manifests/director/fileset.pp b/manifests/director/fileset.pp index 15df956..c9b03bb 100644 --- a/manifests/director/fileset.pp +++ b/manifests/director/fileset.pp @@ -42,22 +42,18 @@ # Required: false # define bareos::director::fileset ( - $ensure = present, - $description = undef, - $enable_vss = undef, - $exclude = undef, - $ignore_file_set_changes = undef, - $include = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $enable_vss = undef, + Optional[Bareos::ExcludeItem] $exclude = undef, + Optional[Bareos::Boolean] $ignore_file_set_changes = undef, + Optional[Bareos::IncludeItem] $include = undef, ) { include bareos::director $_resource = 'FileSet' $_resource_dir = 'fileset' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/director/job.pp b/manifests/director/job.pp index c17ef32..b3f6648 100644 --- a/manifests/director/job.pp +++ b/manifests/director/job.pp @@ -595,100 +595,96 @@ # Required: false # define bareos::director::job ( - $ensure = present, - $accurate = undef, - $add_prefix = undef, - $add_suffix = undef, - $allow_duplicate_jobs = undef, - $allow_higher_duplicates = undef, - $allow_mixed_priority = undef, - $always_incremental = undef, - $always_incremental_job_retention = undef, - $always_incremental_keep_number = undef, - $always_incremental_max_full_age = undef, - $backup_format = undef, - $base = undef, - $bootstrap = undef, - $cancel_lower_level_duplicates = undef, - $cancel_queued_duplicates = undef, - $cancel_running_duplicates = undef, - $catalog = undef, - $client = undef, - $client_run_after_job = undef, - $client_run_before_job = undef, - $description = undef, - $differential_backup_pool = undef, - $differential_max_runtime = undef, - $dir_plugin_options = undef, - $enabled = undef, - $fd_plugin_options = undef, - $file_history_size = undef, - $file_set = undef, - $full_backup_pool = undef, - $full_max_runtime = undef, - $incremental_backup_pool = undef, - $incremental_max_runtime = undef, - $job_defs = undef, - $job_to_verify = undef, - $level = undef, - $max_concurrent_copies = undef, - $max_diff_interval = undef, - $max_full_consolidations = undef, - $max_full_interval = undef, - $max_run_sched_time = undef, - $max_run_time = undef, - $max_start_delay = undef, - $max_virtual_full_interval = undef, - $max_wait_time = undef, - $maximum_bandwidth = undef, - $maximum_concurrent_jobs = undef, - $messages = undef, - $next_pool = undef, - $pool = undef, - $prefer_mounted_volumes = undef, - $prefix_links = undef, - $priority = undef, - $protocol = undef, - $prune_files = undef, - $prune_jobs = undef, - $prune_volumes = undef, - $purge_migration_job = undef, - $regex_where = undef, - $replace = undef, - $rerun_failed_levels = undef, - $reschedule_interval = undef, - $reschedule_on_error = undef, - $reschedule_times = undef, - $run = undef, - $run_after_failed_job = undef, - $run_after_job = undef, - $run_before_job = undef, - $run_script = undef, - $save_file_history = undef, - $schedule_res = undef, - $sd_plugin_options = undef, - $selection_pattern = undef, - $selection_type = undef, - $spool_attributes = undef, - $spool_data = undef, - $spool_size = undef, - $storage = undef, - $strip_prefix = undef, - $type = undef, - $virtual_full_backup_pool = undef, - $where = undef, - $write_bootstrap = undef, - $write_verify_list = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::Boolean] $accurate = undef, + Optional[String] $add_prefix = undef, + Optional[String] $add_suffix = undef, + Optional[Bareos::Boolean] $allow_duplicate_jobs = undef, + Optional[Bareos::Boolean] $allow_higher_duplicates = undef, + Optional[Bareos::Boolean] $allow_mixed_priority = undef, + Optional[Bareos::Boolean] $always_incremental = undef, + Optional[Bareos::Time] $always_incremental_job_retention = undef, + Optional[Integer[0]] $always_incremental_keep_number = undef, + Optional[Bareos::Time] $always_incremental_max_full_age = undef, + Optional[String] $backup_format = undef, + Optional[Bareos::List::Resource] $base = undef, + Optional[String] $bootstrap = undef, + Optional[Bareos::Boolean] $cancel_lower_level_duplicates = undef, + Optional[Bareos::Boolean] $cancel_queued_duplicates = undef, + Optional[Bareos::Boolean] $cancel_running_duplicates = undef, + Optional[Bareos::Resource] $catalog = undef, + Optional[Bareos::Resource] $client = undef, + Optional[Bareos::List::String] $client_run_after_job = undef, + Optional[Bareos::List::String] $client_run_before_job = undef, + Optional[String] $description = undef, + Optional[Bareos::Resource] $differential_backup_pool = undef, + Optional[Bareos::Time] $differential_max_runtime = undef, + Optional[Bareos::List::String] $dir_plugin_options = undef, + Optional[Bareos::Boolean] $enabled = undef, + Optional[Bareos::List::String] $fd_plugin_options = undef, + Optional[Bareos::Size] $file_history_size = undef, + Optional[Bareos::Resource] $file_set = undef, + Optional[Bareos::Resource] $full_backup_pool = undef, + Optional[Bareos::Time] $full_max_runtime = undef, + Optional[Bareos::Resource] $incremental_backup_pool = undef, + Optional[Bareos::Time] $incremental_max_runtime = undef, + Optional[Bareos::Resource] $job_defs = undef, + Optional[Bareos::Resource] $job_to_verify = undef, + Optional[Bareos::Job::Level] $level = undef, + Optional[Integer[0]] $max_concurrent_copies = undef, + Optional[Bareos::Time] $max_diff_interval = undef, + Optional[Integer[0]] $max_full_consolidations = undef, + Optional[Bareos::Time] $max_full_interval = undef, + Optional[Bareos::Time] $max_run_sched_time = undef, + Optional[Bareos::Time] $max_run_time = undef, + Optional[Bareos::Time] $max_start_delay = undef, + Optional[Bareos::Time] $max_virtual_full_interval = undef, + Optional[Bareos::Time] $max_wait_time = undef, + Optional[Bareos::Speed] $maximum_bandwidth = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Bareos::Resource] $messages = undef, + Optional[Bareos::Resource] $next_pool = undef, + Optional[Bareos::Resource] $pool = undef, + Optional[Bareos::Boolean] $prefer_mounted_volumes = undef, + Optional[Bareos::Boolean] $prefix_links = undef, + Optional[Integer[0]] $priority = undef, + Optional[Bareos::Auth::Protocol] $protocol = undef, + Optional[Bareos::Boolean] $prune_files = undef, + Optional[Bareos::Boolean] $prune_jobs = undef, + Optional[Bareos::Boolean] $prune_volumes = undef, + Optional[Bareos::Boolean] $purge_migration_job = undef, + Optional[String] $regex_where = undef, + Optional[Bareos::Job::ReplaceOption] $replace = undef, + Optional[Bareos::Boolean] $rerun_failed_levels = undef, + Optional[Bareos::Time] $reschedule_interval = undef, + Optional[Bareos::Boolean] $reschedule_on_error = undef, + Optional[Integer[0]] $reschedule_times = undef, + Optional[Bareos::List::String] $run = undef, + Optional[Bareos::List::String] $run_after_failed_job = undef, + Optional[Bareos::List::String] $run_after_job = undef, + Optional[Bareos::List::String] $run_before_job = undef, + Optional[Hash] $run_script = undef, + Optional[Bareos::Boolean] $save_file_history = undef, + Optional[Bareos::Resource] $schedule_res = undef, + Optional[Bareos::List::String] $sd_plugin_options = undef, + Optional[String] $selection_pattern = undef, + Optional[Bareos::Job::MigrationType] $selection_type = undef, + Optional[Bareos::Boolean] $spool_attributes = undef, + Optional[Bareos::Boolean] $spool_data = undef, + Optional[Bareos::Size] $spool_size = undef, + Optional[Bareos::List::Resource] $storage = undef, + Optional[String] $strip_prefix = undef, + Optional[Bareos::Job::Type] $type = undef, + Optional[Bareos::Resource] $virtual_full_backup_pool = undef, + Optional[String] $where = undef, + Optional[String] $write_bootstrap = undef, + Optional[String] $write_verify_list = undef, ) { include bareos::director $_resource = 'Job' $_resource_dir = 'job' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { # this can be specified in an jobdef or not, do not check here if jobdef is used if $job_defs != undef { diff --git a/manifests/director/jobdefs.pp b/manifests/director/jobdefs.pp index cdb5787..f8a0c79 100644 --- a/manifests/director/jobdefs.pp +++ b/manifests/director/jobdefs.pp @@ -594,100 +594,96 @@ # Required: false # define bareos::director::jobdefs ( - $ensure = present, - $accurate = undef, - $add_prefix = undef, - $add_suffix = undef, - $allow_duplicate_jobs = undef, - $allow_higher_duplicates = undef, - $allow_mixed_priority = undef, - $always_incremental = undef, - $always_incremental_job_retention = undef, - $always_incremental_keep_number = undef, - $always_incremental_max_full_age = undef, - $backup_format = undef, - $base = undef, - $bootstrap = undef, - $cancel_lower_level_duplicates = undef, - $cancel_queued_duplicates = undef, - $cancel_running_duplicates = undef, - $catalog = undef, - $client = undef, - $client_run_after_job = undef, - $client_run_before_job = undef, - $description = undef, - $differential_backup_pool = undef, - $differential_max_runtime = undef, - $dir_plugin_options = undef, - $enabled = undef, - $fd_plugin_options = undef, - $file_history_size = undef, - $file_set = undef, - $full_backup_pool = undef, - $full_max_runtime = undef, - $incremental_backup_pool = undef, - $incremental_max_runtime = undef, - $job_defs = undef, - $job_to_verify = undef, - $level = undef, - $max_concurrent_copies = undef, - $max_diff_interval = undef, - $max_full_consolidations = undef, - $max_full_interval = undef, - $max_run_sched_time = undef, - $max_run_time = undef, - $max_start_delay = undef, - $max_virtual_full_interval = undef, - $max_wait_time = undef, - $maximum_bandwidth = undef, - $maximum_concurrent_jobs = undef, - $messages = undef, - $next_pool = undef, - $pool = undef, - $prefer_mounted_volumes = undef, - $prefix_links = undef, - $priority = undef, - $protocol = undef, - $prune_files = undef, - $prune_jobs = undef, - $prune_volumes = undef, - $purge_migration_job = undef, - $regex_where = undef, - $replace = undef, - $rerun_failed_levels = undef, - $reschedule_interval = undef, - $reschedule_on_error = undef, - $reschedule_times = undef, - $run = undef, - $run_after_failed_job = undef, - $run_after_job = undef, - $run_before_job = undef, - $run_script = undef, - $save_file_history = undef, - $schedule_res = undef, - $sd_plugin_options = undef, - $selection_pattern = undef, - $selection_type = undef, - $spool_attributes = undef, - $spool_data = undef, - $spool_size = undef, - $storage = undef, - $strip_prefix = undef, - $type = undef, - $virtual_full_backup_pool = undef, - $where = undef, - $write_bootstrap = undef, - $write_verify_list = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::Boolean] $accurate = undef, + Optional[String] $add_prefix = undef, + Optional[String] $add_suffix = undef, + Optional[Bareos::Boolean] $allow_duplicate_jobs = undef, + Optional[Bareos::Boolean] $allow_higher_duplicates = undef, + Optional[Bareos::Boolean] $allow_mixed_priority = undef, + Optional[Bareos::Boolean] $always_incremental = undef, + Optional[Bareos::Time] $always_incremental_job_retention = undef, + Optional[Integer[0]] $always_incremental_keep_number = undef, + Optional[Bareos::Time] $always_incremental_max_full_age = undef, + Optional[String] $backup_format = undef, + Optional[Bareos::List::Resource] $base = undef, + Optional[String] $bootstrap = undef, + Optional[Bareos::Boolean] $cancel_lower_level_duplicates = undef, + Optional[Bareos::Boolean] $cancel_queued_duplicates = undef, + Optional[Bareos::Boolean] $cancel_running_duplicates = undef, + Optional[Bareos::Resource] $catalog = undef, + Optional[Bareos::Resource] $client = undef, + Optional[Bareos::List::String] $client_run_after_job = undef, + Optional[Bareos::List::String] $client_run_before_job = undef, + Optional[String] $description = undef, + Optional[Bareos::Resource] $differential_backup_pool = undef, + Optional[Bareos::Time] $differential_max_runtime = undef, + Optional[Bareos::List::String] $dir_plugin_options = undef, + Optional[Bareos::Boolean] $enabled = undef, + Optional[Bareos::List::String] $fd_plugin_options = undef, + Optional[Bareos::Size] $file_history_size = undef, + Optional[Bareos::Resource] $file_set = undef, + Optional[Bareos::Resource] $full_backup_pool = undef, + Optional[Bareos::Time] $full_max_runtime = undef, + Optional[Bareos::Resource] $incremental_backup_pool = undef, + Optional[Bareos::Time] $incremental_max_runtime = undef, + Optional[Bareos::Resource] $job_defs = undef, + Optional[Bareos::Resource] $job_to_verify = undef, + Optional[Bareos::Job::Level] $level = undef, + Optional[Integer[0]] $max_concurrent_copies = undef, + Optional[Bareos::Time] $max_diff_interval = undef, + Optional[Integer[0]] $max_full_consolidations = undef, + Optional[Bareos::Time] $max_full_interval = undef, + Optional[Bareos::Time] $max_run_sched_time = undef, + Optional[Bareos::Time] $max_run_time = undef, + Optional[Bareos::Time] $max_start_delay = undef, + Optional[Bareos::Time] $max_virtual_full_interval = undef, + Optional[Bareos::Time] $max_wait_time = undef, + Optional[Bareos::Speed] $maximum_bandwidth = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Bareos::Resource] $messages = undef, + Optional[Bareos::Resource] $next_pool = undef, + Optional[Bareos::Resource] $pool = undef, + Optional[Bareos::Boolean] $prefer_mounted_volumes = undef, + Optional[Bareos::Boolean] $prefix_links = undef, + Optional[Integer[0]] $priority = undef, + Optional[Bareos::Auth::Protocol] $protocol = undef, + Optional[Bareos::Boolean] $prune_files = undef, + Optional[Bareos::Boolean] $prune_jobs = undef, + Optional[Bareos::Boolean] $prune_volumes = undef, + Optional[Bareos::Boolean] $purge_migration_job = undef, + Optional[String] $regex_where = undef, + Optional[Bareos::Job::ReplaceOption] $replace = undef, + Optional[Bareos::Boolean] $rerun_failed_levels = undef, + Optional[Bareos::Time] $reschedule_interval = undef, + Optional[Bareos::Boolean] $reschedule_on_error = undef, + Optional[Integer[0]] $reschedule_times = undef, + Optional[Bareos::List::String] $run = undef, + Optional[Bareos::List::String] $run_after_failed_job = undef, + Optional[Bareos::List::String] $run_after_job = undef, + Optional[Bareos::List::String] $run_before_job = undef, + Optional[Hash] $run_script = undef, + Optional[Bareos::Boolean] $save_file_history = undef, + Optional[Bareos::Resource] $schedule_res = undef, + Optional[Bareos::List::String] $sd_plugin_options = undef, + Optional[String] $selection_pattern = undef, + Optional[Bareos::Job::MigrationType] $selection_type = undef, + Optional[Bareos::Boolean] $spool_attributes = undef, + Optional[Bareos::Boolean] $spool_data = undef, + Optional[Bareos::Size] $spool_size = undef, + Optional[Bareos::List::Resource] $storage = undef, + Optional[String] $strip_prefix = undef, + Optional[Bareos::Job::Type] $type = undef, + Optional[Bareos::Resource] $virtual_full_backup_pool = undef, + Optional[String] $where = undef, + Optional[String] $write_bootstrap = undef, + Optional[String] $write_verify_list = undef, ) { include bareos::director $_resource = 'JobDefs' $_resource_dir = 'jobdefs' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { # set various resource dependencies $_require_res_catalog = $catalog ? { undef => undef, default => Bareos::Director::Catalog[$catalog] } diff --git a/manifests/director/messages.pp b/manifests/director/messages.pp index e08e1cf..f996928 100644 --- a/manifests/director/messages.pp +++ b/manifests/director/messages.pp @@ -131,33 +131,29 @@ # Required: false # define bareos::director::messages ( - $ensure = present, - $append = undef, - $catalog = undef, - $console = undef, - $description = undef, - $director = undef, - $file = undef, - $mail = undef, - $mail_command = undef, - $mail_on_error = undef, - $mail_on_success = undef, - $operator = undef, - $operator_command = undef, - $stderr = undef, - $stdout = undef, - $syslog = undef, - $timestamp_format = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::List::String] $append = undef, + Optional[Bareos::List::String] $catalog = undef, + Optional[Bareos::List::String] $console = undef, + Optional[String] $description = undef, + Optional[Bareos::List::String] $director = undef, + Optional[Bareos::List::String] $file = undef, + Optional[Bareos::List::String] $mail = undef, + Optional[String] $mail_command = undef, + Optional[Bareos::List::String] $mail_on_error = undef, + Optional[Bareos::List::String] $mail_on_success = undef, + Optional[Bareos::List::String] $operator = undef, + Optional[String] $operator_command = undef, + Optional[Bareos::List::String] $stderr = undef, + Optional[Bareos::List::String] $stdout = undef, + Optional[Bareos::List::String] $syslog = undef, + Optional[String] $timestamp_format = undef, ) { include bareos::director $_resource = 'Messages' $_resource_dir = 'messages' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/director/pool.pp b/manifests/director/pool.pp index c92f9e9..28342ec 100644 --- a/manifests/director/pool.pp +++ b/manifests/director/pool.pp @@ -227,48 +227,44 @@ # Required: false # define bareos::director::pool ( - $ensure = present, - $action_on_purge = undef, - $auto_prune = undef, - $catalog = undef, - $catalog_files = undef, - $cleaning_prefix = undef, - $description = undef, - $file_retention = undef, - $job_retention = undef, - $label_format = undef, - $label_type = undef, - $maximum_block_size = undef, - $maximum_volume_bytes = undef, - $maximum_volume_files = undef, - $maximum_volume_jobs = undef, - $maximum_volumes = undef, - $migration_high_bytes = undef, - $migration_low_bytes = undef, - $migration_time = undef, - $minimum_block_size = undef, - $next_pool = undef, - $pool_type = undef, - $purge_oldest_volume = undef, - $recycle = undef, - $recycle_current_volume = undef, - $recycle_oldest_volume = undef, - $recycle_pool = undef, - $scratch_pool = undef, - $storage = undef, - $use_catalog = undef, - $volume_retention = undef, - $volume_use_duration = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Enum['truncate']] $action_on_purge = undef, + Optional[Bareos::Boolean] $auto_prune = undef, + Optional[Bareos::Resource] $catalog = undef, + Optional[Bareos::Boolean] $catalog_files = undef, + Optional[String] $cleaning_prefix = undef, + Optional[String] $description = undef, + Optional[Bareos::Time] $file_retention = undef, + Optional[Bareos::Time] $job_retention = undef, + Optional[String] $label_format = undef, + Optional[Bareos::Label] $label_type = undef, + Optional[Integer[0]] $maximum_block_size = undef, + Optional[Bareos::Size] $maximum_volume_bytes = undef, + Optional[Integer[0]] $maximum_volume_files = undef, + Optional[Integer[0]] $maximum_volume_jobs = undef, + Optional[Integer[0]] $maximum_volumes = undef, + Optional[Bareos::Size] $migration_high_bytes = undef, + Optional[Bareos::Size] $migration_low_bytes = undef, + Optional[Bareos::Time] $migration_time = undef, + Optional[Integer[0]] $minimum_block_size = undef, + Optional[Bareos::Resource] $next_pool = undef, + Optional[Bareos::Pool] $pool_type = undef, + Optional[Bareos::Boolean] $purge_oldest_volume = undef, + Optional[Bareos::Boolean] $recycle = undef, + Optional[Bareos::Boolean] $recycle_current_volume = undef, + Optional[Bareos::Boolean] $recycle_oldest_volume = undef, + Optional[Bareos::Resource] $recycle_pool = undef, + Optional[Bareos::Resource] $scratch_pool = undef, + Optional[Bareos::List::Resource] $storage = undef, + Optional[Bareos::Boolean] $use_catalog = undef, + Optional[Bareos::Time] $volume_retention = undef, + Optional[Bareos::Time] $volume_use_duration = undef, ) { include bareos::director $_resource = 'Pool' $_resource_dir = 'pool' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { # set various resource dependencies $_require_res_catalog = $catalog ? { undef => undef, default => Bareos::Director::Catalog[$catalog] } diff --git a/manifests/director/profile.pp b/manifests/director/profile.pp index 8fb99cf..1a6d48b 100644 --- a/manifests/director/profile.pp +++ b/manifests/director/profile.pp @@ -84,28 +84,24 @@ # Required: false # define bareos::director::profile ( - $ensure = present, - $catalog_acl = undef, - $client_acl = undef, - $command_acl = undef, - $description = undef, - $file_set_acl = undef, - $job_acl = undef, - $plugin_options_acl = undef, - $pool_acl = undef, - $schedule_acl = undef, - $storage_acl = undef, - $where_acl = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::List::String] $catalog_acl = undef, + Optional[Bareos::List::String] $client_acl = undef, + Optional[Bareos::List::String] $command_acl = undef, + Optional[String] $description = undef, + Optional[Bareos::List::String] $file_set_acl = undef, + Optional[Bareos::List::String] $job_acl = undef, + Optional[Bareos::List::String] $plugin_options_acl = undef, + Optional[Bareos::List::String] $pool_acl = undef, + Optional[Bareos::List::String] $schedule_acl = undef, + Optional[Bareos::List::String] $storage_acl = undef, + Optional[Bareos::List::String] $where_acl = undef, ) { include bareos::director $_resource = 'Profile' $_resource_dir = 'profile' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/director/schedule.pp b/manifests/director/schedule.pp index 74d9bed..0479556 100644 --- a/manifests/director/schedule.pp +++ b/manifests/director/schedule.pp @@ -31,20 +31,16 @@ # Required: false # define bareos::director::schedule ( - $ensure = present, - $description = undef, - $enabled = undef, - $run = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $enabled = undef, + Optional[Bareos::List::String] $run = undef, ) { include bareos::director $_resource = 'Schedule' $_resource_dir = 'schedule' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/director/storage.pp b/manifests/director/storage.pp index 1c6cda6..8fd4419 100644 --- a/manifests/director/storage.pp +++ b/manifests/director/storage.pp @@ -240,50 +240,46 @@ # Required: false # define bareos::director::storage ( - $ensure = present, - $address = undef, - $allow_compression = undef, - $auth_type = undef, - $auto_changer = undef, - $cache_status_interval = undef, - $changer_device = undef, - $collect_statistics = undef, - $description = undef, - $device = undef, - $enabled = undef, - $heartbeat_interval = undef, - $maximum_bandwidth_per_job = undef, - $maximum_concurrent_jobs = undef, - $maximum_concurrent_read_jobs = undef, - $media_type = undef, - $paired_storage = undef, - $password = undef, - $port = undef, - $protocol = undef, - $tape_device = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, - $username = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[Bareos::Boolean] $allow_compression = undef, + Optional[Bareos::Auth::Type] $auth_type = undef, + Optional[Bareos::Boolean] $auto_changer = undef, + Optional[Bareos::Time] $cache_status_interval = undef, + Optional[String] $changer_device = undef, + Optional[Bareos::Boolean] $collect_statistics = undef, + Optional[String] $description = undef, + Optional[Bareos::List::Resource] $device = undef, + Optional[Bareos::Boolean] $enabled = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[Bareos::Speed] $maximum_bandwidth_per_job = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Integer[0]] $maximum_concurrent_read_jobs = undef, + Optional[String] $media_type = undef, + Optional[Bareos::Resource] $paired_storage = undef, + Optional[String] $password = undef, + Optional[Stdlib::Port] $port = undef, + Optional[Bareos::Auth::Protocol] $protocol = undef, + Optional[Bareos::List::String] $tape_device = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, + Optional[String] $username = undef, ) { include bareos::director $_resource = 'Storage' $_resource_dir = 'storage' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_storage = $paired_storage ? { undef => undef, default => Bareos::Director::Storage[$paired_storage] } diff --git a/manifests/init.pp b/manifests/init.pp index dd85ab2..16ed641 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -32,36 +32,35 @@ # Whether puppet is allowed to restart the director service. If not it will reload # class bareos ( - $config_dir = $bareos::params::config_dir, - $config_dir_webui = $bareos::params::config_dir_webui, - $file_owner = $bareos::params::file_owner, - $file_group = $bareos::params::file_group, - $file_mode = $bareos::params::file_mode, - $file_dir_mode = $bareos::params::file_dir_mode, - String $repo_release = '20', - Boolean $repo_subscription = false, + String $config_dir = $bareos::params::config_dir, + String $config_dir_webui = $bareos::params::config_dir_webui, + String $file_owner = $bareos::params::file_owner, + String $file_group = $bareos::params::file_group, + String $file_mode = $bareos::params::file_mode, + String $file_dir_mode = $bareos::params::file_dir_mode, + String $repo_release = '20', + Boolean $repo_subscription = false, Optional[String[1]] $repo_username = undef, Optional[String[1]] $repo_password = undef, - Boolean $manage_package = true, - Boolean $manage_service = true, - Boolean $manage_database = true, - String $package_ensure = present, - String $service_ensure = running, - Boolean $service_enable = true, - Boolean $manage_repo = true, - Boolean $manage_user = true, - String $package_name = 'bareos-common', - - $console_package_name = $bareos::params::console_package_name, - $monitor_package_name = $bareos::params::monitor_package_name, - $director_package_name = $bareos::params::director_package_name, - $director_service_name = $bareos::params::director_service_name, - $director_service_allow_restart = false, - $director_managed_dirs = $bareos::params::director_managed_dirs, - $client_package_name = $bareos::params::client_package_name, - $client_service_name = $bareos::params::client_service_name, - $storage_package_name = $bareos::params::storage_package_name, - $storage_service_name = $bareos::params::storage_service_name, + Boolean $manage_package = true, + Boolean $manage_service = true, + Boolean $manage_database = true, + String $package_ensure = present, + String $service_ensure = running, + Boolean $service_enable = true, + Boolean $manage_repo = true, + Boolean $manage_user = true, + Variant[String, Array[String]] $package_name = 'bareos-common', + Variant[String, Array[String]] $console_package_name = $bareos::params::console_package_name, + Variant[String, Array[String]] $monitor_package_name = $bareos::params::monitor_package_name, + Variant[String, Array[String]] $director_package_name = $bareos::params::director_package_name, + String $director_service_name = $bareos::params::director_service_name, + Boolean $director_service_allow_restart = false, + Array[String] $director_managed_dirs = $bareos::params::director_managed_dirs, + Variant[String, Array[String]] $client_package_name = $bareos::params::client_package_name, + String $client_service_name = $bareos::params::client_service_name, + Variant[String, Array[String]] $storage_package_name = $bareos::params::storage_package_name, + String $storage_service_name = $bareos::params::storage_service_name, ) inherits bareos::params { if $manage_repo { class { 'bareos::repository': diff --git a/manifests/monitor.pp b/manifests/monitor.pp index a1a967d..4158d74 100644 --- a/manifests/monitor.pp +++ b/manifests/monitor.pp @@ -5,10 +5,10 @@ # This class will be automatically included when a resource is defined. # It is not intended to be used directly by external resources like node definitions or other modules. class bareos::monitor ( - $manage_package = $bareos::manage_package, - $package_name = $bareos::monitor_package_name, - $package_ensure = $bareos::package_ensure, - $config_dir = "${bareos::config_dir}/tray-monitor.d" + Boolean $manage_package = $bareos::manage_package, + Variant[String, Array[String]] $package_name = $bareos::monitor_package_name, + String $package_ensure = $bareos::package_ensure, + String $config_dir = "${bareos::config_dir}/tray-monitor.d" ) inherits bareos { if $manage_package { package { $package_name: diff --git a/manifests/monitor/client.pp b/manifests/monitor/client.pp index e5ca2c9..4c18744 100644 --- a/manifests/monitor/client.pp +++ b/manifests/monitor/client.pp @@ -41,22 +41,18 @@ # Required: true # define bareos::monitor::client ( - $ensure = present, - $address = undef, - $description = undef, - $enable_ssl = undef, - $fd_port = undef, - $password = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $enable_ssl = undef, + Optional[Stdlib::Port] $fd_port = undef, + Optional[String] $password = undef, ) { include bareos::monitor $_resource = 'Client' $_resource_dir = 'client' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/monitor/director.pp b/manifests/monitor/director.pp index 4091d91..1901f6d 100644 --- a/manifests/monitor/director.pp +++ b/manifests/monitor/director.pp @@ -34,21 +34,17 @@ # Required: false # define bareos::monitor::director ( - $ensure = present, - $address = undef, - $description = undef, - $dir_port = undef, - $enable_ssl = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[String] $description = undef, + Optional[Stdlib::Port] $dir_port = undef, + Optional[Bareos::Boolean] $enable_ssl = undef, ) { include bareos::monitor $_resource = 'Director' $_resource_dir = 'director' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/monitor/monitor.pp b/manifests/monitor/monitor.pp index 8fa52f9..c4f06c8 100644 --- a/manifests/monitor/monitor.pp +++ b/manifests/monitor/monitor.pp @@ -57,24 +57,20 @@ # Required: false # define bareos::monitor::monitor ( - $ensure = present, - $description = undef, - $dir_connect_timeout = undef, - $fd_connect_timeout = undef, - $password = undef, - $refresh_interval = undef, - $require_ssl = undef, - $sd_connect_timeout = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $description = undef, + Optional[Bareos::Time] $dir_connect_timeout = undef, + Optional[Bareos::Time] $fd_connect_timeout = undef, + Optional[String] $password = undef, + Optional[Bareos::Time] $refresh_interval = undef, + Optional[Bareos::Boolean] $require_ssl = undef, + Optional[Bareos::Time] $sd_connect_timeout = undef, ) { include bareos::monitor $_resource = 'Monitor' $_resource_dir = 'monitor' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/monitor/storage.pp b/manifests/monitor/storage.pp index 834dcf3..020d3a4 100644 --- a/manifests/monitor/storage.pp +++ b/manifests/monitor/storage.pp @@ -55,24 +55,20 @@ # Required: false # define bareos::monitor::storage ( - $ensure = present, - $address = undef, - $description = undef, - $enable_ssl = undef, - $password = undef, - $sd_address = undef, - $sd_password = undef, - $sd_port = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $address = undef, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $enable_ssl = undef, + Optional[String] $password = undef, + Optional[String] $sd_address = undef, + Optional[String] $sd_password = undef, + Optional[Stdlib::Port] $sd_port = undef, ) { include bareos::monitor $_resource = 'Storage' $_resource_dir = 'storage' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/profile/client.pp b/manifests/profile/client.pp index 134bf51..c551cc0 100644 --- a/manifests/profile/client.pp +++ b/manifests/profile/client.pp @@ -1,9 +1,9 @@ # == Class: bareos::profile::client # setup an simple bareos filedaemon/client class bareos::profile::client ( - $name_client = $facts['networking']['fqdn'], - $name_dir = 'bareos-dir', - $password = 'MyClientPasswordPleaseChange', + Bareos::Resource $name_client = $facts['networking']['fqdn'], + Bareos::Resource $name_dir = 'bareos-dir', + String $password = 'MyClientPasswordPleaseChange', ) { # default client class { 'bareos::client::client': diff --git a/manifests/profile/director.pp b/manifests/profile/director.pp index 374f368..21b82ee 100644 --- a/manifests/profile/director.pp +++ b/manifests/profile/director.pp @@ -1,14 +1,14 @@ # == Class: bareos::profile::director # Ready to use director with default configs class bareos::profile::director ( - $password = 'MyDirectorPasswordPleaseChange', - $name_dir = 'bareos-dir', - $catalog_conf = { + String $password = 'MyDirectorPasswordPleaseChange', + Bareos::Resource $name_dir = 'bareos-dir', + Bareos::Module::CatalogConfig $catalog_conf = { 'db_driver' => 'sqlite3', 'db_name' => 'bareos_mycatalog', }, - $storage_address = 'localhost', - $storage_password = 'BareosStoragePleaseChangeMe', + String $storage_address = 'localhost', + String $storage_password = 'BareosStoragePleaseChangeMe', ) { # ensure bconsole is installed and can connect to director ::bareos::console::director { $name_dir: diff --git a/manifests/profile/director/storage.pp b/manifests/profile/director/storage.pp index 3e9227e..f0b48a2 100644 --- a/manifests/profile/director/storage.pp +++ b/manifests/profile/director/storage.pp @@ -1,8 +1,8 @@ # == Class: bareos::profile::director::storage # Default storage daemon class bareos::profile::director::storage ( - $address = 'localhost', - $password = 'BareosStoragePleaseChangeMe', + String $address = 'localhost', + String $password = 'BareosStoragePleaseChangeMe', ) { ::bareos::director::storage { 'File': address => $address, diff --git a/manifests/profile/storage.pp b/manifests/profile/storage.pp index 320a734..849aca3 100644 --- a/manifests/profile/storage.pp +++ b/manifests/profile/storage.pp @@ -1,10 +1,10 @@ # == Class: bareos::profile::storage # class bareos::profile::storage ( - $name_storage = 'bareos-sd', - $name_dir = 'bareos-dir', - $password = 'BareosStoragePleaseChangeMe', - $archive_device = '/var/lib/bareos/storage', + Bareos::Resource $name_storage = 'bareos-sd', + Bareos::Resource $name_dir = 'bareos-dir', + String $password = 'BareosStoragePleaseChangeMe', + String $archive_device = '/var/lib/bareos/storage', ) { class { 'bareos::storage::storage': name_storage => $name_storage, diff --git a/manifests/storage.pp b/manifests/storage.pp index 9b00507..ad12dc4 100644 --- a/manifests/storage.pp +++ b/manifests/storage.pp @@ -5,19 +5,19 @@ # This class will be automatically included when a resource is defined. # It is not intended to be used directly by external resources like node definitions or other modules. class bareos::storage ( - $manage_service = $bareos::manage_service, - $manage_package = $bareos::manage_package, - $package_name = $bareos::storage_package_name, - $package_ensure = $bareos::package_ensure, - $service_name = $bareos::storage_service_name, - $service_ensure = $bareos::service_ensure, - $service_enable = $bareos::service_enable, - $config_dir = "${bareos::config_dir}/bareos-sd.d", + Boolean $manage_service = $bareos::manage_service, + Boolean $manage_package = $bareos::manage_package, + Variant[String, Array[String]] $package_name = $bareos::storage_package_name, + String $package_ensure = $bareos::package_ensure, + String $service_name = $bareos::storage_service_name, + String $service_ensure = $bareos::service_ensure, + Boolean $service_enable = $bareos::service_enable, + String $config_dir = "${bareos::config_dir}/bareos-sd.d", Hash $autochangers = {}, - Hash $devices = {}, - Hash $directors = {}, - Hash $messages = {}, - Hash $ndmps = {}, + Hash $devices = {}, + Hash $directors = {}, + Hash $messages = {}, + Hash $ndmps = {}, ) inherits bareos { include bareos::storage::storage diff --git a/manifests/storage/autochanger.pp b/manifests/storage/autochanger.pp index 8e8d186..0d0abd4 100644 --- a/manifests/storage/autochanger.pp +++ b/manifests/storage/autochanger.pp @@ -37,21 +37,17 @@ # Required: true # define bareos::storage::autochanger ( - $ensure = present, - $changer_command = undef, - $changer_device = undef, - $description = undef, - $device = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $changer_command = undef, + Optional[String] $changer_device = undef, + Optional[String] $description = undef, + Optional[Bareos::List::Resource] $device = undef, ) { include bareos::storage $_resource = 'Autochanger' $_resource_dir = 'autochanger' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_resource = [ Bareos::Storage::Device[$device], diff --git a/manifests/storage/device.pp b/manifests/storage/device.pp index dc4abca..4e0d251 100644 --- a/manifests/storage/device.pp +++ b/manifests/storage/device.pp @@ -442,79 +442,75 @@ # Required: false # define bareos::storage::device ( - $ensure = present, - $alert_command = undef, - $always_open = undef, - $archive_device = undef, - $auto_deflate = undef, - $auto_deflate_algorithm = undef, - $auto_deflate_level = undef, - $auto_inflate = undef, - $auto_select = undef, - $autochanger = undef, - $automatic_mount = undef, - $backward_space_file = undef, - $backward_space_record = undef, - $block_checksum = undef, - $block_positioning = undef, - $bsf_at_eom = undef, - $changer_command = undef, - $changer_device = undef, - $check_labels = undef, - $close_on_poll = undef, - $collect_statistics = undef, - $count = undef, - $description = undef, - $device_options = undef, - $device_type = undef, - $diagnostic_device = undef, - $drive_crypto_enabled = undef, - $drive_index = undef, - $drive_tape_alert_enabled = undef, - $fast_forward_space_file = undef, - $forward_space_file = undef, - $forward_space_record = undef, - $hardware_end_of_file = undef, - $hardware_end_of_medium = undef, - $label_block_size = undef, - $label_media = undef, - $label_type = undef, - $maximum_block_size = undef, - $maximum_changer_wait = undef, - $maximum_concurrent_jobs = undef, - $maximum_file_size = undef, - $maximum_job_spool_size = undef, - $maximum_network_buffer_size = undef, - $maximum_open_volumes = undef, - $maximum_open_wait = undef, - $maximum_rewind_wait = undef, - $maximum_spool_size = undef, - $media_type = undef, - $minimum_block_size = undef, - $mount_command = undef, - $mount_point = undef, - $no_rewind_on_close = undef, - $offline_on_unmount = undef, - $query_crypto_status = undef, - $random_access = undef, - $removable_media = undef, - $requires_mount = undef, - $spool_directory = undef, - $two_eof = undef, - $unmount_command = undef, - $use_mtiocget = undef, - $volume_capacity = undef, - $volume_poll_interval = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $alert_command = undef, + Optional[Bareos::Boolean] $always_open = undef, + Optional[String] $archive_device = undef, + Optional[Bareos::IODirection] $auto_deflate = undef, + Optional[Bareos::Compression] $auto_deflate_algorithm = undef, + Optional[Integer[0]] $auto_deflate_level = undef, + Optional[Bareos::IODirection] $auto_inflate = undef, + Optional[Bareos::Boolean] $auto_select = undef, + Optional[Bareos::Boolean] $autochanger = undef, + Optional[Bareos::Boolean] $automatic_mount = undef, + Optional[Bareos::Boolean] $backward_space_file = undef, + Optional[Bareos::Boolean] $backward_space_record = undef, + Optional[Bareos::Boolean] $block_checksum = undef, + Optional[Bareos::Boolean] $block_positioning = undef, + Optional[Bareos::Boolean] $bsf_at_eom = undef, + Optional[String] $changer_command = undef, + Optional[String] $changer_device = undef, + Optional[Bareos::Boolean] $check_labels = undef, + Optional[Bareos::Boolean] $close_on_poll = undef, + Optional[Bareos::Boolean] $collect_statistics = undef, + Optional[Integer[0]] $count = undef, + Optional[String] $description = undef, + Optional[String] $device_options = undef, + Optional[Bareos::Device::Type] $device_type = undef, + Optional[String] $diagnostic_device = undef, + Optional[Bareos::Boolean] $drive_crypto_enabled = undef, + Optional[Integer[0]] $drive_index = undef, + Optional[Bareos::Boolean] $drive_tape_alert_enabled = undef, + Optional[Bareos::Boolean] $fast_forward_space_file = undef, + Optional[Bareos::Boolean] $forward_space_file = undef, + Optional[Bareos::Boolean] $forward_space_record = undef, + Optional[Bareos::Boolean] $hardware_end_of_file = undef, + Optional[Bareos::Boolean] $hardware_end_of_medium = undef, + Optional[Integer[0]] $label_block_size = undef, + Optional[Bareos::Boolean] $label_media = undef, + Optional[Bareos::Label] $label_type = undef, + Optional[Integer[0]] $maximum_block_size = undef, + Optional[Bareos::Time] $maximum_changer_wait = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Bareos::Size] $maximum_file_size = undef, + Optional[Bareos::Size] $maximum_job_spool_size = undef, + Optional[Integer[0]] $maximum_network_buffer_size = undef, + Optional[Integer[0]] $maximum_open_volumes = undef, + Optional[Bareos::Time] $maximum_open_wait = undef, + Optional[Bareos::Time] $maximum_rewind_wait = undef, + Optional[Bareos::Size] $maximum_spool_size = undef, + Optional[String] $media_type = undef, + Optional[Integer[0]] $minimum_block_size = undef, + Optional[String] $mount_command = undef, + Optional[String] $mount_point = undef, + Optional[Bareos::Boolean] $no_rewind_on_close = undef, + Optional[Bareos::Boolean] $offline_on_unmount = undef, + Optional[Bareos::Boolean] $query_crypto_status = undef, + Optional[Bareos::Boolean] $random_access = undef, + Optional[Bareos::Boolean] $removable_media = undef, + Optional[Bareos::Boolean] $requires_mount = undef, + Optional[String] $spool_directory = undef, + Optional[Bareos::Boolean] $two_eof = undef, + Optional[String] $unmount_command = undef, + Optional[Bareos::Boolean] $use_mtiocget = undef, + Optional[Bareos::Size] $volume_capacity = undef, + Optional[Bareos::Time] $volume_poll_interval = undef, ) { include bareos::storage $_resource = 'Device' $_resource_dir = 'device' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/storage/director.pp b/manifests/storage/director.pp index c4de838..2e55e79 100644 --- a/manifests/storage/director.pp +++ b/manifests/storage/director.pp @@ -1,6 +1,6 @@ # == Define: bareos::storage::director # The Director resource specifies the Name of the Director which is permitted to use the services of the Storage daemon. -# There may be multiple Director resources. +# There may be multiple Director resources. # The Director Name and Password must match the corresponding values in the Director's configuration file. # # == Parameters @@ -128,34 +128,30 @@ # Required: false # define bareos::storage::director ( - $ensure = present, - $description = undef, - $key_encryption_key = undef, - $maximum_bandwidth_per_job = undef, - $monitor = undef, - $password = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, + Bareos::Module::Ensure $ensure = present, + Optional[String] $description = undef, + Optional[String] $key_encryption_key = undef, + Optional[Bareos::Speed] $maximum_bandwidth_per_job = undef, + Optional[Bareos::Boolean] $monitor = undef, + Optional[String] $password = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, ) { include bareos::storage $_resource = 'Director' $_resource_dir = 'director' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/storage/messages.pp b/manifests/storage/messages.pp index bd9881f..dfffc1f 100644 --- a/manifests/storage/messages.pp +++ b/manifests/storage/messages.pp @@ -130,33 +130,30 @@ # Required: false # define bareos::storage::messages ( - $ensure = present, - $append = undef, - $catalog = undef, - $console = undef, - $description = undef, - $director = undef, - $file = undef, - $mail = undef, - $mail_command = undef, - $mail_on_error = undef, - $mail_on_success = undef, - $operator = undef, - $operator_command = undef, - $stderr = undef, - $stdout = undef, - $syslog = undef, - $timestamp_format = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::List::String] $append = undef, + Optional[Bareos::List::String] $catalog = undef, + Optional[Bareos::List::String] $console = undef, + Optional[String] $description = undef, + Optional[Bareos::List::String] $director = undef, + Optional[Bareos::List::String] $file = undef, + Optional[Bareos::List::String] $mail = undef, + Optional[String] $mail_command = undef, + Optional[Bareos::List::String] $mail_on_error = undef, + Optional[Bareos::List::String] $mail_on_success = undef, + Optional[Bareos::List::String] $operator = undef, + Optional[String] $operator_command = undef, + Optional[Bareos::List::String] $stderr = undef, + Optional[Bareos::List::String] $stdout = undef, + Optional[Bareos::List::String] $syslog = undef, + Optional[String] $timestamp_format = undef, + ) { include bareos::storage $_resource = 'Messages' $_resource_dir = 'messages' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/storage/ndmp.pp b/manifests/storage/ndmp.pp index b61efce..5043a04 100644 --- a/manifests/storage/ndmp.pp +++ b/manifests/storage/ndmp.pp @@ -43,22 +43,18 @@ # Required: true # define bareos::storage::ndmp ( - $ensure = present, - $auth_type = undef, - $description = undef, - $log_level = undef, - $password = undef, - $username = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Bareos::Auth::Type] $auth_type = undef, + Optional[String] $description = undef, + Optional[Integer[0]] $log_level = undef, + Optional[String] $password = undef, + Optional[String] $username = undef, ) { include bareos::storage $_resource = 'Ndmp' $_resource_dir = 'ndmp' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_settings = bareos_settings( [$name, 'Name', 'name', true], [$description, 'Description', 'string', false], diff --git a/manifests/storage/storage.pp b/manifests/storage/storage.pp index 11b5d8f..897f66c 100644 --- a/manifests/storage/storage.pp +++ b/manifests/storage/storage.pp @@ -373,69 +373,65 @@ # Required: false # class bareos::storage::storage ( - $ensure = present, - $absolute_job_timeout = undef, - $allow_bandwidth_bursting = undef, - $auto_x_flate_on_replication = undef, - $backend_directory = undef, - $client_connect_wait = undef, - $collect_device_statistics = undef, - $collect_job_statistics = undef, - $compatible = undef, - $description = undef, - $device_reserve_by_media_type = undef, - $fd_connect_timeout = undef, - $file_device_concurrent_read = undef, - $heartbeat_interval = undef, - $log_timestamp_format = undef, - $maximum_bandwidth_per_job = undef, - $maximum_concurrent_jobs = undef, - $maximum_connections = undef, - $maximum_network_buffer_size = undef, - $messages = undef, - $name_storage = 'bareos-sd', - $ndmp_address = undef, - $ndmp_addresses = undef, - $ndmp_enable = undef, - $ndmp_log_level = undef, - $ndmp_port = undef, - $ndmp_snooping = undef, - $pid_directory = undef, - $plugin_directory = undef, - $plugin_names = undef, - $scripts_directory = undef, - $sd_address = undef, - $sd_addresses = undef, - $sd_connect_timeout = undef, - $sd_port = undef, - $sd_source_address = undef, - $secure_erase_command = undef, - $statistics_collect_interval = undef, - $sub_sys_directory = undef, - $tls_allowed_cn = undef, - $tls_authenticate = undef, - $tls_ca_certificate_dir = undef, - $tls_ca_certificate_file = undef, - $tls_certificate = undef, - $tls_certificate_revocation_list = undef, - $tls_cipher_list = undef, - $tls_dh_file = undef, - $tls_enable = undef, - $tls_key = undef, - $tls_require = undef, - $tls_verify_peer = undef, - $ver_id = undef, - $working_directory = undef, + Bareos::Module::Ensure $ensure = present, + Optional[Integer[0]] $absolute_job_timeout = undef, + Optional[Bareos::Boolean] $allow_bandwidth_bursting = undef, + Optional[Bareos::Boolean] $auto_x_flate_on_replication = undef, + Optional[String] $backend_directory = undef, + Optional[Bareos::Time] $client_connect_wait = undef, + Optional[Bareos::Boolean] $collect_device_statistics = undef, + Optional[Bareos::Boolean] $collect_job_statistics = undef, + Optional[Bareos::Boolean] $compatible = undef, + Optional[String] $description = undef, + Optional[Bareos::Boolean] $device_reserve_by_media_type = undef, + Optional[Bareos::Time] $fd_connect_timeout = undef, + Optional[Bareos::Boolean] $file_device_concurrent_read = undef, + Optional[Bareos::Time] $heartbeat_interval = undef, + Optional[String] $log_timestamp_format = undef, + Optional[Bareos::Speed] $maximum_bandwidth_per_job = undef, + Optional[Integer[0]] $maximum_concurrent_jobs = undef, + Optional[Integer[0]] $maximum_connections = undef, + Optional[Integer[0]] $maximum_network_buffer_size = undef, + Optional[Bareos::Resource] $messages = undef, + Bareos::Resource $name_storage = 'bareos-sd', + Optional[Bareos::Address] $ndmp_address = undef, + Optional[Bareos::Addresses] $ndmp_addresses = undef, + Optional[Bareos::Boolean] $ndmp_enable = undef, + Optional[Integer[0]] $ndmp_log_level = undef, + Optional[Stdlib::Port] $ndmp_port = undef, + Optional[Bareos::Boolean] $ndmp_snooping = undef, + Optional[String] $pid_directory = undef, + Optional[String] $plugin_directory = undef, + Optional[Bareos::List::String] $plugin_names = undef, + Optional[String] $scripts_directory = undef, + Optional[Bareos::Address] $sd_address = undef, + Optional[Bareos::Addresses] $sd_addresses = undef, + Optional[Bareos::Time] $sd_connect_timeout = undef, + Optional[Stdlib::Port] $sd_port = undef, + Optional[Bareos::Address] $sd_source_address = undef, + Optional[String] $secure_erase_command = undef, + Optional[Integer[0]] $statistics_collect_interval = undef, + Optional[String] $sub_sys_directory = undef, + Optional[Bareos::List::String] $tls_allowed_cn = undef, + Optional[Bareos::Boolean] $tls_authenticate = undef, + Optional[String] $tls_ca_certificate_dir = undef, + Optional[String] $tls_ca_certificate_file = undef, + Optional[String] $tls_certificate = undef, + Optional[String] $tls_certificate_revocation_list = undef, + Optional[String] $tls_cipher_list = undef, + Optional[String] $tls_dh_file = undef, + Optional[Bareos::Boolean] $tls_enable = undef, + Optional[String] $tls_key = undef, + Optional[Bareos::Boolean] $tls_require = undef, + Optional[Bareos::Boolean] $tls_verify_peer = undef, + Optional[String] $ver_id = undef, + Optional[String] $working_directory = undef, ) { include bareos::storage $_resource = 'Storage' $_resource_dir = 'storage' - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { $_require_res_messages = $messages ? { undef => undef, default => Bareos::Storage::Messages[$messages] } diff --git a/manifests/webui.pp b/manifests/webui.pp index d7be415..026b2ea 100644 --- a/manifests/webui.pp +++ b/manifests/webui.pp @@ -3,22 +3,21 @@ # # This class will be automatically included when a resource is defined. class bareos::webui ( - $manage_service = $bareos::manage_service, - $manage_package = $bareos::manage_package, - $package_name = $bareos::webui_package_name, - $package_ensure = $bareos::package_ensure, - $service_name = $bareos::webui_service_name, - $service_ensure = $bareos::service_ensure, - $service_enable = $bareos::service_enable, - $config_dir = $bareos::config_dir_webui, - - $manage_local_dir = true, # setup local bareos director - $session_timeout = 3600, - $pagination_values = '10,25,50,100', - $pagination_default_value = 25, - $save_previous_state = false, - $label_pooltype = '', - $directors = {}, + String $config_dir = $bareos::config_dir_webui, + Hash $directors = {}, + Optional[String] $label_pooltype = undef, + Boolean $manage_local_dir = true, # setup local bareos director + Boolean $manage_package = $bareos::manage_package, + Boolean $manage_service = $bareos::manage_service, + String $package_ensure = $bareos::package_ensure, + Variant[String, Array[String]] $package_name = $bareos::webui_package_name, + Integer $pagination_default_value = 25, + String $pagination_values = '10,25,50,100', + Boolean $save_previous_state = false, + Boolean $service_enable = $bareos::service_enable, + String $service_ensure = $bareos::service_ensure, + String $service_name = $bareos::webui_service_name, + Integer $session_timeout = 3600, ) inherits bareos { if $manage_package { package { $package_name: diff --git a/manifests/webui/director.pp b/manifests/webui/director.pp index d92a6fa..0f97cfe 100644 --- a/manifests/webui/director.pp +++ b/manifests/webui/director.pp @@ -43,20 +43,16 @@ # Bareos default: not set # Required: false define bareos::webui::director ( - Enum['present', 'absent'] $ensure = present, + Bareos::Module::Ensure $ensure = present, Optional[Bareos::Resource] $catalog = undef, - Stdlib::Host $dir_address = 'localhost', + Bareos::Address $dir_address = 'localhost', Stdlib::Port $dir_port = 9101, - Enum['yes', 'no'] $enabled = 'yes', + Bareos::Boolean $enabled = 'yes', Optional[Bareos::Resource] $pam_console_name = undef, Optional[String] $pam_console_password = undef, ) { include bareos::webui - unless $ensure in ['present', 'absent'] { - fail('Invalid value for ensure') - } - if $ensure == 'present' { # just for validation $_validate = bareos_settings( [$catalog, 'Catalog', 'res', false], diff --git a/spec/settings_helper.rb b/spec/settings_helper.rb index 79a0012..11040f3 100644 --- a/spec/settings_helper.rb +++ b/spec/settings_helper.rb @@ -43,8 +43,27 @@ def param(attr, directive, type_argument) val = false when 'address' val = 'host.name.com' - when 'addresses', 'include_exclude_item', 'runscript', 'hash' - sep = ' ' unless type == 'addresses' + when 'addresses' + val = { + 'ipv4' => { + 'addr' => '192.0.2.1' + } + } + result = '{ + ipv4 = { + addr = 192.0.2.1 + } + }' + when 'include_exclude_item' + sep = ' ' + val = { + 'File' => '/foo' + } + result = '{ + File = /foo + }' + when 'runscript', 'hash' + sep = ' ' val = { 'x' => 'y' } diff --git a/types/address.pp b/types/address.pp new file mode 100644 index 0000000..2df8aca --- /dev/null +++ b/types/address.pp @@ -0,0 +1,8 @@ +# @summary Bareos Address, which can be a Port or a HostPort or a Host… +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypenetaddress +type Bareos::Address = Variant[ + Stdlib::Port, + Stdlib::Host, + Pattern[/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]) ([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/], +] diff --git a/types/addresses.pp b/types/addresses.pp new file mode 100644 index 0000000..3139c27 --- /dev/null +++ b/types/addresses.pp @@ -0,0 +1,21 @@ +# @summary The weird, weird Bareos director addresses format +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypenetaddresses +type Bareos::Addresses = Hash[ + Enum['ip', 'ipv4', 'ipv6'], Variant[ + Struct[ + { + addr => Stdlib::Host, + Optional[port] => Stdlib::Port, + } + ], + Array[ + Struct[ + { + addr => Stdlib::Host, + Optional[port] => Stdlib::Port, + } + ] + ] + ] +] diff --git a/types/auth/protocol.pp b/types/auth/protocol.pp new file mode 100644 index 0000000..0fd4462 --- /dev/null +++ b/types/auth/protocol.pp @@ -0,0 +1,9 @@ +# @summary Auth protocol types +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypejobprotocol +type Bareos::Auth::Protocol = Enum[ + 'native', + 'ndmp', + 'ndmp_bareos', + 'ndmp_native', +] diff --git a/types/auth/type.pp b/types/auth/type.pp new file mode 100644 index 0000000..514cd40 --- /dev/null +++ b/types/auth/type.pp @@ -0,0 +1,8 @@ +# @summary Authentication types +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypeauthtype +type Bareos::Auth::Type = Enum[ + 'none', + 'clear', + 'md5' +] diff --git a/types/boolean.pp b/types/boolean.pp index 4a77be5..fa492c1 100644 --- a/types/boolean.pp +++ b/types/boolean.pp @@ -1,2 +1,8 @@ # @summary Bareos boolean datatype -type Bareos::Boolean = Variant[Boolean, Enum['yes', 'no']] +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypeyesno +type Bareos::Boolean = Variant[ + Boolean, + Enum['yes', 'no'], + Enum['on', 'off'] +] diff --git a/types/compression.pp b/types/compression.pp new file mode 100644 index 0000000..f5d24fa --- /dev/null +++ b/types/compression.pp @@ -0,0 +1,19 @@ +# @summary Bareos compression algorithms +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/Director.html?highlight=sha512#config-Dir_Fileset_Include_Options_Compression +type Bareos::Compression = Pattern[ + /(?i:GZIP)/, + /(?i:GZIP1)/, + /(?i:GZIP2)/, + /(?i:GZIP3)/, + /(?i:GZIP4)/, + /(?i:GZIP5)/, + /(?i:GZIP6)/, + /(?i:GZIP7)/, + /(?i:GZIP8)/, + /(?i:GZIP9)/, + /(?i:LZO)/, + /(?i:LZFAST)/, + /(?i:LZ4)/, + /(?i:LZ4HC)/ +] diff --git a/types/device/type.pp b/types/device/type.pp new file mode 100644 index 0000000..867fcd0 --- /dev/null +++ b/types/device/type.pp @@ -0,0 +1,10 @@ +# @summary Bareos device types +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-device_type +type Bareos::Device::Type = Pattern[ + /(?i:tape)/, + /(?i:file)/, + /(?i:fifo)/, + /(?i:gfapi)/, + /(?i:rados)/, +] diff --git a/types/encryptioncipher.pp b/types/encryptioncipher.pp new file mode 100644 index 0000000..a97a2fa --- /dev/null +++ b/types/encryptioncipher.pp @@ -0,0 +1,14 @@ +# @summary Valid encryption ciphers for Bareos. +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/FileDaemon.html?highlight=aes128#config-Fd_Client_PkiCipher +type Bareos::EncryptionCipher = Enum[ + 'aes128', + 'aes192', + 'aes256', + 'camellia128', + 'camellia192', + 'camellia256', + 'aes128hmacsha1', + 'aes256hmacsha1', + 'blowfish' +] diff --git a/types/excludeitem.pp b/types/excludeitem.pp new file mode 100644 index 0000000..b666e1a --- /dev/null +++ b/types/excludeitem.pp @@ -0,0 +1,6 @@ +# @summary Exclude item +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/Director.html#fileset-exclude-resource +type Bareos::ExcludeItem = Struct[{ + 'File' => Bareos::List::String, +}] diff --git a/types/filesetoptions.pp b/types/filesetoptions.pp new file mode 100644 index 0000000..92aabf4 --- /dev/null +++ b/types/filesetoptions.pp @@ -0,0 +1,45 @@ +# @summary Options to an include item of a fileset +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/Director.html#fileset-options +type Bareos::FilesetOptions = Struct[{ + Optional['Auto Exclude'] => Bareos::Boolean, + Optional['Compression'] => Bareos::Compression, + Optional['Signature'] => Bareos::Signature, + Optional['Base Job'] => Bareos::VerifyOptions, + Optional['Accurate'] => Bareos::VerifyOptions, + Optional['Verify'] => Bareos::VerifyOptions, + Optional['One FS'] => Bareos::Boolean, + Optional['Honor No Dump Flag'] => Bareos::Boolean, + Optional['Portable'] => Bareos::Boolean, + Optional['Recurse'] => Bareos::Boolean, + Optional['Sparse'] => Bareos::Boolean, + Optional['Read Fifo'] => Bareos::Boolean, + Optional['No Atime'] => Bareos::Boolean, + Optional['Mtime Only'] => Bareos::Boolean, + Optional['Keep Atime'] => Bareos::Boolean, + Optional['Check File Changes'] => Bareos::Boolean, + Optional['Hard Links'] => Bareos::Boolean, + Optional['Wild'] => Bareos::List::String, + Optional['Wild Dir'] => Bareos::List::String, + Optional['Wild File'] => Bareos::List::String, + Optional['Regex'] => Bareos::List::String, + Optional['Regex File'] => Bareos::List::String, + Optional['Regex Dir'] => Bareos::List::String, + Optional['Exclude'] => Bareos::Boolean, + Optional['ACL Support'] => Bareos::Boolean, + Optional['XAttr Support'] => Bareos::Boolean, + Optional['Ignore Case'] => Bareos::Boolean, + Optional['FS Type'] => String, + Optional['Drive Type'] => String, + Optional['Hfs Plus Support'] => Bareos::Boolean, + Optional['Strip Path'] => Integer, + Optional['Size'] => String, + Optional['Shadowing'] => Enum[ + 'none', + 'localwarn', + 'localremove', + 'globalwarn', + 'globalremove' + ], + Optional['Meta'] => String, +}] diff --git a/types/includeitem.pp b/types/includeitem.pp new file mode 100644 index 0000000..c65faa9 --- /dev/null +++ b/types/includeitem.pp @@ -0,0 +1,9 @@ +# @summary Include item +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/Director.html#fileset-include +type Bareos::IncludeItem = Struct[{ + 'File' => Bareos::List::String, + Optional['Exclude Dir Containing'] => String, + Optional['Plugin'] => Bareos::List::String, + Optional['Options'] => Bareos::FilesetOptions, +}] diff --git a/types/iodirection.pp b/types/iodirection.pp new file mode 100644 index 0000000..d22f658 --- /dev/null +++ b/types/iodirection.pp @@ -0,0 +1,8 @@ +# @summary I/O direction setting +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-io_direction +type Bareos::IODirection = Enum[ + 'in', + 'out', + 'both' +] diff --git a/types/job/level.pp b/types/job/level.pp new file mode 100644 index 0000000..901b7ec --- /dev/null +++ b/types/job/level.pp @@ -0,0 +1,13 @@ +# @summary Backup job level +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-backup_level +type Bareos::Job::Level = Pattern[ + /(?i:Full)/, + /(?i:Differential)/, + /(?i:Incremental)/, + /(?i:VirtualFull)/, + /(?i:InitCatalog)/, + /(?i:Catalog)/, + /(?i:VolumeToCatalog)/, + /(?i:DiskToCatalog)/, +] diff --git a/types/job/migrationtype.pp b/types/job/migrationtype.pp new file mode 100644 index 0000000..e55a28a --- /dev/null +++ b/types/job/migrationtype.pp @@ -0,0 +1,14 @@ +# @summary Type that defines what Jobs to migrate during Migration and Copy +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-migration_type +type Bareos::Job::MigrationType = Pattern[ + /(?i:SmallestVolume)/, + /(?i:OldestVolume)/, + /(?i:Client)/, + /(?i:Volume)/, + /(?i:Job)/, + /(?i:SQLQuery)/, + /(?i:PoolOccupancy)/, + /(?i:PoolTime)/, + /(?i:PoolUncopiedJobs)/ +] diff --git a/types/job/replaceoption.pp b/types/job/replaceoption.pp new file mode 100644 index 0000000..ed4bb75 --- /dev/null +++ b/types/job/replaceoption.pp @@ -0,0 +1,9 @@ +# @summary Replace options for a Bareos Restore job +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-replace_option +type Bareos::Job::ReplaceOption = Enum[ + 'always', + 'ifnewer', + 'ifolder', + 'never' +] diff --git a/types/job/type.pp b/types/job/type.pp new file mode 100644 index 0000000..5a1b0ef --- /dev/null +++ b/types/job/type.pp @@ -0,0 +1,12 @@ +# @summary Defines the various Bareos job types +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-job_type +type Bareos::Job::Type = Pattern[ + /(?i:Backup)/, + /(?i:Restore)/, + /(?i:Verify)/, + /(?i:Admin)/, + /(?i:Migrate)/, + /(?i:Copy)/, + /(?i:Consolidate)/ +] diff --git a/types/label.pp b/types/label.pp new file mode 100644 index 0000000..96e3158 --- /dev/null +++ b/types/label.pp @@ -0,0 +1,8 @@ +# @summary Bareos label types (for use with tape libraries) +# @author Tobias @towo Wolter +# @see https://github.com/bareos/bareos/blob/7cd54133cd9a4f206259b3612f3ad6ab7add9743/core/src/lib/generic_res.h#L59 +type Bareos::Label = Pattern[ + /(?i:ANSI)/, + /(?i:IBM)/, + /(?i:Bareos)/ +] diff --git a/types/list.pp b/types/list.pp deleted file mode 100644 index 8ba4808..0000000 --- a/types/list.pp +++ /dev/null @@ -1,2 +0,0 @@ -# @summary Bareos List data type -type Bareos::List = Variant[String, Array[String]] diff --git a/types/list/directory.pp b/types/list/directory.pp new file mode 100644 index 0000000..038d43c --- /dev/null +++ b/types/list/directory.pp @@ -0,0 +1,6 @@ +# @summary Directory list: single path or array of paths +# @author Tobias @towo Wolter +type Bareos::List::Directory = Variant[ + String, + Array[String] +] diff --git a/types/list/resource.pp b/types/list/resource.pp new file mode 100644 index 0000000..5190cd1 --- /dev/null +++ b/types/list/resource.pp @@ -0,0 +1,6 @@ +# @summary Bareos Resource list data type +# @author Tobias @towo Wolter +type Bareos::List::Resource = Variant[ + Bareos::Resource, + Array[Bareos::Resource] +] diff --git a/types/list/string.pp b/types/list/string.pp new file mode 100644 index 0000000..bc8cfc5 --- /dev/null +++ b/types/list/string.pp @@ -0,0 +1,3 @@ +# @summary Bareos String List data type +# @author Tobias @towo Wolter +type Bareos::List::String = Variant[String, Array[String]] diff --git a/types/module/catalogconfig.pp b/types/module/catalogconfig.pp new file mode 100644 index 0000000..00e06d7 --- /dev/null +++ b/types/module/catalogconfig.pp @@ -0,0 +1,15 @@ +# @summary Bareos module catalog config +# @author Tobias @towo Wolter +type Bareos::Module::CatalogConfig = Struct[{ + Optional['db_address'] => String, + 'db_driver' => Enum[ + 'sqlite3', + 'mysql', + 'postgresql' + ], + 'db_name' => String, + Optional['db_password'] => String, + Optional['db_port'] => Stdlib::Port, + Optional['db_socket'] => String, + Optional['db_user'] => String, +}] diff --git a/types/module/ensure.pp b/types/module/ensure.pp new file mode 100644 index 0000000..8633ddb --- /dev/null +++ b/types/module/ensure.pp @@ -0,0 +1,7 @@ +# @summary Alias for the ensure property +# @author Tobias @towo Wolter +# @api private +type Bareos::Module::Ensure = Enum[ + 'absent', + 'present' +] diff --git a/types/pool.pp b/types/pool.pp new file mode 100644 index 0000000..5444c39 --- /dev/null +++ b/types/pool.pp @@ -0,0 +1,11 @@ +# @summary Possible Bareos Pool types +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatype-pooltype +type Bareos::Pool = Pattern[ + /(?i:Backup)/, + /(?i:Archive)/, + /(?i:Cloned)/, + /(?i:Migration)/, + /(?i:Copy)/, + /(?i:Save)/ +] diff --git a/types/resource.pp b/types/resource.pp index bb8f57a..e1bccde 100644 --- a/types/resource.pp +++ b/types/resource.pp @@ -1,2 +1,4 @@ # @summary Bareos Resource data type +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypename type Bareos::Resource = Pattern[/(?i:^[a-z][a-z0-9\.\-_ \$]{0,126}$)/] diff --git a/types/signature.pp b/types/signature.pp new file mode 100644 index 0000000..55821cd --- /dev/null +++ b/types/signature.pp @@ -0,0 +1,9 @@ +# @summary Bareos signature algorithms +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/Director.html?highlight=sha512#config-Dir_Fileset_Include_Options_Signature +type Bareos::Signature = Enum[ + 'MD5', + 'SHA1', + 'SHA256', + 'SHA512' +] diff --git a/types/size.pp b/types/size.pp new file mode 100644 index 0000000..a352aec --- /dev/null +++ b/types/size.pp @@ -0,0 +1,4 @@ +# @summary Size definition +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypesize +type Bareos::Size = Pattern[/(?i:^(\d+(\.\d+)?)\W*(k|kb|m|mb|g|gb)$)/] diff --git a/types/speed.pp b/types/speed.pp new file mode 100644 index 0000000..1cdd564 --- /dev/null +++ b/types/speed.pp @@ -0,0 +1,4 @@ +# @struct Bareos bandwidth speed +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypespeed +type Bareos::Speed = Pattern[/(?i:\d+\s*(k\/s|kb\/s|m\/s|mb\/s))/] diff --git a/types/time.pp b/types/time.pp new file mode 100644 index 0000000..0cfa0f3 --- /dev/null +++ b/types/time.pp @@ -0,0 +1,7 @@ +# @summary Bareos time specification +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/CustomizingTheConfiguration.html#datatypetime +type Bareos::Time = Variant[ + Integer, + Pattern[/(\d+\s*(seconds|sec|s|minutes|min|hours|h|days|d|weeks|w|months|m|quarters|q|years|y)\s*)+/] +] diff --git a/types/verifyoptions.pp b/types/verifyoptions.pp new file mode 100644 index 0000000..4854d4d --- /dev/null +++ b/types/verifyoptions.pp @@ -0,0 +1,4 @@ +# @summary Verification options for Filesets +# @author Tobias @towo Wolter +# @see https://docs.bareos.org/Configuration/Director.html?highlight=sha512#config-Dir_Fileset_Include_Options_Verify +type Bareos::VerifyOptions = Pattern[/[ipnugsamcd51A]+/]