Boy... accessing hashes in puppet is downright painful.

I have this in a yaml file...

glusterfs_volumes:
  gfsvol01:
    master_node: gfs01.us1.xxx.com
    transport: tcp
    replicas: 0
    nodes:
      - gfs01.us1.xxx.com
        hostname: gfs01
        state: mounted
      - gfs02.us1.xxx.com
        hostname: gfs02
        state: unmounted
      - gfs03.us1.xxx.com
        hostname: gfs03
        state: mounted

I'm loading it with:

    $config      = hiera('glusterfs_volumes')
    $nodes       = $config['gfsvol01']['nodes']
    ... etc

Works fine. I'm also calling a definition like this:

    glusterfs::add_bricks {
        [$nodes]:
            master_node => "$master_node",
            brick_store => "$brick_store",
            volume_name => "$name",
            require     => Glusterfs::Add_peers[$nodes];
    }

The question is, how do I access the hostname and state keys inside each node?

The following (inside add_bricks):

    $node = $name['hostname']
    notice ("DEBUG nodes=$name")
    notice ("DEBUG NODE=$node")

yields, for each call to add_bricks:

DEBUG nodes=statemountedgfs01.us1.xxx.com hostnamegfs01
DEBUG NODE=

I can see the hash in $name... I just can't access the 'state' or
'hostname' keys, which are obviously there.

How...?

Doug.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to