Skip to content

Commit

Permalink
Type aliases for all the things
Browse files Browse the repository at this point in the history
* Introduces type aliases for (most) variables to do some error checking.
*
  • Loading branch information
towo committed Dec 28, 2021
1 parent 0bfe2a5 commit 6ea1a28
Show file tree
Hide file tree
Showing 71 changed files with 1,151 additions and 949 deletions.
16 changes: 8 additions & 8 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
109 changes: 55 additions & 54 deletions manifests/client/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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] }

Expand Down
50 changes: 23 additions & 27 deletions manifests/client/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
38 changes: 17 additions & 21 deletions manifests/client/messages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
8 changes: 4 additions & 4 deletions manifests/console.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
44 changes: 20 additions & 24 deletions manifests/console/console.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
Loading

0 comments on commit 6ea1a28

Please sign in to comment.