Hiera: How can I tell which class triggered 'expected Array and got NilClass'?
My Puppet agent is complaining about 'expected Array and got NilClass':
[root@clone1 ~]# puppet agent --test
...
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
I checked the logs on my Puppet Master and they say:
[root@puppet3 ~]# tail /var/log/messages
Jun 27 20:16:01 puppet3 puppet-master[32853]: Hiera type mismatch: expected Array and got NilClass
Jun 27 20:18:57 puppet3 puppet-master[32853]: Hiera type mismatch: expected Array and got NilClass
Jun 27 20:20:29 puppet3 puppet-master[32853]: Hiera type mismatch: expected Array and got NilClass
How can I tell what class triggered this error, short of poking through every single file in my datadir?
Update
For the record, this happened when I was following the example at "Hiera Complete Example". I added classes:
to a YAML file, but failed to include any classes.
This caused the error:
[root@puppet3 puppet]# cat /etc/puppet/hieradata/osfamily/RedHat.yaml
---
classes:
vmwaretools::working_dir: /opt/vmware
I can fix it either by commenting out classes:
or by adding a class to classes:
. Since I'm testing, I'll comment it out for now.
[root@puppet3 puppet]# cat /etc/puppet/hieradata/osfamily/RedHat.yaml
---
#classes:
vmwaretools::working_dir: /opt/vmware
give `puppet agent -t --debug` a shot
@ptierno Unfortunately, `puppet agent -t --debug` returns nothing useful except for the error.