Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Say I have a manifest that has a different action for each version of Debian

case $lsbdistcodename{
'squeeze':{//stuff}
'lenny' : {//stuff}
default : die

I want the manifest to throw a fatal error. I guess the question is, how do I die(if you will)?
Puppet agent/master version 0.24.6.

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

You can use the fail function for that. I usually do something like this:

class postfix::params {
  case $::operatingsystem {
    Debian, Ubuntu: {
      $postfix_package_name       = 'postfix'
      $postfix_postmap_command    = '/usr/sbin/postmap'
      $postfix_service_name       = 'postfix'
    }
    default: { fail("${::hostname}: Module ${::module_name} does not support operatingsystem ${::operatingsystem}") }
  }
}

This makes the module fail on Puppet nodes that are not running Debian or Ubuntu.

Oh, and please, for the love of all that is good and holy, upgrade your Puppet installation. 0.24 is ancient and I don't think it is even supported any more. Puppetlabs provide up-to-date stable packages (see apt.puppetlabs.com), or you can use the ones from http://backports-master.debian.org/.

share|improve this answer
    
We are in the process of updating to 2.6.* We are a little behind the curve. –  NickP Apr 10 '12 at 18:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.