From 3a4abe4f98d4c24989a1def59968cb49d1d26268 Mon Sep 17 00:00:00 2001 From: b4ldr Date: Mon, 22 Feb 2016 12:52:07 +0000 Subject: add options support fix ruby 1.9 hash correct --- manifests/init.pp | 13 +++++++++++++ manifests/params.pp | 5 ++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'manifests') diff --git a/manifests/init.pp b/manifests/init.pp index 489db32..7b09d0a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -18,6 +18,7 @@ class unattended_upgrades ( $upgradeable_packages = {}, $verbose = 0, $notify_update = false, + $options = {}, ) inherits ::unattended_upgrades::params { if $legacy_origin == undef or $origins == undef { @@ -45,6 +46,12 @@ class unattended_upgrades ( validate_integer($size) validate_hash($upgradeable_packages) $_upgradeable_packages = merge($::unattended_upgrades::default_upgradeable_packages, $upgradeable_packages) + validate_hash($options) + $_options = merge($unattended_upgrades::default_options, $options) + validate_bool($_options['force_confdef']) + validate_bool($_options['force_confold']) + validate_bool($_options['force_confnew']) + validate_bool($_options['force_confmiss']) package { 'unattended-upgrades': ensure => $package_ensure, @@ -70,5 +77,11 @@ class unattended_upgrades ( require => Package['unattended-upgrades'], notify_update => $notify_update, } + apt::conf { 'options': + priority => 10, + content => template("${module_name}/options.erb"), + require => Package['unattended-upgrades'], + notify_update => $notify_update, + } } diff --git a/manifests/params.pp b/manifests/params.pp index e9a7605..29bc891 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -10,7 +10,10 @@ class unattended_upgrades::params { $default_backup = { 'archive_interval' => 0, 'level' => 3, } $default_age = { 'min' => 2, 'max' => 0, } $default_upgradeable_packages = { 'download_only' => 0, 'debdelta' => 1, } - + $default_options = { 'force_confdef' => true, + 'force_confold' => true, + 'force_confnew' => false, + 'force_confmiss' => false, } # prior to puppet 3.5.0, defined couldn't test if a variable was defined # strict variables wasn't added until 3.5.0, so this should be fine. if ! $::settings::strict_variables { -- cgit v1.2.3