Suppose you have an arbitrary requirement that must be met for a puppet module to run. How would you cause the puppet module to exit gracefully?
For example, say my module requires puppet 3.2 or newer to run successfully. If the module attempts to run on 3.1.x it will fail (non gracefully).
I could do a Notify, notice, alert or warning
http://docs.puppetlabs.com/references/latest/function.html#warning
Since you can't compare strings with integers using normal puppet comparison operators, you need to use the versioncmp() function.
if versioncmp("${::puppetversion}", '3.0.0') < 0 {
fail("foo requires foo 3.0.0 or greater, found: \'$::puppetversion\'")
}
ramindk from the puppet irc chanel also points out that you could use regular expressions:
if $::puppetversion =~ /^3/ {
fail("foo requires foo 3.0.0 or greater, found: \'$::puppetversion\'")
}