puppet

Puppet cannot find parent resource type


I'm trying to set up Puppet to use templates in order to create configuration files for our servers. The current way I am doing this is by using inheritance to pass default values to a class. This allows me to properly separate the data from the rest of the code. An example of this structure is as follows:

class grading_properties(
          $home='tomcat-deploy',
          $financialScoreHigh = $grading_properties_defaults::financialScoreHigh,
          $financialScoreLow = $grading_properties_defaults::financialScoreLow,
          $qualityScoreHigh = $grading_properties_defaults::qualityScoreHigh,
          $qualityScoreLow = $grading_properties_defaults::qualityScoreLow,
          )inherits grading_properties_defaults {

  file{"${base}/${home}/company-conf/grading.properties" :
  ensure  => present,
  mode    => '0755',
  owner   => 'root',
  group   => 'root',
  content => template("company/company-conf_pr/grading.properties.erb")  
  } 
}

This class is responsible for generating the "grading.properties" config file based on the "grading.properties.erb" template. The "grading_properties_defaults" class which it inherits looks like this:

class grading_properties_defaults{
  $financialScoreHigh = 4
  $financialScoreLow = 7
  $qualityScoreHigh = 6000
  $qualityScoreLow = 4000
}

The problem I am having is when I try to create the class using

class{ "grading_properties" :
  financialScoreHigh => 10,
}

from a class in the same module, I get the following error from puppet apply:

Error: Could not find parent resource type 'grading_properties_defaults' of type hostclass in production at /home/git/puppet/modules/company/manifests/grading_properties.pp:1 on node sv1.company.qa0

What is the proper way to reference a class in the same module?


Solution

  • It turns out I simply need to fully qualify my class names in order for puppet to find them. E.g. class grading_properties_defaults should be modulename::grading_properties_defaults