GithubHelp home page GithubHelp logo

puppet-lint-resource_reference_syntax's Introduction

puppet-lint plugin resource reference check

License Test Release RubyGem Version RubyGem Downloads Donated by example42

Note, this plugin will check for Puppet resource reference syntax which will no longer work with Puppet 4.x.

Installation

To use this plugin, add the following like to the Gemfile in your Puppet code base and run bundle install.

gem 'puppet-lint-resource_reference_syntax'

Usage

This plugin provides two new checks to puppet-lint.

resource_reference_without_whitespace

--fix support: No

This check will raise an error for any resource reference that has a whitespace between the Type reference and the opening bracket.

e.g. the following code is NOT good for Puppet 4:

  require => File ['/etc/motd']

and will result in the following error:

ERROR: whitespce between reference type and title on line 4

resource_reference_without_title_capital

--fix support: No

This check will raise an error for any resource reference that uses the title with capital letter without enclosed quotes.

e.g. the following code will not work on Puppet 4:

  require => Service[Apache],
  require => Service[Apache, Mysql],
  require => Service[apache]

and will result in the following error:

ERROR: resource reference with title with capital letter on line 4

The following references are good code for Puppet 4:

  require => Service['apache'],
  require => Service['apache', 'mysql'],
  require => [ Service['apache'], Service['mysql'] ],

Transfer Notice

This plugin was originally authored by example42. The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance. Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.

License

This gem is licensed under the Apache-2 license.

Release information

To make a new release, please do:

  • update the version in the gemspec file
  • Install gems with bundle install --with release --path .vendor
  • generate the changelog with bundle exec rake changelog
  • Check if the new version matches the closed issues/PRs in the changelog
  • Create a PR with it
  • After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages

puppet-lint-resource_reference_syntax's People

Contributors

bastelfreak avatar dependabot[bot] avatar domcleal avatar ekohl avatar kenyon avatar rnelson0 avatar smortex avatar tuxmea avatar vstone avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-lint-resource_reference_syntax's Issues

resource_reference_without_whitespace error on resource collection

For some reason I am getting an error from your module where I don't think there should be one.

Error message:
resource_reference_without_whitespace:ERROR:whitespace between reference type and title

Resource.
Sshkeys::Set_authorized_key <<| tag == $::facts[fqdn] |>>

I am rather sure that is a valid resource collector.
If I use a non structured fact it fails.
If I take out all the spaces on that line it passes.

Whereas this resource collector does not produce the error.
Sshkey <<| tag == $primary_server |>>

Is something going wrong because it is a sub resource?

false resource_reference_without_whitespace on resource collection

Since updating the gem to latest (1.0.11) I'm seeing some issues with whitespace errors on resource collectors.
Picked the example from #9 to illustrate:

package { 'htop':
  ensure => latest,
}
Sshkeys::Set_authorized_key <<| tag == $::facts[fqdn] |>>

yields

ERROR: whitespce between reference type and title on line 4

while

Sshkeys::Set_authorized_key <<| tag == $::facts[fqdn] |>>

on its own yields no errors.

The more definitions are prior to the collector the more alleged errors are printed.

service { 'puppet':
  ensure => running,
}
package { 'less':
  ensure => latest,
}
package { 'htop':
  ensure => latest,
}
Sshkeys::Set_authorized_key <<| tag == $::facts[fqdn] |>>

ERROR: whitespce between reference type and title on line 10
ERROR: whitespce between reference type and title on line 10
ERROR: whitespce between reference type and title on line 10

The same files checked against version 1.0.10 do not throw any errors.

False positive for require

Example:
require => File[tomcat8_dir]
will mark as an Error:
ERROR: resource reference with title with capital letter on line
when gem puppet-lint-resource_reference_syntax is installed.
Other used gem's:
gem list

*** LOCAL GEMS ***

abrt (0.0.6)
bigdecimal (1.2.0)
io-console (0.4.2)
json (1.7.7)
psych (2.0.0)
puppet-lint (2.0.0, 1.1.0)
puppet-lint-top_scope_facts-check (0.0.1)
puppet-lint-trailing_newline-check (1.0.0)
puppet-lint-unquoted_string-check (0.3.0)
puppet-lint-variable_contains_upcase (1.0.1)
rdoc (4.0.0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.