2

Verbose Puppet runs are verbose. To make sure the user notices a custom warning message, it would be good to print it only at the end of the run. Is this possible without major breakage of the Puppet execution model?

  • 1
    I would try to move the error message(s) to a sub class, then use Run Stages to run it as the last one. – Franklin Piat Apr 8 '15 at 21:57
  • @FranklinPiat If you could provide a working example, that would make for a good answer. – l0b0 Apr 8 '15 at 22:18
1

You can use:

notify{"That's all folks!": }

There are a few ways you could do this. You could make your init.pp look like:

class foo {
    class  { '::foo::begin': }
    class  { '::foo::end': require => Class['::foo::begin']  }
}

Or you could define custom run stages which is really up to you how you define it. Here's the link:

https://docs.puppetlabs.com/puppet/latest/reference/lang_run_stages.html

  • Do you have a working example? I already know how to use notify, it's the whole "make it run last" part that is actually the problem. – l0b0 Jan 21 '16 at 20:39
  • sure, edited my answer – Mike Thoma Jan 26 '16 at 12:34
  • I was really hoping for an example where the message is printed at the end of the Puppet run. The example does not demonstrate this. – l0b0 Feb 1 '16 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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