On 2015-15-07 12:22, Peter Huene wrote:
On Wed, Jul 15, 2015 at 12:18 PM, Trevor Vaughan <[email protected]
<mailto:[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").
Peter is right. Rule of thumb, never ever mutate arguments that are
given to you or that you lookup. Unfortunately deep freezing all values
has a high cost or we would do that extensively when the puppet runtime
returns values, or calls into user supplied logic.
Regards
- henrik
Thanks,
Trevor
On Wed, Jul 15, 2015 at 2:59 PM, R.I.Pienaar <[email protected]
<mailto:[email protected]>> wrote:
----- Original Message -----
> From: "Trevor Vaughan" <[email protected]
<mailto:[email protected]>>
> To: "puppet-dev" <[email protected]
<mailto:[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]
<mailto:puppet-dev%[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 <tel:%28410%29%20541-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]
<mailto:[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]
<mailto:[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.
--
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
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/mo79uh%24hq2%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.