0
votes

I am using Puppet 3.0. I tried to use the existing NGINX module but encountered one issue which no answer seems to exist. I have moved to implementing NGINX module myself which handles my exact requirements.

Each package/service/file resource works as expected and now I am moving the code out of init.pp into a /manifest/nginx.pp fileas a class:

class company_nginx {

  ... Various resources

}

Now I am trying to include this class inside the init.pp

include company_nginx

An it returns an error:

Error: Could not find class nginx for localhost on node localhost

What step or concept am I missing? How do I invoke this "class" in the init.pp file to get the resources invoked and configuring a system???

2

2 Answers

1
votes

Manifest file names and the classes defined within them must exactly match. If you want to have a class names company_nginx then it must be in a file names company_nginx.pp.

This required comes from the puppet autoloader.

1
votes

Your class names must be qualified for Puppet to be able to pick them up.

class nginx::company_nginx { ... }

This class will be loaded from module nginx file manifests/company_nginx.pp.

Doing include company_nginx will make Puppet assume that there is an actual module names company_nginx with the class defined in init.pp.