Ask Your Question
0

Getting errors after my attempt to convert to hiera5

asked 2017-06-15 14:36:13 -0600

gene gravatar image

I upgraded to Puppet version 4.10 on the server. If my hiera version 3 hiera.yaml is in place i don't get any errors.

[root@orion puppet]# puppet --version
4.10.1
[root@orion puppet]# puppet agent --version
4.10.1

/etc/puppetllabs/puppet/hiera.yaml (version 3):

[root@orion puppet]# cat hiera.yaml
---
:backends:
  - yaml
:yaml:
  #:datadir: "/etc/puppetlabs/code/environments/%{::environment}/hieradata"
  :datadir: "/etc/puppetlabs/code/hieradata"
:hierarchy:
  - "nodes/%{::trusted.certname}"
  - cc
  - viawest
  - common

So, on node it0556:

it0556 ~ # puppet agent --version
4.10.2
it0556 ~ # puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
Info: Caching catalog for it0556
Info: Applying configuration version '1497554187'
Notice: Applied catalog in 0.63 seconds

When I update hiera.yaml to version 5 (i've removed it from /etc/puppetlabs/puppet/ and it is now in /etc/puppetlabs/code/environment/production/hiera.yaml):

[root@orion production]# pwd
/etc/puppetlabs/code/environments/production
[root@orion production]# cat hiera.yaml 
---
version: 5
hierarchy:
  - name: "Per-node data (yaml version)"
    path: "nodes/%{trusted.certname}.yaml"
    # ommitting datadir and data_hash to use defaults.

  - name: "Other YAML hierarchy levels"
    path: # can specify an array of paths instead of one
      #- "location/%{facts.whereami}/%{facts,group}.yaml"
      #- "groups/%{facts.group}.yaml"
      - "os/%{facts.os.family}.yaml"
      - "common.yaml" 
#defaults:
#  data_hash: yaml_data
#  datadir: data

And back on node it0556:

it0556 ~ # puppet agent -t
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Loading facts
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 'lookup_options' failed: The Lookup Configuration at '/etc/puppetlabs/code/environments/production/hiera.yaml' has wrong type, entry 'hierarchy' index 1 entry 'path' expects a String value, got Tuple at /etc/puppetlabs/code/environments/production/modules/profile/manifests/buildworkstation/sudoers.pp:3:2 on node it0556
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Here is what the sudoers.pp file it mentions looks like:

[root@orion buildworkstation]# pwd
/etc/puppetlabs/code/environments/production/modules/profile/manifests/buildworkstation
[root@orion buildworkstation]# cat sudoers.pp 
class profile::buildworkstation::sudoers {

    include sudo
    include sudo::configs

}

I do have a yaml file for node it0556 that has some sudoers related info in it. That file contains:

[root@orion nodes]# pwd
/etc/puppetlabs/code/environments/production/data/nodes
[root@orion nodes]# cat it0556.yaml 
---

sudo::configs:
    'fflintstone':
        'content' : 'fflintstone ALL=(ALL) NOPASSWD: ALL'
    'fred_flintstone':
        'content' : 'fred_flintstone ALL=(ALL) NOPASSWD: ALL'

I am currently at a loss on how to correct this error. I'm hoping someone can point me in the right direction.

Thanks,

gene

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-05-06 04:04:55 -0600

maxme gravatar image

Hi,

this maybe too late, since the thread is a while out there. I ran into the same issue and the solution is easy, just change the

path: # can specify an array of paths instead of one
  #- "location/%{facts.whereami}/%{facts,group}.yaml"
  #- "groups/%{facts.group}.yaml"
  - "os/%{facts.os.family}.yaml"
  - "common.yaml"

to

paths: # can specify an array of paths instead of one
  #- "location/%{facts.whereami}/%{facts,group}.yaml"
  #- "groups/%{facts.group}.yaml"
  - "os/%{facts.os.family}.yaml"
  - "common.yaml"

notice the s in path(s)

edit flag offensive delete link more

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-15 14:36:13 -0600

Seen: 648 times

Last updated: May 06