Issue #7077 has been updated by Zach Leslie.

Status changed from Unreviewed to Needs More Information

This is likely a scoping issue.  Since you mention the variable you are trying 
to use is defined in site.pp, I believe that you need to set a local variable 
in the same class that you are attempting to use the template in.  for example:

<pre>
class nagios {
   $myvariable = $::myvariable

  file { "/bla": content => template("nagios/bla") }

}
</pre>

Where using $:: defines that the variable lookup should be from topscope.  This 
will let you use $myvariable in the template.  Can you test and get back here 
with the results.  I think the "could not find relationship" error is also due 
to the same issue.
----------------------------------------
Bug #7077: Scoped definitions as well as 'global variables' (defined in 
site.pp) don't seem to work properly with stages
https://projects.puppetlabs.com/issues/7077

Author: Joe McDonagh
Status: Needs More Information
Priority: Normal
Assignee: 
Category: 
Target version: 
Affected Puppet version: 2.6.7
Keywords: stages
Branch: 


I just upgraded to 2.6.7 and decided to set up a pre and post stage for a 
couple of things:

<pre>
# Run Stages and what stage to run classes (default all classes run
# in main)
stage {
   "pre":   before   => Stage["main"];
   "post":  require  => Stage["main"];
}

class { 
   "apt":            stage => "pre";
   "nagios::target"  stage => "post";
   "nsca::client"    stage => "post";
}
</pre>

First, came the following errors:
<pre>
Tue Apr 12 17:51:40 -0700 2011 Puppet (err): Could not retrieve catalog from 
remote server: Could not intern from pson: Could not convert from pson: Could 
not find relationship target "Apt::Aptkey[]"
Tue Apr 12 17:51:40 -0700 2011 Puppet (err): Could not retrieve catalog; 
skipping run
</pre>

That define lives in the apt class set to run in the pre stage. So I comment 
the stage class stanza for apt and then I got:
<pre>
Tue Apr 12 20:43:25 -0400 2011 Puppet (err): Could not retrieve catalog from 
remote server: Error 400 on SERVER: Failed to parse template 
nagios/etc/default/nagios3.erb: Could not find value for 'nagios_root_dir' at 
/etc/puppet/production/modules/nagios/manifests/init.pp:291 on node builder Tue 
Apr 12 20:43:25 -0400 2011 Puppet (err): Could not retrieve catalog; skipping 
run
</pre>

This variable is defined in site.pp. I make pretty extensive use of defining 
variables in site.pp. It is worth noting that I do use environments and this 
was all in the production environment.


-- 
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