1

I've got a seemingly impossible error in a very simple puppet manifest. I'm simply trying to use the example42 puppet-puppet module to run puppetmaster (with puppet 3.1.0). This is my site.pp:

node 'se2' { 
    class { 'puppet::server' :
        mode => 'server' }    
}
Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }
node default { }

With this, I get the error:

Info: Loading facts in /var/lib/puppet/lib/facter/last_run.rb
Info: Loading facts in /var/lib/puppet/lib/facter/puppi_projects.rb
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Invalid parameter mode at /etc/puppet/manifests/site.pp:7 on node se2

(line 7 is the line with mode)

There must be something stupid I'm doing, from what I can see here, mode IS a valid parameter:

https://github.com/example42/puppet-puppet/blob/master/manifests/init.pp#L320

Any suggestions?

PerilousApricot
  • 153
  • 1
  • 1
  • 6

2 Answers2

1

You are referencing server.pp by calling puppet::server

See this class for puppet::server https://github.com/example42/puppet-puppet/blob/master/manifests/server.pp

To reference the class with parameter 'mode', use puppet.pp:

node 'se2' { 
  class { 'puppet' :
    mode => 'server',
  }    
}
Exec { path => "/usr/bin:/usr/sbin:/bin:/sbin" }
node default { }
Evan
  • 308
  • 1
  • 7
  • I think I'm misunderstanding how inherit works in this case. Does the line: class puppet::server inherits puppet Not also pull in the parameterization directives from the puppet class? Being new to puppet, I'd think that it does the OOP thing and makes puppet::server do everything puppet can do. – PerilousApricot Feb 28 '13 at 11:15
  • Hey, sorry I missed this notification. `class puppet::server inherits puppet` does not pull in the parameterization directives. Instead, it acts as an include while also allowing resource overrides. For example, you could override the puppet.conf resource like so: `File[ 'puppet.conf'] { path => '/someotherpath', }` If you do want to access parameters from another class, you can accomplish this through namespacing. `$::puppet::mode` would give you the puppet class mode parameter. – Evan Apr 02 '13 at 17:04
-1

Near the bottom of that page is this:

### PuppetMaster configuration
if $puppet::mode == 'server' {
  include puppet::server
}

But your class is already puppet::server. I'm not overly familiar with writing providers but a class including itself doesn't seem likely to work. Can you try making your class have a different name?

Ladadadada
  • 26,337
  • 7
  • 59
  • 90