On Thu, Sep 6, 2012 at 6:45 AM, Stefan Goethals <[email protected]> wrote:
> Hello,
>
> I am testing Puppet 3 with the built in hiera bindings.
>

Great! Thanks for trying it out and giving some feedback

> The yaml backend seems to work ok, though with renamed variables compared to
> using the hiera() functions.
>

Yes. The data bindings will construct the fully qualified name of the
variable (so class pt3 ($var) {} looks up pt3::var) in order to make
sure that they are kept unique.

> What does not seem to work for me is the puppet backend.
>

This is because of the name of the variables that are looked up. The
puppet backend will try to lookup pt3::data the variable named
pt3::var. This is a known limitation and the data bindings were not
meant to support the puppet backend.

> I have been using it without problems in puppet 2.7.x.
>

The way you were using it in 2.7.x should continue to work. And your
output below indicates that it still does.

> What i expect to see is the 'Debug: hiera(): Looking for data in
> p3t::data'like when using hiera().
>
> What i see is this 'Debug: hiera(): Looking for data in fake::data'
>
> As a result the file modules/p3t/manifests/data.pp is never queried when
> using the 'class p3t ( $somevar = '' )' syntax.
>
> The code is the following.
> hiera.yaml
>>
>> ---
>> :hierarchy:
>>   - common
>>
>> :backends:
>>   - puppet
>>
>>
>> :puppet:
>>   datasource: data
>
>
> modules/p3t/manifests/init.pp
>>
>> # 2 tries... (1 at a time of course..)
>>
>>
>> class p3t  ( $somevar = '' )
>> class p3t  ( $somevar = hiera('somevar','') )
>>
>>
>> {
>>   notify { "test: $somevar": }
>> }
>>
>
> puppept_backend.rb
>
>       def hierarchy(scope, override)
>         begin
>           data_class = Config[:puppet][:datasource] || "data"
>         rescue
>           data_class = "data"
>         end
>
>         # added Debug output here...
>         Hiera.debug( " scope :#{scope}: " )
>         Hiera.debug( " scope.resource :#{scope.resource}: " )
>         Hiera.debug( " scope.resource.name :#{scope.resource.name}: " )
>
>
>         calling_class = scope.resource.name.to_s.downcase
>>
>>         calling_module = calling_class.split("::").first
>
>
> server output
>>
>> # result of using class p3t  ( $somevar = '' )
>>
>> Debug: Automatically imported p3t from p3t into production
>> Debug: hiera(): Hiera Puppet backend starting
>> Debug: hiera(): Looking up p3t::somevar in Puppet backend
>> Debug: hiera():  scope
>> :#<Puppet::Indirector::Hiera::FakeScope:0x7f03abf1fdf0>:
>> Debug: hiera():  scope.resource :#<struct #<Class:0x7f03abf22de8>
>> name="fake">:
>> Debug: hiera():  scope.resource.name :fake:
>> Debug: hiera(): Looking for data in data::common
>> Debug: hiera(): Found data in class data::common
>> Debug: hiera(): Looking for data in fake::data
>> Debug: hiera(): Found data in class fake::data
>> Compiled catalog for pm3.lan.super-visions.com in environment production
>> in 0.15 seconds
>>
>>
>>
>> # and using class p3t  ( $somevar = hiera('somevar','') )
>>
>>
>> Debug: Automatically imported p3t from p3t into production
>> Debug: hiera(): Hiera Puppet backend starting
>> Debug: hiera(): Looking up p3t::somevar in Puppet backend
>> Debug: hiera():  scope
>> :#<Puppet::Indirector::Hiera::FakeScope:0x7f79f7558390>:
>> Debug: hiera():  scope.resource :#<struct #<Class:0x7f79f7560b58>
>> name="fake">:
>> Debug: hiera():  scope.resource.name :fake:
>> Debug: hiera(): Looking for data in data::common
>> Debug: hiera(): Found data in class data::common
>> Debug: hiera(): Looking for data in fake::data
>> Debug: hiera(): Found data in class fake::data
>> Debug: hiera(): Looking up somevar in Puppet backend
>> Debug: hiera():  scope :Scope(Class[P3t]):
>> Debug: hiera():  scope.resource :Class[P3t]:
>> Debug: hiera():  scope.resource.name :P3t:
>> Debug: hiera(): Looking for data in data::common
>> Debug: importing '/etc/puppet-modules/p3t/manifests/data.pp' in
>> environment production
>> Debug: hiera(): Looking for data in p3t::data
>> Compiled catalog for pm3.lan.super-visions.com in environment production
>> in 0.16 seconds
>
>
> Regards,
>
> Stefan - Zipkid - Goethals.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Puppet Developers" 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-dev?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" 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-dev?hl=en.

Reply via email to