Ask Your Question
0

Error 400 could not find class - Class not shown in console

asked 2016-04-21 09:48:33 -0500

todds gravatar image

updated 2016-04-25 08:53:24 -0500

Using Puppet Enterprise version 4.3.1 I am having a weird issue where the console can''t find one of my classes. I'm using r10k to pull the module from git and install it in the correct path with this structure

/etc/puppetlabs/code/environments/testing/modules/apache

 apache/
|-- manifests
    |--init.pp
    |--package.pp
    |--config.pp
    |--params.pp
    |--service.pp

init.pp

class apache {

  include apache::package
  include apache::config
  include apache::service

}

config.pp

class apache::config {

  file { '/opt/csw/apache2/etc/httpd.conf':
    ensure  => 'file',
    owner   => 'apache',
    group   => 'apache',
    mode    => '0744',
    content => template(httpd.conf.erb),
  }
}

The error is "could not find class ::apache::config" When I look at the Classification --> Add new class in the console I can add apache class, and apache::service, apache::package, and apache::params classes show up in the combo box, but apache::config does not.

Also I've used puppet-lint to check config.pp and no errors show up. Any ideas on what could be wrong?

edit retag flag offensive close merge delete

Comments

Looks like youre using the wrong path for your module. What is the output of puppet config print modulepath

UBPClaw gravatar imageUBPClaw ( 2016-04-25 12:51:01 -0500 )edit

the output of the command is /etc/puppetlabs/code/environments/production/modules:/etc/puppetlabs/puppet/modules:/opt/p uppetlabs/puppet/modules But we're using r10k who installs the modules (for this environment) in /etc/puppetlabs/code/environments/testing/modules

todds gravatar imagetodds ( 2016-04-25 14:11:47 -0500 )edit

I also want to add that the path /etc/puppetlabs/code/environments/testing/modules works for other modules, and the parent, and other classes, just not apache::config class.

todds gravatar imagetodds ( 2016-04-25 14:41:02 -0500 )edit

Two things to check: (1) make sure the config.pp file has the correct permissions and ownership; (2) run "puppet parser validate config.pp"

JohnsonEarls gravatar imageJohnsonEarls ( 2016-04-26 08:05:38 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-04-26 11:02:54 -0500

JohnsonEarls gravatar image

updated 2016-04-26 21:20:19 -0500

It looks like you have a syntax error in your class:

    content => template(httpd.conf.erb),

There should be quotes around httpd.conf.erb, and it should be referenced by the module name :

    content => template("${module_name}/httpd.conf.erb"),

edit- add module name to template invocation

edit flag offensive delete link more

Comments

Hello, Well adding quotes and the module name to the erb path has fixed the issue. I would not normally relate that to the error I received but I guess so. Thanks for your help. And thanks to everyone who responded.

todds gravatar imagetodds ( 2016-04-29 12:14:22 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-04-21 09:48:33 -0500

Seen: 50 times

Last updated: Apr 26 '16