On working on some puppet manifests I hit this error message:
$ sudo puppetd -t
err: Could not retrieve catalog from remote server: undefined method `closed?' for nil:NilClass
warning: Not using cache on failed catalog
err: Could not retrieve catalog; skipping run
Certainly not the most enlightening error message. After checking over the syntax of my mainfests it still wasn't obvious what was wrong.
First port of call to diagnose the problem is to try enabling debugging on the client:
On the client:
# Run the client with debugging enabled.
$ sudo puppetd -t --debug
If that yields nothing useful try the following:
On the puppetmaster run:
# If it's running stop the puppetmasterd service
# change this to suit your distro - the following is debian specific
$ sudo /etc/init.d/puppetmaster stop
# start the puppetmasterd in debug mode without daemonizing it.
$ sudo puppetmasterd --no-daemonize --debug
Back on the client re-run the puppetd:
$ sudo puppetd -t
By looking at the debug output on the puppetmaster I was able to see my problem which was that a generate command didn't have permission to write a necessary file. Once I'd fixed it everything worked as expected.
Once finished ctrl-c the foreground puppetmasterd and restart the service if you'd stopped it to run it in debug mode:
$ sudo /etc/init.d/puppetmaster start