Ask Your Question
0

Trouble with facts/hiera after puppet upgrade

asked 2017-06-13 08:46:16 -0500

Hello,

I'm attempting to upgrade puppet 3.8 -> 4.10 (just on vagrant right now). I'm having trouble getting my hiera paths to resolve.

facts.yaml

myfact: engineering

hiera.yaml

---
version: 5
hierarchy: # Most specific to least specific
  - name: "Yaml lists"
    datadir: /etc/puppetlabs/code/environments/%{::environment}/hieradata
    data_hash: yaml_data
    paths:
      - nodes/%{facts.myfact}.yaml

Command

puppet lookup --facts /vagrant/facts.yaml --hiera_config=/vagrant/modules/puppet/files/hiera.yaml --merge deep --environment some_environment --explain --compile classes

Searching for "classes"
  Global Data Provider (hiera configuration version 5)
    Using configuration "/vagrant/modules/puppet/files/hiera.yaml"
    Hierarchy entry "Yaml lists"
      Path "/etc/puppetlabs/code/environments/some_environment/hieradata/nodes/.yaml"
        Original path: "nodes/%{facts.myfact}.yaml"
        Path not found
Function lookup() did not find a value for the name 'classes

Problem

Notice how the path didn't fillin "myfact" at all. I've also tried where "myfact" is a symbol in the fact.yaml and I'm getting the same result. This behavior is also happening in puppet apply (which was working before upgrade). You'll notice that %{::environment} is working correctly though.

edit retag flag offensive close merge delete

Comments

I actually got it to work by using FACTER_myfact environment variable but the facts.yaml is still not working

tobowers gravatar imagetobowers ( 2017-06-14 01:38:45 -0500 )edit

dara_dir and data_bash should not be part of hierarchy. Can you please move them to defaults as mentioned in the doc and test again?

rajeevsharma gravatar imagerajeevsharma ( 2017-06-14 02:37:39 -0500 )edit

That's not what the docs say... that's only if there *is* a default (in my case there actually isn't). Also, this works with an environment variable but not the facts.yaml.

tobowers gravatar imagetobowers ( 2017-06-14 03:23:58 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-06-14 00:59:50 -0500

rajeevsharma gravatar image

It seems there's problem while converting your older hiera.yaml to version 5, particularly while defining backend and datadir. Can you please follow the steps here and check if it works?

edit flag offensive delete link more

Comments

Do you see a problem in the hiera.yaml I posted?

tobowers gravatar imagetobowers ( 2017-06-14 01:38:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2017-06-13 08:46:16 -0500

Seen: 33 times

Last updated: Jun 14