diff options
author | varac <varacanero@zeromail.org> | 2013-03-03 09:26:49 +0100 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2013-03-03 09:26:49 +0100 |
commit | e596bfb9306664ab4aef78bc05615904b7c6e7f2 (patch) | |
tree | d9759fedf3bdfdb4a4cd3aac1e3747abbeaacbd3 /manifests/preferences_snippet.pp | |
parent | 08b066db441375d1613d131767cb1c5bdd3bb60b (diff) | |
parent | d51e2af9d452731f63b2fe16391e9cd2ff9d640f (diff) | |
download | puppet-apt-e596bfb9306664ab4aef78bc05615904b7c6e7f2.tar.gz puppet-apt-e596bfb9306664ab4aef78bc05615904b7c6e7f2.tar.bz2 |
Merge remote-tracking branch 'remotes/origin/master' into nadir_master
Conflicts:
README
files/50unattended-upgrades
files/lenny/50unattended-upgrades
files/squeeze/50unattended-upgrades
manifests/dist_upgrade.pp
manifests/init.pp
manifests/upgrade_package.pp
Diffstat (limited to 'manifests/preferences_snippet.pp')
-rw-r--r-- | manifests/preferences_snippet.pp | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/manifests/preferences_snippet.pp b/manifests/preferences_snippet.pp index 6a8e6bc..5ae748b 100644 --- a/manifests/preferences_snippet.pp +++ b/manifests/preferences_snippet.pp @@ -1,33 +1,37 @@ -define apt::preferences_snippet( +define apt::preferences_snippet ( + $priority = undef, $package = false, $ensure = 'present', $source = '', $release = '', - $pin = '', - $priority ) -{ + $pin = '' +) { $real_package = $package ? { false => $name, default => $package, } - if $custom_preferences == false { - fail("Trying to define a preferences_snippet with \$custom_preferences set to false.") - } + if $ensure == 'present' { + if $custom_preferences == false { + fail('Trying to define a preferences_snippet with $custom_preferences set to false.') + } - if !$pin and !$release { - fail("apt::preferences_snippet requires one of the 'pin' or 'release' argument to be set") - } - if $pin and $release { - fail("apt::preferences_snippet requires either a 'pin' or 'release' argument, not both") - } + if $priority == undef { + fail('apt::preferences_snippet requires the \'priority\' argument to be set') + } - include apt::preferences + if !$pin and !$release { + fail('apt::preferences_snippet requires one of the \'pin\' or \'release\' argument to be set') + } + if $pin and $release { + fail('apt::preferences_snippet requires either a \'pin\' or \'release\' argument, not both') + } + } - concat::fragment{"apt_preference_${name}": + file { "/etc/apt/preferences.d/${name}": ensure => $ensure, - target => '/etc/apt/preferences', + owner => root, group => 0, mode => '0644'; } # This should really work in the same manner as sources_list and apt_conf @@ -37,19 +41,19 @@ define apt::preferences_snippet( '': { case $release { '': { - Concat::Fragment["apt_preference_${name}"]{ - content => template("apt/preferences_snippet.erb") + File["/etc/apt/preferences.d/${name}"]{ + content => template('apt/preferences_snippet.erb') } } default: { - Concat::Fragment["apt_preference_${name}"]{ - content => template("apt/preferences_snippet_release.erb") + File["/etc/apt/preferences.d/${name}"]{ + content => template('apt/preferences_snippet_release.erb') } } } } default: { - Concat::Fragment["apt_preference_${name}"]{ + File["/etc/apt/preferences.d/${name}"]{ source => $source } } |