It looks like we do: https://github.com/puppetlabs/puppet/blob/master/lib/puppet/parser/scope.rb#L652-L654
On Wed, Jul 15, 2015 at 12:39 PM Trevor Vaughan <[email protected]> wrote: > Fair enough, and we usually do that. I just wanted to know what was frozen > so that we could properly duplicate it in our spec tests. > > Out of curiosity, why not freeze all strings from Facter? > > On Wed, Jul 15, 2015 at 3:22 PM, Peter Huene <[email protected]> > wrote: > >> On Wed, Jul 15, 2015 at 12:18 PM, Trevor Vaughan <[email protected]> >> wrote: >> >>> Indeed, I did change it to that but it would still be nice to know >>> what's going on so that I can stuff it into rspec and check for it. >>> >>> >> Puppet's compiler intentionally freezes $trusted and its values. If you >> intend to support operating on arguments like this, you should be creating >> a copy and not modifying the argument (probably a good rule to follow >> anyway, especially for a function named "parse"). >> >> >>> Thanks, >>> >>> Trevor >>> >>> On Wed, Jul 15, 2015 at 2:59 PM, R.I.Pienaar <[email protected]> wrote: >>> >>>> >>>> >>>> ----- Original Message ----- >>>> > From: "Trevor Vaughan" <[email protected]> >>>> > To: "puppet-dev" <[email protected]> >>>> > Sent: Wednesday, July 15, 2015 7:50:36 PM >>>> > Subject: Re: [Puppet-dev] How do you know what variables are frozen? >>>> >>>> > In this case, it was a custom function that was tripping things up. >>>> > >>>> > Looking through the code, I *think* this was the scenario: >>>> > >>>> > 1) Fact => trusted['certname'] >>>> > 2) Function call to parse_host($trusted['certname']) >>>> > 3) Parse host: >>>> > >>>> > host = args.first >>>> > host.strip! # Here's the offender >>>> > >>>> > I also tried seeing if dup'ing the args would work, but it copies the >>>> > frozen attribute with the String object (which makes sense). >>>> > >>>> > So, I don't know if I was trying to modify something from a Fact or >>>> if the >>>> > object just happened to be carrying the 'frozen' status as it went >>>> along. >>>> >>>> so do not use strip! use x = something.strip? this way you dont try to >>>> modify anything in scope. >>>> >>>> -- >>>> 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 [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/puppet-dev/1753817636.200946.1436986745705.JavaMail.zimbra%40devco.net >>>> . >>>> 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 Developers" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoWKrP%2Btj%2BJsiENkam9q7ohLGQd5-Z5Gfa%3DoE%2BsSX2D%2Bvw%40mail.gmail.com >>> <https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoWKrP%2Btj%2BJsiENkam9q7ohLGQd5-Z5Gfa%3DoE%2BsSX2D%2Bvw%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> >> >> -- >> *Join us at **PuppetConf 2015, October 5-9 in Portland, OR - *www. >> <http://www.google.com/url?q=http%3A%2F%2Fwww.&sa=D&sntz=1&usg=AFQjCNEnS7itqgvQV3E4Se1fu4Um_UapSw> >> 2015.puppetconf.com >> <http://www.google.com/url?q=http%3A%2F%2F2015.puppetconf.com&sa=D&sntz=1&usg=AFQjCNE1uQL4Sh23Vr-XkPLa4xfNcoXSog> >> >> *Register early to save 40%!* >> >> -- >> 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 [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-dev/CACZQQfOK4iJk7KcFT9_9n3pU-4U90Cxnhw2660FdafMCuYAggg%40mail.gmail.com >> <https://groups.google.com/d/msgid/puppet-dev/CACZQQfOK4iJk7KcFT9_9n3pU-4U90Cxnhw2660FdafMCuYAggg%40mail.gmail.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 Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoWWtddJitXkpB56rMPsBBHgzXJ0XRxiKUO5rOQY5VAp8Q%40mail.gmail.com > <https://groups.google.com/d/msgid/puppet-dev/CANs%2BFoWWtddJitXkpB56rMPsBBHgzXJ0XRxiKUO5rOQY5VAp8Q%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Adrien Thebo | Puppet Labs -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CALVJ9S%2Bxfv-CRTvROrjscNaPsc-u2jzfBTBbCMWYfPBKumBrcw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
