On 2/11/15 7:33 PM, Joseph Karns wrote: > Leam: > > The reason you are getting the 400 Error is because you don't have > $osfamily defined. > > You can write your case statement as such: > > case $::osfamily { > 'redhat': { > # do something RHEL specific > } > 'debian': { > # do something Debian specific > } > default: { > # ... > } > } > > Thanks > Joey >
Hi Leam, I agree with Joseph's example here of using the case statement with the addition that the default case be to fail(). This way the module will work for explicitly defined platforms and fail on anything else. Better to fail the compilation of the catalog than to make assumptions about the agent and do the wrong thing. Here's an example[1] from my nscd module. You will generally just have variables set to different values based on the platform, though you may have actual resources as well. Just be sure that you are not duplicating resources in each of the cases as this violates DRY[2]. [1] - https://github.com/ghoneycutt/puppet-module-nscd/blob/master/manifests/init.pp#L103-172 [2] - http://en.wikipedia.org/wiki/Don%27t_repeat_yourself Best regards, -g -- Garrett Honeycutt @learnpuppet Puppet Training with LearnPuppet.com Mobile: +1.206.414.8658 -- 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/54DBAECF.2080004%40garretthoneycutt.com. For more options, visit https://groups.google.com/d/optout.