Issue #2379 has been reported by Thomas Bellman.

----------------------------------------
Bug #2379: Variable named "memory" is clobbered in templates
http://projects.reductivelabs.com/issues/2379

Author: Thomas Bellman
Status: Unreviewed
Priority: Normal
Assigned to: 
Category: functions
Target version: 
Complexity: Unknown
Affected version: 0.24.8
Keywords: 


If I have a variable named $memory in my manifests, I can't
access that from templates.  Instead I get some semi-random
number.

    node default {
        $memory = 4711
        notice(inline_template("memory = <%= memory %>"))
    }

This gives me the output

    notice: Scope(Node[default]): memory = 105436

but the exact number varies between runs.  It seems to stay at
approximately 100'000, though.

Other variable names work fine.  If I rename it to $xmemory, it
works as expected.  It isn't a clash with facter facts either,
because facter doesn't report any fact named "memory".  Even if
it were, assignments inside the manifests override facts; if I
use $memorysize in the example above (which is a fact), I get
4711 as expected.

I tried to add some instrumentation to parser/templatewrapper.rb,
but couldn't find find anything interresting.  method_missing()
isn't called for "memory", and result() doesn't call
instance_variable_set() with "memory".  Likewise, binding.memory
doesn't exist.  But my Ruby knowledge is fairly rudimentary, so
take that bit of debugging with a grain of salt.

This happens with at least 0.24.8 on CentOS 5.3, and a Git
snapshot of 0.25 (769c8aa71e5b4855662314f13b1197853cdc843a)
on Fedora 9.



-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://reductivelabs.com/redmine/my/account

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-bugs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to