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?
2
  • // , Maybe it's just a typo or something. Code on Fridays tends to have a bit less accuracy than usual... Commented Sep 10, 2016 at 1:17
  • // , And that was it. Commented Sep 10, 2016 at 19:31

1 Answer 1

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.

1
  • // , 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. Commented Sep 10, 2016 at 19:30

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.