Puppet [SOLVED]: Puppet Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class

Puppet [SOLVED]: Puppet Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class

Home Forums Automation Tools Puppet Puppet [SOLVED]: Puppet Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class

Tagged: 

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #225767

    Cloudy Point
    Keymaster

    QuestionQuestion

    I’m trying to deploy an application called Bag-Of-Holding via Puppet using the instruction as posted on github – https://github.com/ribeiroit/boh-puppet

    I run the command: sudo puppet apply /etc/puppet/manifests/site.pp
    and I get the error below:

    Error: Evaluation Error: Error while evaluating a Resource Statement, Could not find declared class boh at /etc/puppet/manifests/site.pp:2:2 on node lab1-hp-elitebook-8570p

    It appears the puppet is having hard time finding the class boh which is already in the manifest folder

    This is my directory tree:

    /etc/puppet
    ??? code
    ??? manifests
    ??? modules
        ??? boh-puppet
            ??? manifests
            ??? templates
    

    my site.pp file is located in /etc/puppet/manifests
    and it looks like this:

    node 'lab1-hp-elitebook-8570p' {
      class { 'boh':
        python_version   => 3,
        environment      => 'dev',
        language         => 'en',
        debug            => 'True',
        create_superuser => 'true',
        pkg_checksum     => '86b0164f7fd6c5e4aa43c8f056f08cea'
      }
    }
    

    And init.pp file has the class {boh } and that’s located at:
    /etc/puppet/modules/boh-puppet/manifests

    Any ideas how to fix this?

    #225768

    Cloudy Point
    Keymaster

    Accepted AnswerAnswer

    Puppet requires certain namespace restrictions and conventions with module directory structure and class names when autoloading. In this case, your problem can be solved most simply and cleanly to follow normal conventions by renaming your module directory of boh-puppet to simply boh. That will fix your issue.

    Consult the documentation here for more information: https://puppet.com/docs/puppet/4.10/lang_namespaces.html

    Since you are using puppet apply with absolute paths, you will also need to supply the path to your modules by modifying the command to: sudo puppet apply --modulepath=/etc/puppet/modules /etc/puppet/manifests/site.pp.

    Source: https://stackoverflow.com/questions/47275288/puppet-evaluation-error-error-while-evaluating-a-resource-statement-could-not
    Author: Matt Schuchard
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.