From b5c7a00f010b0a709a3d2c4cd0e894060a322917 Mon Sep 17 00:00:00 2001 From: Gael Chamoulaud Date: Tue, 31 Mar 2015 12:01:42 +0200 Subject: [PATCH] Add Puppet 4.x lint checks - This changes the puppet-lint requirement to 1.1.x, so that we can use puppet-lint plugins. Most of these plugins are for 4.x compat, but some just catch common errors. Change-Id: I4f96d4dc285bd6aa0ae5e4294ccd730cc4ee5c45 Signed-off-by: Gael Chamoulaud --- Gemfile | 13 ++++++++++++- manifests/policy/base.pp | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 3fa70788..47f8dbc8 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,18 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false - gem 'puppet-lint', '~> 0.3.2' + + gem 'puppet-lint', '~> 1.1.0' + gem 'puppet-lint-absolute_classname-check' + gem 'puppet-lint-absolute_template_path' + gem 'puppet-lint-trailing_newline-check' + + # Puppet 4.x related lint checks + gem 'puppet-lint-unquoted_string-check' + gem 'puppet-lint-leading_zero-check' + gem 'puppet-lint-variable_contains_upcase' + gem 'puppet-lint-numericvariable' + gem 'rspec-puppet', '~> 1.0.1' gem 'rake', '10.1.1' gem 'rspec' diff --git a/manifests/policy/base.pp b/manifests/policy/base.pp index 6bb0e350..d5c457a5 100644 --- a/manifests/policy/base.pp +++ b/manifests/policy/base.pp @@ -28,9 +28,9 @@ define openstacklib::policy::base ( incl => $file_path, changes => [ "set dict/entry[last()+1] \"${key}\"", - "set dict/entry[last()]/string \"${value}\"" + "set dict/entry[last()]/string \"${value}\"", ], - onlyif => "match dict/entry[*][.=\"${key}\"] size == 0" + onlyif => "match dict/entry[*][.=\"${key}\"] size == 0", } # Requires that the entry is added before this call or it will fail. @@ -38,7 +38,7 @@ define openstacklib::policy::base ( lens => 'Json.lns', incl => $file_path, changes => "set dict/entry[*][.=\"${key}\"]/string \"${value}\"", - require => Augeas["${file_path}-${key}-${value}-add"] + require => Augeas["${file_path}-${key}-${value}-add"], } }