Issue #3726 has been updated by Daniel Pittman.

Description updated
Status changed from Unreviewed to Closed

At a guess, `PORT` is a global constant that someone, somewhere in supplied 
with some nice, magic behaviour.

Because we try to use `method_missing`, and don't have a matching 
`constant_missing` to match - and because the later wouldn't have fired anyhow, 
what with their being something in the PORT constant - we have this odd 
behaviour.

Today, using `@PORT` to access the variable will fix your problem.
----------------------------------------
Bug #3726: puppet sometimes incorrectly expands templates
https://projects.puppetlabs.com/issues/3726

Author: seph seph
Status: Closed
Priority: Normal
Assignee: 
Category: functions
Target version: 
Affected Puppet version: 0.25.4
Keywords: 
Branch: 


This is kinda weird... I have a template, it uses a bunch of variables, and has 
a for loop. Most of the time, it's fine. But occasionally puppet screws up the 
variable expansion.

My template looks like like:

<pre>
<% app_ports.each do |PORT| -%> 
 ##### mongrel <%= PORT %> #####
check process <%= ["mongrel", app_name, app_environment, PORT].join("-") %>  
with pidfile <%= ["/var/tmp/mongrel", PORT, "pid"].join(".") %>
  group indigo-<%= app_environment %>
  start program = "/usr/bin/ruby /usr/bin/mongrel_rails start -d -e <%= 
app_environment %> -p <%= PORT %> -P <%= ["/var/tmp/mongrel", PORT, 
"pid"].join(".") %> 
  stop  program = "/usr/bin/ruby /usr/bin/mongrel_rails stop -p <%= PORT %> -P 
<%= ["/var/tmp/mongrel", PORT, "pid"].join(".") %>"
<% end -%>
</pre>

There's some gnarly redirection around how it gets called, but I don't think 
that's the problem. See, what happens is for some fragments, it expands PORT 
differently. Like, sometimes the start line ends up with PORT=8005 while the 
stop line ends up with PORT=8007. PORT is always consistent inside a given 
line, but occasionally inconsistent in a stanza. 

The only hint I have, is that this seems more likely to occur if I'm running 
puppetd on 2 machines at the same time. But I've only seen this twice, so it's 
hard to pin it down. That said, it's a huge problem when it occurs.


-- 
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://projects.puppetlabs.com/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