The Puppet Labs Issue Tracker has Moved:

This issue tracker is now in read-only archive mode and automatic ticket export has been disabled. Redmine users will need to create a new JIRA account to file tickets using See the following page for information on filing tickets with JIRA:

Bug #2379

Puppet::Util should not be included in Puppet::Parser::TemplateWrapper

Added by Thomas Bellman almost 7 years ago. Updated almost 7 years ago.

Status:AcceptedStart date:07/01/2009
Priority:LowDue date:
Assignee:-% Done:


Target version:-
Affected Puppet version:0.24.8 Branch:

We've Moved!

Ticket tracking is now hosted in JIRA:


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.


#1 Updated by James Turnbull almost 7 years ago

  • Status changed from Unreviewed to Needs More Information
  • Assignee set to Luke Kanies

Any ideas? Memory isn’t a reserved word or a fact?

#2 Updated by Luke Kanies almost 7 years ago

  • Subject changed from Variable named "memory" is clobbered in templates to Puppet::Util should not be included in Puppet::Parser::TemplateWrapper
  • Status changed from Needs More Information to Accepted
  • Assignee deleted (Luke Kanies)
  • Priority changed from Normal to Low

This is because Puppet::Util is included in TemplateWrapper. This is probably unnecessary and could almost definitely be fixed relatively easily.

In the meantime, you can use ‘@memory’ as a trivial workaround.

Also available in: Atom PDF