From: Dan Carley Date: Mon, 16 Sep 2013 08:06:15 +0000 (+0100) Subject: [#153] Convert t/f params to bools and validate X-Git-Tag: 1.3.0~1^2~4 X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=ea40999381006587555f1e6cdcad2362292bc390;p=puppet-modules%2Fpuppetlabs-apt.git [#153] Convert t/f params to bools and validate Per lint check: http://puppet-lint.com/checks/quoted_booleans/ --- diff --git a/manifests/unattended_upgrades.pp b/manifests/unattended_upgrades.pp index e4ad4dc..0c4728f 100644 --- a/manifests/unattended_upgrades.pp +++ b/manifests/unattended_upgrades.pp @@ -20,13 +20,13 @@ class apt::unattended_upgrades ( $download = "1", $upgrade = "1", $autoclean = "7", - $auto_fix = "true", - $minimal_steps = "false", - $install_on_shutdown = "false", + $auto_fix = true, + $minimal_steps = false, + $install_on_shutdown = false, $mail_to = "NONE", - $mail_only_on_error = "false", - $remove_unused = "true", - $auto_reboot = "false", + $mail_only_on_error = false, + $remove_unused = true, + $auto_reboot = false, $dl_limit = "NONE", $enable = "1", $backup_interval = "0", @@ -38,6 +38,15 @@ class apt::unattended_upgrades ( $verbose = "0", ) { + validate_bool( + $auto_fix, + $minimal_steps, + $install_on_shutdown, + $mail_only_on_error, + $remove_unused, + $auto_reboot + ) + package { 'unattended-upgrades': ensure => present, } diff --git a/spec/classes/unattended_upgrades_spec.rb b/spec/classes/unattended_upgrades_spec.rb index 6695550..097f7a5 100644 --- a/spec/classes/unattended_upgrades_spec.rb +++ b/spec/classes/unattended_upgrades_spec.rb @@ -63,21 +63,21 @@ describe 'apt::unattended_upgrades', :type => :class do describe "with auto_fix => false" do let :params do - { :auto_fix => "false" } + { :auto_fix => false } end it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::AutoFixInterruptedDpkg "false";$/) } end describe "with minimal_steps => true" do let :params do - { :minimal_steps => "true" } + { :minimal_steps => true } end it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::MinimalSteps "true";$/) } end describe "with install_on_shutdown => true" do let :params do - { :install_on_shutdown => "true" } + { :install_on_shutdown => true } end it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::InstallOnShutdown "true";$/) } end @@ -93,7 +93,7 @@ describe 'apt::unattended_upgrades', :type => :class do describe "with mail_to => user@website, mail_only_on_error => true" do let :params do { :mail_to => "user@website", - :mail_only_on_error => "true" } + :mail_only_on_error => true } end it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Mail "user@website";$/) } it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::MailOnlyOnError "true";$/) } @@ -101,14 +101,14 @@ describe 'apt::unattended_upgrades', :type => :class do describe "with remove_unused => false" do let :params do - { :remove_unused => "false" } + { :remove_unused => false } end it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Remove-Unused-Dependencies "false";$/) } end describe "with auto_reboot => true" do let :params do - { :auto_reboot => "true" } + { :auto_reboot => true } end it { should contain_file('/etc/apt/apt.conf.d/50unattended-upgrades').with_content(/^Unattended-Upgrade::Automatic-Reboot "true";$/) } end