Issue #3792 has been updated by James Turnbull.

Status changed from Unreviewed to Rejected


----------------------------------------
Bug #3792: Variables in site.pp don't really work right with selectors, 
possibly a problem with selectors on exported resources
http://projects.puppetlabs.com/issues/3792

Author: Joe McDonagh
Status: Rejected
Priority: Normal
Assigned to: 
Category: 
Target version: 
Affected version: 0.25.4
Keywords: variables site.pp exported resources
Branch: 


I've been moving a lot of repetitive strings into site.pp and started moving my 
nagios config vars into there. The problem I run into though is that I admin 
both OpenBSD and Linux boxes. The OpenBSD ones have slightly different paths 
for nagios stuff so take a look at this example from site.pp:

<pre>
$nagios_root_dir           = $kernel ? {
                                Linux   => "/etc/nagios3",
                                OpenBSD => "/etc/nagios"
                             }
</pre>

Now, have a look at this Linux box's (most definitely, without a doubt facter 
reports this is linux) error:

<pre>
err: Could not run Puppet configuration client: Could not find dependency 
File[/etc/nagios/nagios.puppet.d/services] for 
Nagios_service[@@check_nagios_on_binpatch-i386.mysite] at line 115
</pre>

What's a little odd is that the host that is exporting the nagios service IS 
OpenBSD. So maybe this isn't a selector in site.pp error, but a sort of node 
variable confusion with exported resources, I don't know.

The resource name for that file is derived partly from $nagios_root_dir. More 
specifically, this can be found later in site.pp:

<pre>
$nagios_cfg_dir            = "${nagios_root_dir}/nagios.puppet.d"
</pre>

And in the module where the actual resource is:

<pre>
      [
      "$nagios_cfg_dir/hosts",
      "$nagios_cfg_dir/services",
      "$nagios_cfg_dir/contacts",
      "$nagios_cfg_dir/commands",
      "$nagios_cfg_dir/contactgroups",
      "$nagios_cfg_dir/hostgroups"
      ]:
         ensure  => "directory",
         mode    => "755",
         require => File["$nagios_cfg_dir"];
   }
</pre>

Also, selectors seem to work as expected in site.pp for resource defaults:

<pre>
Package {
   ensure => "present",
   source => $kernel ? {
                OpenBSD => 
"ftp://ftp.openbsd.org/pub/${kernel}/${operatingsystemrelease}/packages/${hardwaremodel}/";,
                default => undef
             },
}
</pre>



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