On 22/08/17 10:42, plapper...@gmail.com wrote:
Good morning :)

I'm currently writing a puppet module for the OpenBSD specific implementation of SNMPd, and was wondering if there is any elegant way  for the module to fail on unsupported operating systems?

With the params.pp-pattern, you can fail as the default of the OS-specific configuration; but how would I do this with the data comes via Hiera from the module itself (https://docs.puppet.com/puppet/4.10/hiera_migrate_modules.html#module-data-with-yaml-data-files)?

Of course I can simply leave the common.yaml empty and the module will fail with missing variables, but I'd rather have a helpful error message about an unsupported OS (which will be less confusing, should this module be used by someone else but me).


How about setting a value that represents a "poison pill" as the default (for example "not supported"). Then for all supported the value would be something other than the "poison pill". You then check if you got the "poison" and then error with a descriptive error message.


- henrik
--

Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/onhi9g%24m38%242%40blaine.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to