A puppet-lint extension that ensures class parameter names are unique.
Ruby
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/puppet-lint/plugins
spec
.gitignore
.rubocop.yml
.travis.yml
CHANGELOG.md
Gemfile
Jenkinsfile
LICENSE
README.md
Rakefile
puppet-lint-duplicate_class_parameters-check.gemspec

README.md

puppet-lint duplicate_class_parameters check

A puppet-lint extension that ensures class parameter names are unique.

Build Status

Until Puppet 3.8.5 it was possible to have the same parameter name specified multiple times in a class definition without error. This could cause confusion as only the last value for that name was taken and it was decided in No error on duplicate parameters on classes and resources that this behaviour should change and now return an error. This puppet-lint plugin will help you catch those issues before you upgrade and suffer failures in your puppet runs.

An exaggerated example of the previously valid, but awkward, behaviour can be found below -

class file_resource(
  $duplicated = { 'a' => 1 },
  $duplicated = 'foo',
  $not_unique = 'bar',
  $not_unique = '2nd bar',
  $unique     = 'baz'
) {

  file { '/tmp/my-file':
    mode => '0600',
  }

}

With this extension installed puppet-lint will return

found duplicate parameter 'duplicated' in class 'file_resource'

Installation

To use this plugin add the following line to your Gemfile

gem 'puppet-lint-duplicate_class_parameters-check'

and then run bundle install

Other puppet-lint plugins

You can find a list of my puppet-lint plugins in the unixdaemon puppet-lint-plugins repo.

Author

Dean Wilson