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:
- If my
params
class will provide parameters even if the hiera lookup somehow fails, why am I getting this error? - 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?
Your
init.pp
class should read:You don't directly put the inherited variables in your parameter list; you use them as the default values for this class's parameters.