leoOrion
leoOrion

Reputation: 1957

Puppet class missing even when file exists

The directory structure of the puppet repo is as:

.
|-- data
|   |-- common.yaml
|-- environment
|   |-- environment.conf
|   `-- hiera.yaml
|-- files
|   `-- cdn
|-- hiera
|   `-- hiera.yaml
|-- hiera.global.yaml
|-- manifests
|   `-- site.pp
|-- modules
|   
`-- site
    |-- profile
    |   |-- files
    |   `-- manifests
    |       |-- appliance
    |       |   |-- base.pp
    `-- role
        `-- manifests
            |-- README.md
            `-- role1
                `-- appliance.pp

The site.pp file is as :

File { backup => false }


if $::custom_facts['appliance_type'] == 'Delivery' {
  include role::role0::app
}

if $::custom_facts['appliance_type'] == 'Appliance' {
  include role::role1::appliance **// line where error is occuring**
}

node default {
}

When I run the puppet apply command it fails with this error:

Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::role::role1::appliance for default-puppetmaster-centos-7.vagrantup.com (file: /tmp/kitchen/manifests/site.pp, line: 9, column: 3) on node default-puppetmaster-centos-7.vagrantup.com

The puppet command that is applied:

sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp --modulepath=/tmp/kitchen/modules --fileserverconfig=/tmp/kitchen/fileserver.conf --environment=kitchen_vagrant_puppet --environmentpath=/etc/puppetlabs/code/environments --hiera_config=/tmp/kitchen/hiera.global.yaml

I cant figure out why puppet cannot find the class. The class is in the role folder. Is the directory structure wrong?

Edit:

Adding contents of envirnment.conf file:

modulepath          = site:modules:$basemodulepath

Upvotes: 0

Views: 479

Answers (1)

Jon
Jon

Reputation: 3671

Is this just because the modulepath needs to include site? Your manifests are in site rather than modules.

sudo -E /opt/puppetlabs/bin/puppet apply /tmp/kitchen/manifests/site.pp \
    --modulepath=/tmp/kitchen/modules:/tmp/kitchen/site \
    --fileserverconfig=/tmp/kitchen/fileserver.conf \
    --environment=kitchen_vagrant_puppet \
    --environmentpath=/etc/puppetlabs/code/environments \
    --hiera_config=/tmp/kitchen/hiera.global.yaml

I'd check the modulepath in environment.conf, too, just in case.

Upvotes: 2

Related Questions