If I'm remembering correctly, str2bool used to fail when passed a Boolean. Therefore, to be safe in *all* cases, you would want to use the prescribed method.
Trevor On Tue, Sep 15, 2015 at 5:53 PM, Clay Caviness <c...@boobah.com> wrote: > I'm going through our puppet configuration trying to get ready for an > eventual upgrade to puppet 4. > > One thing I'm curious about, though, is the use of str2bool. > > In the introduction to the future parser in the 3.8 documentation ( > http://docs.puppetlabs.com/puppet/3.8/reference/experiments_future.html#facts-can-have-additional-data-types), > the suggestion for having code that works in both puppet 3 and 4 is to: > * Interpolate the fact into a string ("$is_virtual")… > * …then pass the string to the stdlib str2bool function > (str2bool("$is_virtual")). > > However, I'm not sure why interpolating into a string is necessary? If you > pass a bool into str2bool, you get that bool right back out, and my tests > (with puppet 3.8 and with and without --parser=future) show that > interpolating into a string first isn't necessary. > > Is there a subtlety I'm missing? > > Thanks > > -- > 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/1de2bcbe-a2ee-4f3a-ae6d-79720f62dc96%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-users/1de2bcbe-a2ee-4f3a-ae6d-79720f62dc96%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Trevor Vaughan Vice President, Onyx Point, Inc (410) 541-6699 -- This account not approved for unencrypted proprietary information -- -- 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/CANs%2BFoXgj7iNQxKKECzPgdimj8T-AKFYxji5btGwrkvAeY-HRw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.