Ok, I figured out how to put in Notice Statements : )
I took foreman out of the equation for testing purposes, and I'm now
using standard puppet node definitions.
Here's the node:
node server1 {
$group = ["test"]
include basics1
}
Here's the class:
class basics1{
require host_collect
notice("The Value is ${group}")
class host_export { notice("The Value is ${group}") @@host{ "$fqdn":
ip => $ipaddress,
host_aliases => $hostname,
tag => $group
}}
class host_collect { require host_export notice("The Value is $
{group}") Host <<| tags == "$group" |>> }
Here's the result from the server side (debug mode):
debug: Using cached facts for server1.dev.domain.com
info: Caching node for server1.dev.domain.com
debug: importing '/etc/puppet/manifests/classes/dev_sys.pp'
debug: importing '/etc/puppet/manifests/classes/test_class.pp'
debug: importing '/etc/puppet/manifests/nodes/dev_nodes.pp'
notice: Scope(Class[basics1::host_export]): The Value is test
notice: Scope(Class[basics1::host_collect]): The Value is test
notice: Scope(Class[basics1]): The Value is test
debug: Scope(Class[basics1::host_collect]): Collected 0 Host resources
in 0.00 seconds
notice: Compiled catalog for server1.dev.domain.com in 0.17 seconds
info: Caching catalog for server1.dev.domain.com
debug: Searched for resources in 0.01 seconds
debug: Searched for resource params and tags in 0.00 seconds
debug: Resource removal in 0.20 seconds
debug: Resource merger in 0.06 seconds
debug: Added resources(tags) in 0.08 seconds
debug: Added resources(initialization) in 0.02 seconds
debug: Added resources(parameters) in 0.02 seconds
debug: Resource addition in 0.12 seconds
debug: Performed resource comparison in 0.39 seconds
debug: Using cached node for server1.dev.domain.com
debug: Saved catalog to database in 0.41 seconds
info: Applying configuration version '1284564089'
Still... is not collecting the hosts even thought the $var values
correct/exported.... Any ideas?
Thanks,
On Sep 15, 9:37 am, CraftyTech <[email protected]> wrote:
> Pardon my ignorance, but how do I do a notice statement? I checked
> the puppet database and the value is there:
>
> mysql> select * from parameters where host_id = 133;
> +----+--------+-------+---------+---------------------
> +---------------------+--------------+---------------+-----------+
> | id | name | value | host_id | created_at |
> updated_at | hostgroup_id | type | domain_id |
> +----+--------+-------+---------+---------------------
> +---------------------+--------------+---------------+-----------+
> | 45 | $group | test | 133 | 2010-09-14 17:04:15 | 2010-09-14
> 19:19:53 | NULL | HostParameter | NULL |
> +----+--------+-------+---------+---------------------
> +---------------------+--------------+---------------+------
>
> I'm using puppet 0.25.5/ MySql for stored configs / Foreman for Ext
> Nodes.
>
> On Sep 15, 4:28 am, Brice Figureau <[email protected]>
> wrote:
>
>
>
> > On Tue, 2010-09-14 at 17:21 -0700, CraftyTech wrote:
> > > Has anyone used this feature?
>
> > Yes I do and it works fine.
> > What db engine are you using?
> > See below for more ideas of debugging the issue.
>
> > > On Sep 14, 4:08 pm, CraftyTech <[email protected]> wrote:
> > > > btw: I'm running puppet 0.25.5
>
> > > > On Sep 14, 3:53 pm, CraftyTech <[email protected]> wrote:
>
> > > > > Hello All,
>
> > > > > I've been battling with issue all day to no avail. I'm exporting
> > > > > all host entries this way:
> > > > > class basics::host_export { @@host{ "$fqdn":
> > > > > ip => $ipaddress,
> > > > > host_aliases => $hostname,
> > > > > tag => $group
> > > > > }}
> > > > > and I'm collecting them this way:
> > > > > class basics::host_collect { Host <<|tag==$group |>> }
>
> > > > > The values for $group is obviously defined. The thing is that
> > > > > specifying the tag=>$group doesn't work for me, I always get (from
> > > > > debug mode):
>
> > > > > debug: Scope(Class[basics::basics::host_collect]): Collected 0 Host
> > > > > resources in 0.01 seconds..
>
> > > > > It doesn't collect any nodes even though I've defined a couple. If I
> > > > > do the same thing without the tag definition, it works fine; i.e:
>
> > > > > class basics::host_export { @@host{ "$fqdn":
> > > > > ip => $ipaddress,
> > > > > host_aliases => $hostname
> > > > > }}
> > > > > class basics::host_collect { Host <<| |>> }
>
> > > > > The thing is that I don't want to get all hosts, I want to filter per
> > > > > group. Can anyone share how they're doing this? Thanks,
>
> > Are you sure you already have exported some hosts?
> > You can check your exported resources database for this resource, they
> > should have the exported column non-null (or 1).
>
> > You should also check, still in the database, that this resource is
> > tagged with the correct value of $group.
>
> > Check $group is defined in both classes (use some notice statement to
> > debug). It is possible that because of scope issues $group is not
> > defined when you collect.
>
> > Try to collect by title (ie title == "knownhost") to see if that works
> > better. That will let you know if the system is working correctly for
> > you.
>
> > HTH,
> > --
> > Brice Figureau
> > Follow the latest Puppet Community evolutions onwww.planetpuppet.org!
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" 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-users?hl=en.