On Wed, Aug 22, 2012 at 1:34 PM, Douglas Garstang
<doug.garst...@gmail.com> wrote:
> On Wed, Aug 22, 2012 at 11:08 AM, Douglas Garstang
> <doug.garst...@gmail.com> wrote:
>> On Tue, Aug 21, 2012 at 11:51 PM, Douglas Garstang
>> <doug.garst...@gmail.com> wrote:
>>> On Tue, Aug 21, 2012 at 11:44 PM, Douglas Garstang
>>> <doug.garst...@gmail.com> wrote:
>>>> On Tue, Aug 21, 2012 at 11:19 PM, Stephen Gran
>>>> <stephen.g...@guardian.co.uk> wrote:
>>>>> Hi,
>>>>>
>>>>> On Tue, 2012-08-21 at 21:00 -0700, Douglas Garstang wrote:
>>>>>> I know I did this once before but can't find docs on how to do it again.
>>>>>>
>>>>>> I have this in a yaml file:
>>>>>>
>>>>>> pvdisks:
>>>>>>     ec2_pvdisks_m1.small:
>>>>>>         disks: /dev/xvdb1
>>>>>>         enabled: yes
>>>>>>
>>>>>> Loading it with hiera.
>>>>>>
>>>>>> Manifest has:
>>>>>>
>>>>>>     $testkey = hiera('pvdisks')
>>>>>>     notice ("TESTKEY=$testkey[ec2_pvdisks_m1.small]")
>>>>>>
>>>>>> This is printing
>>>>>> TESTKEY=ec2_pvdisks_m1.smalldisks/dev/xvdb1enabledtrue['ec2_pvdisks_m1.small']
>>>>>
>>>>> Try inspecting it some other way than printf debugging - notice always
>>>>> flattens variables by calling .to_s on them, so it is not a very useful
>>>>> tool.  I am assuming that things are indeed fine, but this is confusing
>>>>> matters.
>>>>
>>>> I've since learned that I have to use hiera_array and hiera_hash,
>>>> which aren't documented anywhere.
>>>>
>>>> Now I've got:
>>>>
>>>> ec2_config:
>>>>   instance:
>>>>   m1.small:
>>>>     pvdisks:
>>>>     - /dev/xvdb1
>>>>     swapvol_size: 2G
>>>>     logvol_size: 64G
>>>>   m1.medium:
>>>>     pvdisks:
>>>>     - /dev/xvdb1
>>>>     swapvol_size: 2G
>>>>     logvol_size: 64G
>>>>   m1.large:
>>>>     pvdisks:
>>>>     - /dev/xvdb1
>>>>     - /dev/xvdc1
>>>>     swapvol_size: 4G
>>>>     logvol_size: 64G
>>>>
>>>> and I've tried to access the data every witch way.
>>>>
>>>> This gives me a syntax error...
>>>> $pvdisks = 
>>>> hiera_array(ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>>
>>>> and this:
>>>> $pvdisks = 
>>>> hiera_array($ec2_config['instance'][$::ec2_instance_type]['pvdisks'])
>>>>
>>>> gives me:
>>>> err: Could not retrieve catalog from remote server: Error 400 on
>>>> SERVER: ec2_config is not an hash or array when accessing it with
>>>> instance at /truth/sauce/env/prod/modules/role/manifests/base_server.pp:27
>>>> on node gfs01.us1.xxx.com
>>>>
>>>> Ugh.
>>>>
>>>> Doug.
>>>
>>> Actually, apparently, no, that's not what these functions are for. :(
>>>
>>> Doug.
>>
>> :(
>
> Apparently this is difficult and/or not supported...

Is this what you're trying to do?

    $ec2_config = hiera('ec2_config')
    $pvdisks = $ec2_config['instance'][$::ec2_instance_type]['pvdisks']


http://docs.puppetlabs.com/puppet/2.7/reference/lang_datatypes.html#hashes

HTH,
Justin

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

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