Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Puppet lint doesn't check if the class params are validated within another class of the module #183

Open
techsk8 opened this issue Jan 12, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@techsk8
Copy link

techsk8 commented Jan 12, 2024

Describe the Bug

Puppet lint from the VSCode extension doesn't check thoroughly if the parameters used in a class are actually validated within the module in another class, therefore throws an error about missing datatype for those params:

# @summary puppet::server::compile::apache
#
# @api private
#
class puppet::server::compile::apache (
  $servername    = $puppet::servername,
  $puppetca_host = $puppet::server_puppetca_host,
) {
  assert_private()

  class { 'lib::ssl_certificate_check':
    blacklist_certificates => [
      $puppet::server::compile::ssl_cert,
    ],
  }
.
.
.

and the linter error looks like this:

[{
	"resource": "/Users/control-repo/site/puppet/manifests/server/compile/apache.pp",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "parameter_types",
	"severity": 4,
	"message": "missing datatype for parameter puppet::server::compile::apache::servername",
	"source": "Puppet",
	"startLineNumber": 6,
	"startColumn": 3,
	"endLineNumber": 6,
	"endColumn": 3
},{
	"resource": "/Users/control-repo/site/puppet/manifests/server/compile/apache.pp",
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "parameter_types",
	"severity": 4,
	"message": "missing datatype for parameter puppet::server::compile::apache::puppetca_host",
	"source": "Puppet",
	"startLineNumber": 7,
	"startColumn": 3,
	"endLineNumber": 7,
	"endColumn": 3
}]

In VSCode looks like this:
linter error

Although I have validated the params I have used in the class, inside init.pp in the puppet class:

# @param enable_clean_node
#
class puppet (
String                                                      $servername                                  = $puppet::params::servername,
Stdlib::Fqdn                                                $server_puppetca_host                        = $puppet::params::server_puppetca_host,
.
.
.
) inherits puppet::params {
.
.
.

Expected Behavior

For puppet lint to check if the params used in the class are actually validated somewhere else and not throw a misleading false-positive error.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Open VSCode with the puppet extension enabled
  2. Open a puppet file that contains a class which uses params that are actually validated in another class
  3. Puppet lint will still complains about the params not being validated, although it shouldn't.

Environment

  • Version: 7.27
  • Platform: MacOS 14 Apple Silicon

Additional Context

Nothing to add

@techsk8 techsk8 added the bug Something isn't working label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant