1

I'm getting the following error when I run puppet-lint:

$ puppet-lint manifests/*
manifests/init.pp - WARNING: class inheriting from params class on line 72

I had myself a quick search on duckduckgo.com, and got this:

http://puppet-lint.com/checks/class_inherits_from_params_class/

However, our Puppet Agent versions are all 2.7 or later, and our Puppet Masters are all 3.0 or later.

For reference, the init.pp code in question follows:

class myclass (
    $zone = 'top',
    $::myclass::params::base_url,
    $::myclass::params::username,
) inherits myclass::params {
...

The code in params.pp is as follows:

class myclass::params {
    $base_url  = hiera('myclass::base_url','https://beta.tpsreports.com/coversheets/')
    $username = hiera('clap::base_url','prod')
}

Even if the Hiera lookup fails, I still shouldn't be getting errors like this:

err: Could not retrieve catalog from remote server: Error 400 on SERVER: Must pass ::myclass::params::base_url to Class[Myclass] at /etc/puppet/manifests/nodes/beta_servers_0.pp:126 on node beta-web-server-0.tpsreports.com

Now that I've hashed through some of that background, to which I'm more than willing to add, if anyone asks, my questions follow:

  1. If my params class will provide parameters even if the hiera lookup somehow fails, why am I getting this error?
  2. Do I have to use the horrible workaround (that is, "What you should have done" from the puppet-lint.com link, even though I have a Puppet version higher than 2.6.2 in all cases?
dr_
  • 1,085
  • 12
  • 19
Nathan Basanese
  • 341
  • 2
  • 5
  • 19

1 Answers1

2

Your init.pp class should read:

class myclass (
    $zone = 'top',
    $base_url = $::myclass::params::base_url,
    $username = $::myclass::params::username,
) inherits myclass::params {

You don't directly put the inherited variables in your parameter list; you use them as the default values for this class's parameters.

J Earls
  • 231
  • 1
  • 3
  • // , Yes, I came to the same conclusion last night. This was the correct answer. Now my Hiera lookups fail. Though equally awkward, failing Hiera Data Lookups are a separate difficulty. – Nathan Basanese Sep 10 '16 at 19:30