Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Prefix: I searched this out, but the fact that there are any number of things that can cause this problem, I have been unable to find a solution to this particular case.

I have a puppet master (3.0.2-1; RHEL6) and the /etc/puppet/manifests/site.pp file contains the following:

import 'nodes/nodes.pp'
$puppetserver = 'puppet.example.dom'

Naturally, the server domain is not what is in use, but has been changed to protect the innocent.

The nodes/nodes.pp file contains:

node 'agent1.example.dom' {
    include users,
}

The users class is under /etc/puppet/modules/users. The manifests/init.pp file contains:

class users {
    group { 'admins':
        ensure => 'present',
        gid    => '501',
    }
    user { 'user1':
        ensure           => 'present',
        uid              => '10000',
        gid              => '501',
        home             => '/home/user1',
        password_max_age => '60',
        password_min_age => '1',
        shell            => '/bin/bash',
    }
}

If I remove the "include users", line from the nodes.pp file the catalog is applied:

Info: Retrieving plugin
Info: Caching catalog for agent1.example.dom
Info: Applying configuration version '1357858753'
Notice: Finished catalog run in 0.02 seconds

However, when I include it the following error appears:

[root@agent1 ~]# puppet agent --test --noop
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not 
parse for environment production: Syntax error at '}' at 
/etc/puppet/manifests/nodes/nodes.pp:3 on node agent1.example.dom
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

This makes me think I have a syntax error in the init.pp file, but I can't figure out what it would be. Maybe I don't have this properly configured or I'm linking the various parts incorrectly?

I've tried without the comma in the nodes.pp file as well as with. I've also tried it without a comma on the last row of the users init.pp file as well as with. I've tried with an empty line between the group definition and the user definition. I get the same result regardless of whatever minor change I make.

I've also tried putting the node definition directly into the site.pp file but the same error occurs. Just from a different location than previously (site.pp vs nodes/nodes.pp).

Connectivity to the server has been verified using telnet from agent1 to port 8140 on the puppet master.

Any ideas? The agent is also v3.0.2-1, but is RHEL5. I haven't tested a RHEL6 agent yet.

EDIT: I ran the test with the --debug option. The output is here: http://pastebin.com/zNs5DvCD

EDIT 2: I didn't declare the class/module before attempting this. I did so with puppet apply /etc/puppet/modules/users/manifests/users.pp (after changing the filename). This now gives me the following error:

[root@agent1 puppet]# puppet agent --test --noop
Info: Retrieving plugin
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not 
find class users for agent1 on node agent1
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

So, something changed. The syntax error is gone, but the class can't be found.

share|improve this question
    
Just a thought, but why not try the standard Guess-Check-Retry method. Comment or uncomment stuff a little at a time until you find the problem? Once you narrow down the issue to a very specific block of code, then tell us exactly what section of the manifest is broke? –  Zoredache Jan 11 '13 at 1:15
    
a couple of times i've found that just not work with puppet manifests, to be honest. At least not work as well as you'd hope. –  Sirex Jan 11 '13 at 1:50

3 Answers 3

remove the , after include users - that's only one i can see by eye.

you should be able to go with ensure => present also

try puppet parser validate .pp

try puppet-lint

share|improve this answer
    
I suspect you might be onto something with ensure => present. That looks familiar. –  theillien Jan 10 '13 at 23:36
    
Nevermind. did not work. Same error. I tried validating it, but it didn't return any errors. puppet-lint returns WARNING: class not documented on line 1. I'll research that and see what it comes up with. –  theillien Jan 10 '13 at 23:38
    
that just means you need a comment somewhere with a # at the start, its a red herring in this case. –  Sirex Jan 10 '13 at 23:43
    
i think i know what it is, but i cant fully remember. puppet 3.0 has something about using include class. try include users.pp or import users.pp, i forget which –  Sirex Jan 10 '13 at 23:44
    
for some reason i remember before we went to enterprise 3.0 when we moved from 2.7 foss to 3.0 foss puppet, you had to put the .pp on the include lines. –  Sirex Jan 10 '13 at 23:45

First, you have to rename the class back to init.pp or Puppet will not be able to find it.

Second, running puppet apply with the file where the class is defined does nothing. If you want to use puppet apply to test your classes, you can put this in tests/init.pp

include users

Then, you can test the class with:

puppet apply modules/users/tests/init.pp

Third, The , behind the include statement (nodes.pp) needs to go.

Kind regards, Ger.

share|improve this answer
up vote 0 down vote accepted

I posted it over at http://ask.puppetlabs.com as suggested by Sirex in chat. It was pointed out that I had renamed the file module manifest to users.pp, but it should have been init.pp as per the automatic loading of classes and subclasses that is built into Puppet.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.