From da6eaa1d3ad0adea95efc9c3fc6b63423feb4b29 Mon Sep 17 00:00:00 2001 From: Gael Chamoulaud Date: Fri, 17 Apr 2015 11:54:35 +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: I4710484e7481b48ee1c5626d37af6d71278270da Signed-off-by: Gael Chamoulaud --- Gemfile | 13 ++++++++++++- manifests/init.pp | 2 +- manifests/ovs.pp | 28 ++++++++++++++-------------- 3 files changed, 27 insertions(+), 16 deletions(-) diff --git a/Gemfile b/Gemfile index ce3a2f59..46a47372 100644 --- a/Gemfile +++ b/Gemfile @@ -2,8 +2,19 @@ source 'https://rubygems.org' group :development, :test do gem 'puppetlabs_spec_helper', :require => false + gem 'metadata-json-lint' - 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', '< 2.99' diff --git a/manifests/init.pp b/manifests/init.pp index 196e655b..d0d51cab 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -27,6 +27,6 @@ class vswitch ( $provider = $vswitch::params::provider ) { - $cls = "vswitch::${provider}" + $cls = "::vswitch::${provider}" include $cls } diff --git a/manifests/ovs.pp b/manifests/ovs.pp index 9ce892cc..6740a6c1 100644 --- a/manifests/ovs.pp +++ b/manifests/ovs.pp @@ -4,7 +4,7 @@ class vswitch::ovs( $package_ensure = 'present' ) { - include 'vswitch::params' + include ::vswitch::params case $::osfamily { 'Debian': { @@ -21,27 +21,27 @@ class vswitch::ovs( $ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"' } } - service {'openvswitch': - ensure => true, - enable => true, - name => $::vswitch::params::ovs_service_name, - hasstatus => false, # the supplied command returns true even if it's not running + service { 'openvswitch': + ensure => true, + enable => true, + name => $::vswitch::params::ovs_service_name, + hasstatus => false, # the supplied command returns true even if it's not running # Not perfect - should spot if either service is not running - but it'll do - status => $ovs_status + status => $ovs_status, } exec { 'rebuild-ovsmod': command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log', creates => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko", require => [Package['openvswitch-datapath-dkms', $kernelheaders_pkg]], before => Package['openvswitch-switch'], - refreshonly => true + refreshonly => true, } } 'Redhat': { - service {'openvswitch': - ensure => true, - enable => true, - name => $::vswitch::params::ovs_service_name, + service { 'openvswitch': + ensure => true, + enable => true, + name => $::vswitch::params::ovs_service_name, } } default: { @@ -50,8 +50,8 @@ class vswitch::ovs( } package { $::vswitch::params::ovs_package_name: - ensure => $package_ensure, - before => Service['openvswitch'], + ensure => $package_ensure, + before => Service['openvswitch'], } Service['openvswitch'] -> Vs_port<||>