0

I'm setting up a puppet master and agent. They are running on the same host, as I want puppet to manage this host, too. The agent fails to find the convenient test module that the package provides.

I'm running ubuntu trusty (14.04 LTS) and installed packages puppetmaster-passenger and puppet to get going. All good so far.

root@mangosteen:/etc/puppet# dpkg -l | grep puppet
ii  puppet                           3.4.3-1ubuntu1.1    [...]
ii  puppet-common                    3.4.3-1ubuntu1.1    [...]
ii  puppetmaster                     3.4.3-1ubuntu1.1    [...]
ii  puppetmaster-common              3.4.3-1ubuntu1.1    [...]
ii  puppetmaster-passenger           3.4.3-1ubuntu1.1    [...]
root@mangosteen:/etc/puppet# 

My /etc/puppet/puppet.conf seems rather ordinary:

[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
prerun_command=/etc/puppet/etckeeper-commit-pre
postrun_command=/etc/puppet/etckeeper-commit-post

[master]
# These are needed when the puppetmaster is run by passenger
# and can safely be removed if webrick is used.
ssl_client_header = SSL_CLIENT_S_DN 
ssl_client_verify_header = SSL_CLIENT_VERIFY

dns_alt_names = mangosteen.example.com,puppetmaster.example.com

The package provides a quick test, which I think should mean that bringing up an agent will result in writing HelloWorld to /tmp/hello:

root@mangosteen:/etc/puppet# pwd
/etc/puppet
root@mangosteen:/etc/puppet# find manifests/ -type f
manifests/site.pp
root@mangosteen:/etc/puppet# find modules/ -type f
modules/test/manifests/init.pp
root@mangosteen:/etc/puppet# cat manifests/site.pp
include test
root@mangosteen:/etc/puppet# cat modules/test/manifests/init.pp
class test { file { \/tmp/hello\: content => \HelloWorld\ } }
root@mangosteen:/etc/puppet# 

But this isn't what happens. (Recall that agent and master are on the same host, which is called mangosteen.example.com with alias puppetmaster.example.com)

root@mangosteen:/etc/puppet# puppet agent --test
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class test for mangosteen.example.com on node mangosteen.example.com
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
root@mangosteen:/etc/puppet# 

The server log (/var/log/puppet/masterhttp.log) is rather ordinary through that operation:

[2015-10-02 12:54:08] 139.162.x.y - - [02/Oct/2015:12:54:08 UTC] "GET /production/node/mangosteen.example.com? HTTP/1.1" 200 4487
[2015-10-02 12:54:08] - -> /production/node/mangosteen.example.com?
[2015-10-02 12:54:08] 139.162.x.y - - [02/Oct/2015:12:54:08 UTC] "GET /production/file_metadatas/plugins?links=manage&recurse=true&ignore=.svn&ignore=CVS&ignore=.git&checksum_type=md5 HTTP/1.1" 200 278
[2015-10-02 12:54:08] - -> /production/file_metadatas/plugins?links=manage&recurse=true&ignore=.svn&ignore=CVS&ignore=.git&checksum_type=md5
[2015-10-02 12:54:09] 139.162.x.y - - [02/Oct/2015:12:54:09 UTC] "POST /production/catalog/mangosteen.example.com HTTP/1.1" 400 89
[2015-10-02 12:54:09] - -> /production/catalog/mangosteen.example.com
[2015-10-02 12:54:09] 139.162.x.y - - [02/Oct/2015:12:54:09 UTC] "PUT /production/report/mangosteen.example.com HTTP/1.1" 200 9
[2015-10-02 12:54:09] - -> /production/report/mangosteen.example.com

And debug output from the agent is uninteresting to my eye, mostly about finding its certs. These commands provide a reasonable summary of that boredom:

root@mangosteen:/etc/puppet# puppet agent --test --debug --trace 2>&1 | grep -i module
root@mangosteen:/etc/puppet# puppet agent --test --debug --trace 2>&1 | grep -i test
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not find class test for mangosteen.example.com on node mangosteen.example.com
root@mangosteen:/etc/puppet# 

Any pointers on what I'm doing wrong?

jma
  • 425
  • 6
  • 16
  • Which user is running the master process? Have you tried `puppet apply -e 'include test'`? - As an aside, the backslashes in your code should be quotes, I believe. – Felix Frank Oct 02 '15 at 13:12
  • The apply confirmed that the package's test file was incorrect as you noted. Fixing that caused the `agent --test` to work. So the problem was that the master couldn't compile the catalog, but that error wasn't being reported (that I could see). – jma Oct 02 '15 at 13:20

2 Answers2

0

If you are using puppet agent in the same host where you have the puppet master, you can use puppet apply as @FelixFrank suggested

Anyway, the problem is, you don't have the node defined the "mangosteen.example.com", you can also solved this problem defining the default node, Puppet looks for the node defining and if nothing is found uses the default node.

c4f4t0r
  • 5,301
  • 3
  • 31
  • 42
0

@FelixFrank provided the main clue to the answer, that the file modules/test/manifests/init.pp had a typo. Oddly, this wasn't reported in the log by the puppet master, and the puppet agent merely said that the test class couldn't be found. (It couldn't be found because it didn't parse, near as I can tell.)

I'm new enough to puppet that I may have botched logging somehow. In any case, because there was no node directive at all, the absence of a node directive for this host wasn't at issue. Indeed, it turned out to be a rather clever test, because once the agent worked (once I fixed the typo), the agent created a file at /tmp/hello.

jma
  • 425
  • 6
  • 16