Using deep facter facts in rspec tests?

asked 2018-08-02 07:12:31 -0500

bluedread gravatar image

Hi,

I just started to convert one of our homebuilt modules into PDK format with the intention of open-sourcing it soon.

The module uses ERB templates in which facter facts are used to fill in some variables, like this:

template.erb:

Pin: version 1.10.1-1<%= @os['distro']['codename'] %>

When using pdk test unit it fails because @os['distro']['codename'] is an empty variable, which is understandable.

I tried to define it in $modulepath/spec/default_facts.yml in different formats, but I can't seem to find the right notation:

os.distro.codename: 'xenial'

os::distro::codename: 'xenial'

Both don't work.

I worked around it by using @lsbdistcodename in the template for now, but I'm interested in the correct approach to using deeper facter facts in default_facts.yml?

edit retag flag offensive close merge delete