Skip to content

Commit

Permalink
Make String minimum length explicit
Browse files Browse the repository at this point in the history
All user provided String are expected to be non-empty when they are not
undef.
  • Loading branch information
smortex committed Aug 30, 2023
1 parent ed08cdd commit b9a9dbe
Show file tree
Hide file tree
Showing 16 changed files with 228 additions and 228 deletions.
206 changes: 103 additions & 103 deletions REFERENCE.md

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,22 @@
# class { 'bacula::client': director_name => 'mydirector.example.com' }
#
class bacula::client (
Array[String] $packages,
String $services,
String $default_pool,
Optional[String] $default_pool_full,
Optional[String] $default_pool_inc,
Optional[String] $default_pool_diff,
Array[String[1]] $packages,
String[1] $services,
String[1] $default_pool,
Optional[String[1]] $default_pool_full,
Optional[String[1]] $default_pool_inc,
Optional[String[1]] $default_pool_diff,
Stdlib::Port $port = 9102,
Array[String[1]] $listen_address = [],
Bacula::Password $password = 'secret',
Integer[1] $max_concurrent_jobs = 2,
String $director_name = $bacula::director_name,
String[1] $director_name = $bacula::director_name,
Bacula::Yesno $autoprune = true,
Bacula::Time $file_retention = '45 days',
Bacula::Time $job_retention = '6 months',
String $client = $trusted['certname'],
String $address = $facts['networking']['fqdn'],
String[1] $client = $trusted['certname'],
String[1] $address = $facts['networking']['fqdn'],
Optional[Bacula::Yesno] $pki_signatures = undef,
Optional[Bacula::Yesno] $pki_encryption = undef,
Optional[Stdlib::Absolutepath] $pki_keypair = undef,
Expand Down
46 changes: 23 additions & 23 deletions manifests/director.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,29 @@
# @todo director_address is only used by bconsole, and is confusing as director is likely the same
#
class bacula::director (
Hash[String, Bacula::Message] $messages,
Array[String] $packages,
String $services,
String $make_bacula_tables,
Bacula::Yesno $manage_db = true,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
String $db_name = 'bacula',
Bacula::Password $db_pw = 'notverysecret',
String $db_user = 'bacula',
Optional[String] $db_address = undef,
Optional[Stdlib::Port] $db_port = undef,
String $director_address = $bacula::director_address,
String $director = $trusted['certname'], # director here is not bacula::director
String $group = $bacula::bacula_group,
Stdlib::Absolutepath $homedir = $bacula::homedir,
Optional[String] $job_tag = $bacula::job_tag,
Array[String[1]] $listen_address = [],
Integer[1] $max_concurrent_jobs = 20,
Boolean $manage_defaults = true,
Bacula::Password $password = 'secret',
Stdlib::Port $port = 9101,
Stdlib::Absolutepath $rundir = $bacula::rundir,
String $storage_name = $bacula::storage_name,
Hash[String[1], Bacula::Message] $messages,
Array[String[1]] $packages,
String[1] $services,
String[1] $make_bacula_tables,
Bacula::Yesno $manage_db = true,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
String[1] $db_name = 'bacula',
Bacula::Password $db_pw = 'notverysecret',
String[1] $db_user = 'bacula',
Optional[String[1]] $db_address = undef,
Optional[Stdlib::Port] $db_port = undef,
String[1] $director_address = $bacula::director_address,
String[1] $director = $trusted['certname'], # director here is not bacula::director
String[1] $group = $bacula::bacula_group,
Stdlib::Absolutepath $homedir = $bacula::homedir,
Optional[String[1]] $job_tag = $bacula::job_tag,
Array[String[1]] $listen_address = [],
Integer[1] $max_concurrent_jobs = 20,
Boolean $manage_defaults = true,
Bacula::Password $password = 'secret',
Stdlib::Port $port = 9101,
Stdlib::Absolutepath $rundir = $bacula::rundir,
String[1] $storage_name = $bacula::storage_name,
) inherits bacula {
if $manage_defaults {
include bacula::director::defaults
Expand Down
14 changes: 7 additions & 7 deletions manifests/director/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
# }
#
define bacula::director::client (
String $address,
Variant[String,Stdlib::Port] $port, # FIXME: Remove String
Bacula::Password $password,
Bacula::Time $file_retention,
Bacula::Time $job_retention,
Bacula::Yesno $autoprune,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
String[1] $address,
Variant[String[1],Stdlib::Port] $port, # FIXME: Remove String
Bacula::Password $password,
Bacula::Time $file_retention,
Bacula::Time $job_retention,
Bacula::Yesno $autoprune,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
) {
$epp_client_variables = {
name => $name,
Expand Down
4 changes: 2 additions & 2 deletions manifests/director/fileset.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
define bacula::director::fileset (
Array[Stdlib::Absolutepath] $files,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
String $director_name = $bacula::director_name,
String[1] $director_name = $bacula::director_name,
Array[Stdlib::Absolutepath] $excludes = [],
Hash[String, Variant[String, Array[String], Bacula::Yesno]] $options = {
Hash[String[1], Variant[String[1], Array[String[1]], Bacula::Yesno]] $options = {
'signature' => 'SHA1',
'compression' => 'GZIP9',
},
Expand Down
2 changes: 1 addition & 1 deletion manifests/director/job.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# }
#
define bacula::director::job (
String $content,
String[1] $content,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
) {
include bacula
Expand Down
26 changes: 13 additions & 13 deletions manifests/director/pool.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@
# }
#
define bacula::director::pool (
Optional[Bacula::Time] $volret = undef,
Optional[Variant[String,Integer[1]]] $maxvoljobs = undef, # FIXME: Remove String
Optional[Bacula::Size] $maxvolbytes = undef,
Optional[Variant[String,Integer[1]]] $maxvols = undef, # FIXME: Remove String
Optional[String] $label = undef,
Optional[Bacula::Time] $voluseduration = undef,
String $storage = $bacula::director::storage,
String $pooltype = 'Backup',
Bacula::Yesno $recycle = true,
Bacula::Yesno $autoprune = true,
String $purgeaction = 'Truncate',
Optional[String] $next_pool = undef,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
Optional[Bacula::Time] $volret = undef,
Optional[Variant[String[1],Integer[1]]] $maxvoljobs = undef, # FIXME: Remove String
Optional[Bacula::Size] $maxvolbytes = undef,
Optional[Variant[String[1],Integer[1]]] $maxvols = undef, # FIXME: Remove String
Optional[String[1]] $label = undef,
Optional[Bacula::Time] $voluseduration = undef,
String[1] $storage = $bacula::director::storage,
String[1] $pooltype = 'Backup',
Bacula::Yesno $recycle = true,
Bacula::Yesno $autoprune = true,
String[1] $purgeaction = 'Truncate',
Optional[String[1]] $next_pool = undef,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
) {
$epp_pool_variables = {
name => $name,
Expand Down
6 changes: 3 additions & 3 deletions manifests/director/postgresql.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
# @param db_user The database user
#
class bacula::director::postgresql (
String $make_bacula_tables = $bacula::director::make_bacula_tables,
String $db_name = $bacula::director::db_name,
String[1] $make_bacula_tables = $bacula::director::make_bacula_tables,
String[1] $db_name = $bacula::director::db_name,
Bacula::Password $db_pw = $bacula::director::db_pw,
String $db_user = $bacula::director::db_user,
String[1] $db_user = $bacula::director::db_user,
) {
include bacula

Expand Down
6 changes: 3 additions & 3 deletions manifests/director/storage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
# @param conf_dir Bacula configuration directory
#
define bacula::director::storage (
String $address = $name,
String[1] $address = $name,
Stdlib::Port $port = 9103,
Bacula::Password $password = 'secret',
String $device_name = "${facts['networking']['fqdn']}-device",
String $media_type = 'File',
String[1] $device_name = "${facts['networking']['fqdn']}-device",
String[1] $media_type = 'File',
Integer[1] $maxconcurjobs = 1,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
) {
Expand Down
20 changes: 10 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,27 @@
#
class bacula (
Stdlib::Absolutepath $conf_dir,
String $bacula_user,
String $bacula_group,
String[1] $bacula_user,
String[1] $bacula_group,
Stdlib::Absolutepath $homedir,
Stdlib::Absolutepath $rundir,
String $director_address,
String $director_name,
String $storage_name,
String $db_type = 'pgsql',
String $homedir_mode = '0770',
String[1] $director_address,
String[1] $director_name,
String[1] $storage_name,
String[1] $db_type = 'pgsql',
String[1] $homedir_mode = '0770',
Bacula::Yesno $monitor = true,
String $device_seltype = 'bacula_store_t',
String[1] $device_seltype = 'bacula_store_t',
Optional[Bacula::Yesno] $tls_enable = undef,
Optional[Bacula::Yesno] $tls_require = undef,
Optional[Stdlib::Absolutepath] $tls_certificate = undef,
Optional[Stdlib::Absolutepath] $tls_key = undef,
Optional[Bacula::Yesno] $tls_verify_peer = undef,
Array[String] $tls_allowed_cn = [],
Array[String[1]] $tls_allowed_cn = [],
Optional[Stdlib::Absolutepath] $tls_ca_certificate_file = undef,
Optional[Stdlib::Absolutepath] $tls_ca_certificate_dir = undef,
Optional[Stdlib::Absolutepath] $tls_dh_file = undef,
Optional[String] $job_tag = undef,
Optional[String[1]] $job_tag = undef,
) {
# Do nothing
}
30 changes: 15 additions & 15 deletions manifests/job.pp
Original file line number Diff line number Diff line change
Expand Up @@ -44,30 +44,30 @@
define bacula::job (
Array[Stdlib::Absolutepath] $files = [],
Array[Stdlib::Absolutepath] $excludes = [],
Optional[String] $fileset = undef,
Optional[String[1]] $fileset = undef,
Bacula::JobType $jobtype = 'Backup',
String $template = 'bacula/job.conf.epp',
Optional[String] $pool = undef,
Optional[String] $pool_full = undef,
Optional[String] $pool_inc = undef,
Optional[String] $pool_diff = undef,
Optional[String] $storage = undef,
Variant[Boolean, String] $jobdef = 'Default',
String[1] $template = 'bacula/job.conf.epp',
Optional[String[1]] $pool = undef,
Optional[String[1]] $pool_full = undef,
Optional[String[1]] $pool_inc = undef,
Optional[String[1]] $pool_diff = undef,
Optional[String[1]] $storage = undef,
Variant[Boolean, String[1]] $jobdef = 'Default',
Array[Bacula::Runscript] $runscript = [],
Optional[String] $level = undef,
Optional[String[1]] $level = undef,
Bacula::Yesno $accurate = false,
Bacula::Yesno $reschedule_on_error = false,
Bacula::Time $reschedule_interval = '1 hour',
Integer $reschedule_times = 10,
Optional[String] $messages = undef,
Optional[String[1]] $messages = undef,
Stdlib::Absolutepath $restoredir = '/tmp/bacula-restores',
Optional[String] $sched = undef,
Optional[String[1]] $sched = undef,
Optional[Integer] $priority = undef,
Optional[String] $job_tag = undef,
Optional[String] $selection_type = undef,
Optional[String] $selection_pattern = undef,
Optional[String[1]] $job_tag = undef,
Optional[String[1]] $selection_type = undef,
Optional[String[1]] $selection_pattern = undef,
Integer[1] $max_concurrent_jobs = 1,
Optional[String] $write_bootstrap = undef,
Optional[String[1]] $write_bootstrap = undef,
Optional[Bacula::Time] $max_full_interval = undef,
) {
include bacula
Expand Down
14 changes: 7 additions & 7 deletions manifests/jobdefs.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@
#
define bacula::jobdefs (
Bacula::JobType $jobtype = 'Backup',
String $sched = 'Default',
String $messages = 'Standard',
String[1] $sched = 'Default',
String[1] $messages = 'Standard',
Integer $priority = 10,
String $pool = 'Default',
Optional[String] $full_backup_pool = undef,
Optional[String] $differential_backup_pool = undef,
Optional[String] $level = undef,
String[1] $pool = 'Default',
Optional[String[1]] $full_backup_pool = undef,
Optional[String[1]] $differential_backup_pool = undef,
Optional[String[1]] $level = undef,
Bacula::Yesno $accurate = false,
Bacula::Yesno $reschedule_on_error = false,
Bacula::Time $reschedule_interval = '1 hour',
Integer $reschedule_times = 10,
Integer[1] $max_concurrent_jobs = 1,
Optional[String] $write_bootstrap = undef,
Optional[String[1]] $write_bootstrap = undef,
Optional[Bacula::Time] $max_full_interval = undef,
) {
include bacula
Expand Down
28 changes: 14 additions & 14 deletions manifests/messages.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
# @param syslog Send the message to the system log (syslog) using the facility specified in the address field
#
define bacula::messages (
Optional[String] $append = undef,
Optional[String] $catalog = undef,
Optional[String] $console = undef,
Optional[String[1]] $append = undef,
Optional[String[1]] $catalog = undef,
Optional[String[1]] $console = undef,
Enum['dir', 'fd', 'sd'] $daemon = 'dir',
Optional[String] $director = undef,
Optional[String] $mailcmd = undef,
Optional[String] $mail = undef,
Optional[String] $mailonerrorcmd = undef,
Optional[String] $mailonerror = undef,
Optional[String] $mailonsuccesscmd = undef,
Optional[String] $mailonsuccess = undef,
String $mname = 'Standard',
Optional[String] $operatorcmd = undef,
Optional[String] $operator = undef,
Optional[String] $syslog = undef,
Optional[String[1]] $director = undef,
Optional[String[1]] $mailcmd = undef,
Optional[String[1]] $mail = undef,
Optional[String[1]] $mailonerrorcmd = undef,
Optional[String[1]] $mailonerror = undef,
Optional[String[1]] $mailonsuccesscmd = undef,
Optional[String[1]] $mailonsuccess = undef,
String[1] $mname = 'Standard',
Optional[String[1]] $operatorcmd = undef,
Optional[String[1]] $operator = undef,
Optional[String[1]] $syslog = undef,
) {
include bacula
include bacula::common
Expand Down
2 changes: 1 addition & 1 deletion manifests/schedule.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# }
#
define bacula::schedule (
Array[String] $runs,
Array[String[1]] $runs,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
) {
concat::fragment { "bacula-schedule-${name}":
Expand Down
22 changes: 11 additions & 11 deletions manifests/storage.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,26 @@
# @param user The posix user for bacula
#
class bacula::storage (
String $services,
Array[String] $packages,
String[1] $services,
Array[String[1]] $packages,
Stdlib::Absolutepath $conf_dir = $bacula::conf_dir,
Stdlib::Absolutepath $device = '/bacula',
Stdlib::Filemode $device_mode = '0770',
String $device_name = "${trusted['certname']}-device",
String $device_owner = $bacula::bacula_user,
String $device_seltype = $bacula::device_seltype,
String $director_name = $bacula::director_name,
String $group = $bacula::bacula_group,
String[1] $device_name = "${trusted['certname']}-device",
String[1] $device_owner = $bacula::bacula_user,
String[1] $device_seltype = $bacula::device_seltype,
String[1] $director_name = $bacula::director_name,
String[1] $group = $bacula::bacula_group,
Stdlib::Absolutepath $homedir = $bacula::homedir,
Array[String[1]] $listen_address = [],
Integer[1] $maxconcurjobs = 5,
String $media_type = 'File',
String[1] $media_type = 'File',
Bacula::Password $password = 'secret',
Stdlib::Port $port = 9103,
Stdlib::Absolutepath $rundir = $bacula::rundir,
String $storage = $trusted['certname'], # storage here is not storage_name
String $address = $facts['networking']['fqdn'],
String $user = $bacula::bacula_user,
String[1] $storage = $trusted['certname'], # storage here is not storage_name
String[1] $address = $facts['networking']['fqdn'],
String[1] $user = $bacula::bacula_user,
) inherits bacula {
# Allow for package names to include EPP syntax for db_type
$package_names = $packages.map |$p| {
Expand Down
Loading

0 comments on commit b9a9dbe

Please sign in to comment.