Ah, sorry, my mistake, mised the version. That line would have to be

class classB ($param1 = hiera('classB::param1', '')) {

with the hiera call in the definition. Sorry about that :P

On Thursday, February 21, 2013 11:57:24 AM UTC-8, Sai_Emc wrote:
>
> Mark,
>  
> Thanks for the quick reply.
>  
> "This uses the auto lookup of parameters. It will perform a hiera search 
> for 'classB::param1'."  --> Auto lookup feature what you mentioned is in PE 
> 2.7? I remember reading as 3.0 feature.
>  
> Regards
> Sai.
> EMC
>
> On Thursday, February 21, 2013 2:32:10 PM UTC-5, Ellison Marks wrote: 
>
>> quick definitions first:
>>
>> hiera() gets a value from the backend. stops searching after it finds a 
>> value. the value can be any data type.
>> hiera_array() gets multiple values from the backend, combining them into 
>> one large array as possible.
>> hiera_hash() gets multiple values from the backend, combining them into 
>> one large hash as possible.
>> hiera_include() calls hiera_array() and then includes each classname 
>> returned.
>>
>> Ok, so hiera_include will look in the backend for a variable named in the 
>> call, in your case 'classesA'. this should contain an array of class names 
>> to include. As your hierarchy apparently doesn't contain the variable 
>> 'classesA', this explains the second error you are getting. You also didn't 
>> include the variable 'classesH' in nodeA.yaml, so that might be the cause 
>> of the failure there. create_resources is also not used on classes, just 
>> types or defines. Generally, for hiera_include, it should look sort of like 
>> this.
>>
>> class classA {
>>  notice("ClassA") 
>> }
>>
>> class classB ($param1 = '') { #This uses the auto lookup of parameters. 
>> It will perform a hiera search for 'classB::param1'.
>>  notice ("ClassB: ParamValue $param1")
>> }
>>
>>
>> NodeA.yaml
>> ---
>> classes:
>>  - a
>>
>> NodeB.yaml
>> ---
>> classes:
>>  - b
>>
>> 'classB::param1': 'Puppet-Hiera'
>>
>> node default {
>>    hiera_include('classes', []) #empty array, not empty string, which 
>> might also have been messing things up.
>>
>>   }
>> }
>>
>>
>> On Thursday, February 21, 2013 10:55:59 AM UTC-8, Sai_Emc wrote: 
>>>
>>> I am looking for few clarifications on puppet-hiera integration.
>>>
>>> Trying to move away completly from using site.pp. For that I started 
>>> exploring Hiera. End of the day I want an external system prepare yaml 
>>> files automatucally based on user requests.
>>>
>>> Environment: Ubuntu12.04, PE 2.7, Hiera 1.1.2 
>>>
>>> EX:
>>> class classA {
>>>  notice("ClassA") 
>>> }
>>>
>>> class classB ($param1 = '') {
>>>  notice ("ClassB: ParamValue $param1")
>>> }
>>>
>>>
>>> Now I am want to include these two classes into two different nodes, so 
>>> prepared two yaml files
>>>
>>> hiera.yaml
>>> ---
>>> :hierarchy:
>>>     - %{::clientcert}
>>>     - common
>>> :backends:
>>>     - yaml
>>> :yaml:
>>>     :datadir: '/etc/puppetlabs/puppet/hieradata'
>>>
>>> NodeA.yaml
>>> ---
>>> emcutil::a:
>>>  - a
>>>
>>> NodeB.yaml
>>> ---
>>> classesH:
>>>  emcutil::b:
>>>      param1: 'Puppet-Hiera'
>>>
>>>
>>> As I have classes as array and hash, so added below code in site.pp 
>>> default section so that I can include hash and arrays.
>>>   
>>> node default {
>>>    hiera_include('classesA','')
>>>    $param_packagesH = hiera_hash('classesH')
>>>    create_resources('class',$param_classesH)
>>>   }
>>> }
>>>
>>> This approach does not work.
>>>
>>> On NodeA following error:
>>>  err: Could not retrieve catalog from remote server: Error 400 on 
>>> SERVER: undefined method `empty?' for nil:NilClass at 
>>> /etc/puppetlabs/puppet/environments/development/manifests/site.pp:48 on node
>>> On NodeB following error:
>>>  err: Could not retrieve catalog from remote server: Error 400 on 
>>> SERVER: Could not find data item classesA in any Hiera data file and no 
>>> default supplied at 
>>> /etc/puppetlabs/puppet/environments/development/manifests/site.pp:46 on node
>>>  
>>> What I am doing here is valid?
>>> If we are using hiera_include or hiera_hash all the node yaml files 
>>> should have all the targets and the target returns not null values? 
>>> Do we have alternatives other than using hiera, hiera_include and 
>>> hiera_hash?
>>> PE 2.7 do we need to do any configuration for Hiera, apart from 
>>> puppet-hiera package. Specifically related to these two attributes 
>>> node_terminus, external_nodes?
>>> With Hiera we can move away from site.pp completly. My understanding is 
>>> correct on Hiera?
>>>
>>> Any help on this greatly appreciated.
>>>
>>> Sai.
>>> EMC Corporation.
>>>   
>>>   
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to