Good evening everyone,
I'm having a problem while getting some information from a yaml file via hiera and I've been hours with it without knowing how to find the solution.
In the .pp I make the following lookup:
files = hiera_hash('common::files', $files)
In the hiera file I have an entry in the form:
common::files:
'/my/file':
content: 'something simple'
'/my/file2':
content: 'something simple again'
Then I get the following error:
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Lookup of key 'common::files' failed: Value for key 'common::files', in hash returned from data_hash function 'yaml_data', when using location '/etc/puppetlabs/code/environments/my_env/hieradata/common.yaml', has wrong type, expects Puppet::LookupValue, got Hash[Data, Hash[Enum['content', 'ensure', 'target'], Enum['/opt/puppetlabs/bin/fact.-....
Just as if I couldn't get the value and I can't understand anything because it looks like a "internal" problem with gems and so on. I'm suspecting that because whenever I make a lookup in the server I get this error:
# puppet lookup common::files
Error: Could not run: wrong number of arguments (1 for 0)
The global hiera.yaml file looks like this. It's almost a
version: 5
defaults:
datadir: "/etc/puppetlabs/code/environments/%{environment}/hieradata"
data_hash: yaml_data
# lookup_key: eyaml_lookup_key
# options:
# gpg_gnupghome: '/etc/puppetlabs/puppet/gpg_keys'
# encrypt_method: 'gpg'
hierarchy:
- name: "common.yaml"
data_hash: yaml_data
path: "common.yaml"
I'm moving from hiera v3 to hiera v5 and I was using GPG instead of PKCS7, but that will be another poblem. First of all I want to be able to recover the non-encrypted values.