summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Meusel <tim@bastelfreak.de>2016-07-12 22:28:12 +0200
committerGitHub <noreply@github.com>2016-07-12 22:28:12 +0200
commit336e3686c116aa8c1855430f31b68548e1f6558a (patch)
tree9019c12f877bed6f168b84b5770aa0d4f3735202
parent3f25181c7a1f90f87c39f9fc1bac503f66eac05c (diff)
parent3f75b06bccc8000ea1b03c603f098794ec9a58cd (diff)
Merge pull request #64 from pkkm/master
Make parameter validation more strict
-rw-r--r--manifests/init.pp70
1 files changed, 52 insertions, 18 deletions
diff --git a/manifests/init.pp b/manifests/init.pp
index 7b09d0a..5460948 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -21,31 +21,65 @@ class unattended_upgrades (
$options = {},
) inherits ::unattended_upgrades::params {
- if $legacy_origin == undef or $origins == undef {
- fail('Please explicitly specify unattended_upgrades::legacy_origin and unattended_upgrades::origins.')
- }
+ validate_hash($age)
+ $_age = merge($::unattended_upgrades::default_age, $age)
+ validate_integer($_age['min'], undef, 0)
+ validate_integer($_age['max'], undef, 0)
- validate_bool(
- $install_on_shutdown,
- $legacy_origin,
- $minimal_steps,
- )
- validate_array($blacklist)
- validate_array($origins)
validate_hash($auto)
$_auto = merge($::unattended_upgrades::default_auto, $auto)
- validate_hash($mail)
- if $mail['only_on_error'] {
- validate_bool($mail['only_on_error'])
- }
- $_mail = merge($::unattended_upgrades::default_mail, $mail)
+ validate_integer($_auto['clean'], undef, 0)
+ validate_bool($_auto['fix_interrupted_dpkg'])
+ validate_bool($_auto['reboot'])
+ validate_string($_auto['reboot_time'])
+ validate_bool($_auto['remove'])
+
validate_hash($backup)
$_backup = merge($::unattended_upgrades::default_backup, $backup)
- validate_hash($age)
- $_age = merge($::unattended_upgrades::default_age, $age)
- validate_integer($size)
+ validate_integer($_backup['archive_interval'], undef, 0)
+ validate_integer($_backup['level'], undef, 0)
+
+ validate_array($blacklist)
+
+ if $dl_limit != undef {
+ validate_integer($dl_limit, undef, 0)
+ }
+
+ validate_integer($enable, 1, 0)
+
+ validate_bool($install_on_shutdown)
+
+ validate_bool($legacy_origin)
+
+ validate_hash($mail)
+ $_mail = merge($::unattended_upgrades::default_mail, $mail)
+ validate_bool($_mail['only_on_error'])
+
+ validate_bool($minimal_steps)
+
+ validate_array($origins)
+
+ validate_string($package_ensure)
+
+ if $random_sleep != undef {
+ validate_integer($random_sleep, undef, 0)
+ }
+
+ validate_integer($size, undef, 0)
+
+ validate_integer($update, undef, 0)
+
+ validate_integer($upgrade, undef, 0)
+
validate_hash($upgradeable_packages)
$_upgradeable_packages = merge($::unattended_upgrades::default_upgradeable_packages, $upgradeable_packages)
+ validate_integer($_upgradeable_packages['download_only'], undef, 0)
+ validate_integer($_upgradeable_packages['debdelta'], undef, 0)
+
+ validate_integer($verbose, undef, 0)
+
+ validate_bool($notify_update)
+
validate_hash($options)
$_options = merge($unattended_upgrades::default_options, $options)
validate_bool($_options['force_confdef'])