puppet rspec with hiera helper, fails with error when class is parameterized

487 views
Skip to first unread message

Manish Sapariya

unread,
Aug 29, 2014, 8:07:48 AM8/29/14
to puppet...@googlegroups.com
Hi,
I have two classes as posted in this gist.

https://gist.github.com/msapariya/eca9f77c9f560f8a0e57

kp_ls derives from params and defines two variables.

I am using hiera-puppet-helper in my specs to run hiera
related tests.

However the test is failing with

 1) kp_ls
     Failure/Error: it { should compile }
     Puppet::Error:
       Error from DataBinding 'hiera' while looking up 'kp_ls::somevar': FileSystem implementation expected Pathname, got: 'Hash' on node testhost.example.com
     # ./spec/classes/init_spec.rb:17:in `block (2 levels) in <top (required)>'


If I disable the class parameters, the tests are running fine.
I could not get any clue from code or even googling the issue.

Thanks for any help.
Regards,
Manish

Martin Alfke

unread,
Aug 31, 2014, 6:57:25 AM8/31/14
to puppet...@googlegroups.com
Hi Manish,

On 29.08.2014, at 14:07, Manish Sapariya <msap...@gmail.com> wrote:

Hi,
I have two classes as posted in this gist.

https://gist.github.com/msapariya/eca9f77c9f560f8a0e57

kp_ls derives from params and defines two variables.

I am using hiera-puppet-helper in my specs to run hiera
related tests.

Do you know that rspec-puppet has direct hiera support?
There is no need for the hiera-puppet-herlper anymore:

merged on Dec 4th 2013

Documentation is available on the respec-puppet site

merged on Dec 9th 2013

There is also a blog article on how to make use of rspec-puppet with hiera automatic lookups.
For overwriting hiera variables you only have to add the params hash into your spec file.

hth,

Martin



However the test is failing with

 1) kp_ls
     Failure/Error: it { should compile }
     Puppet::Error:
       Error from DataBinding 'hiera' while looking up 'kp_ls::somevar': FileSystem implementation expected Pathname, got: 'Hash' on node testhost.example.com
     # ./spec/classes/init_spec.rb:17:in `block (2 levels) in <top (required)>'


If I disable the class parameters, the tests are running fine.
I could not get any clue from code or even googling the issue.

Thanks for any help.
Regards,
Manish

--
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 puppet-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/7bb2d34f-ec1f-4a9a-be3b-2b4ee1890e03%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Manish Sapariya

unread,
Sep 2, 2014, 5:05:56 AM9/2/14
to puppet...@googlegroups.com
Thanks Martin, I completely missed that.

Also, just for record, I was using hiera-puppet-herlper version 1.
When I build version 2 gem from github, it worked alright.

Regards,
Manish
Reply all
Reply to author
Forward
0 new messages