Hi folks, last week I proposed we add a function to puppetlabs-apache which converts puppet booleans to httpd's On/Off.
https://github.com/puppetlabs/puppetlabs-apache/pull/782 of course that has no straight-forward approach, because in some cases httpd will allow boolean values, as well as strings https://httpd.apache.org/docs/current/mod/core.html#acceptpathinfo https://httpd.apache.org/docs/current/mod/core.html#usecanonicalname to name only a few. My first throw of naming the function bool2httpd(), allowing it to map /on/i, /true/i, true, 1, => 'On' /off/i, /false/i, false, 0, nil, :undef => 'Off' and otherwise, simply returning whatever we got lead to the effect of having a *bad* name. Looking at it now, the solution to this seems simple: Rename the function to normalise_bool(), allow it an optional parameter (a regex?) that validates the outliers. But what about the general problem of mapping a sub-system's directives and the values they can take to puppet-friendly names, and validating their types and ranges? It seems a lot of energy is expended in our manifests, templates, or types/providers to that task. Especially when a system has a rich set of directives, this can become very cumbersome. If you have similar pains, I invite you to share your stories here. Maybe someone can think of a solution for your problem, or maybe we can even find a more general solution. So long, -- i Igor Galić Tel: +43 (0) 664 886 22 883 Mail: i.ga...@brainsware.org URL: http://brainsware.org/ GPG: 8716 7A9F 989B ABD5 100F 4008 F266 55D6 2998 1641 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/440824986.75047.1404432705369.JavaMail.zimbra%40brainsware.org. For more options, visit https://groups.google.com/d/optout.