diff options
author | Gabriel Filion <lelutin@gmail.com> | 2012-04-08 20:24:03 -0400 |
---|---|---|
committer | Gabriel Filion <lelutin@gmail.com> | 2012-04-08 20:24:03 -0400 |
commit | 506767d73515f79e05057df928bf7baa94b0dfcc (patch) | |
tree | 9a70e4d38b26f9fb9633cf28402d1d79207c5e83 | |
parent | c0afea193ef40786fb61cbab24f6e9366f157264 (diff) |
Fail when trying to ensure an installed version on FreeBSD
The two package providers for FreeBSD are not able to ensure that a
specific version of a package is installed because of how ports/pkg_add
work. They can only ensure the version from the specified FreeBSD
release is installed or absent.
For more information, see:
http://docs.puppetlabs.com/references/stable/type.html#features-4
To make the class easier to understand, let's not do something that
users don't expect when they're requesting installation of a specific
version. We'll explicitly fail and tell users why so that they can
adjust how they use the class/module.
Signed-off-by: Gabriel Filion <lelutin@gmail.com>
-rw-r--r-- | manifests/freebsd.pp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/manifests/freebsd.pp b/manifests/freebsd.pp index 3d0995d..cdce989 100644 --- a/manifests/freebsd.pp +++ b/manifests/freebsd.pp @@ -1,11 +1,20 @@ class puppet::freebsd inherits puppet::base { - if !$puppet_ensure_version { $puppet_ensure_version = 'installed' } + case $puppet_ensure_version { + '': { $puppet_ensure_version = 'installed' } + 'removed','absent','installed', 'present': {} # those values are OK + default: { fail('Package providers for FreeBSD cannot ensure that a specific version is installed.') } + } + case $facter_ensure_version { + '': { $facter_ensure_version = 'installed' } + 'removed','absent','installed', 'present': {} # those values are OK + default: { fail('Package providers for FreeBSD cannot ensure that a specific version is installed.') } + } + package { 'puppet': ensure => $puppet_ensure_version, } - if !$facter_ensure_version { $facter_ensure_version = 'installed' } package { 'facter': ensure => $facter_ensure_version, } |