OK, I discovered what the problem was but ... Still amazed

In my YAML files I had some entries like this:

common::packages:
   ['vim', 'htop']:
      ensure: latest

It didn't work and gave an error that has been pretty difficult to 
understand. After changing the yaml to:

common::packages:
   'vim':
      ensure: latest
   'htop':
      ensure: latest

Everything works. I'll have to rewrite some parts of my hiera files, but at 
least I can apply the manifests in the nodes...

On Tuesday, March 13, 2018 at 3:15:58 PM UTC+1, Bruno Rodriguez wrote:
>
> 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.
>
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/e25ee89f-c6e3-477b-8d3d-55c0d0093285%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to