Ask Your Question
0

Error 400 on SERVER: Hiera type mismatch: expected Array and got NilClass

asked 2015-04-08 02:44:09 -0600

Petro gravatar image

Hi all.

I received this error:

Info: Retrieving pluginfacts
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Hiera type mismatch: expected Array and got NilClass
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

Now I have this hiera.yaml config: cat hiera.yaml

---
:backends:
  - yaml
  - json
:yaml:
  :datadir: /etc/puppet/hiera
:json:
  :datadir: /etc/puppet/hiera
:hierarchy:
  - "%{::environment}/%{::clientcert}"
  - common

Also I have file in /etc/puppet/hiera/production/clientcertname.yaml

My another configuration worked fine: cat hiera.yaml

---
:backends:
  - yaml
  - json
:yaml:
  :datadir: /etc/puppet/hiera
:json:
  :datadir: /etc/puppet/hiera
:hierarchy:
  - "%{::clientcert}"
  - common

And file in /etc/puppet/hiera/clientcertname.yaml

File clientcertname.yaml include this:

classes:
 - apache
- vsftpd
- safe-upgrade

Please tell me where I made mistake?

edit retag flag offensive close merge delete

Comments

Can you post the hiera call that you were making in your puppet code? From the clientcertname.yaml file above it looks like you may have an indentation problem - yaml is very sensitive to that.

lorcutt gravatar imagelorcutt ( 2015-04-08 15:59:42 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-04-08 11:30:02 -0600

mike.r gravatar image

updated 2016-04-08 11:31:19 -0600

also Ive seein it have issues with the certname.yaml config

you need 2 spaces between the beginning of line and the dash

classes:
 - apache
- vsftpd
- safe-upgrade

needs to be 

classes:
  - apache
  - vstfpd
  - safeupgrade
edit flag offensive delete link more
0

answered 2015-04-10 11:53:07 -0600

Chris gravatar image

You need to change you yaml datadir to point to your environments folder and not the base puppet folder. Seams like the file layout is off.

Environments are usually in /etc/puppet/environments (opensource) and the production folder would live under that folder. ex. /etc/puppet/environments/production

Change hiara yaml datadir this

:yaml:
  :datadir: /etc/puppet/environments
:json:
  :datadir: /etc/puppet/environments

Hierarchy should then be something like the following.

:hierarchy:
 - "%{::environment}/hiera/%{::clientcert}"
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: 2015-04-08 02:42:33 -0600

Seen: 1,819 times

Last updated: Apr 08 '16