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 <gchamoul@redhat.com>
This commit is contained in:
Gael Chamoulaud 2015-04-17 11:54:35 +02:00
parent 7d83f160cc
commit da6eaa1d3a
3 changed files with 27 additions and 16 deletions

13
Gemfile
View File

@ -2,8 +2,19 @@ source 'https://rubygems.org'
group :development, :test do group :development, :test do
gem 'puppetlabs_spec_helper', :require => false gem 'puppetlabs_spec_helper', :require => false
gem 'metadata-json-lint' 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 'rspec-puppet', '~> 1.0.1'
gem 'rake', '10.1.1' gem 'rake', '10.1.1'
gem 'rspec', '< 2.99' gem 'rspec', '< 2.99'

View File

@ -27,6 +27,6 @@
class vswitch ( class vswitch (
$provider = $vswitch::params::provider $provider = $vswitch::params::provider
) { ) {
$cls = "vswitch::${provider}" $cls = "::vswitch::${provider}"
include $cls include $cls
} }

View File

@ -4,7 +4,7 @@ class vswitch::ovs(
$package_ensure = 'present' $package_ensure = 'present'
) { ) {
include 'vswitch::params' include ::vswitch::params
case $::osfamily { case $::osfamily {
'Debian': { 'Debian': {
@ -21,27 +21,27 @@ class vswitch::ovs(
$ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"' $ovs_status = '/etc/init.d/openvswitch-switch status | fgrep "is running"'
} }
} }
service {'openvswitch': service { 'openvswitch':
ensure => true, ensure => true,
enable => true, enable => true,
name => $::vswitch::params::ovs_service_name, name => $::vswitch::params::ovs_service_name,
hasstatus => false, # the supplied command returns true even if it's not running 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 # Not perfect - should spot if either service is not running - but it'll do
status => $ovs_status status => $ovs_status,
} }
exec { 'rebuild-ovsmod': exec { 'rebuild-ovsmod':
command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log', command => '/usr/sbin/dpkg-reconfigure openvswitch-datapath-dkms > /tmp/reconf-log',
creates => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko", creates => "/lib/modules/${::kernelrelease}/updates/dkms/openvswitch_mod.ko",
require => [Package['openvswitch-datapath-dkms', $kernelheaders_pkg]], require => [Package['openvswitch-datapath-dkms', $kernelheaders_pkg]],
before => Package['openvswitch-switch'], before => Package['openvswitch-switch'],
refreshonly => true refreshonly => true,
} }
} }
'Redhat': { 'Redhat': {
service {'openvswitch': service { 'openvswitch':
ensure => true, ensure => true,
enable => true, enable => true,
name => $::vswitch::params::ovs_service_name, name => $::vswitch::params::ovs_service_name,
} }
} }
default: { default: {
@ -50,8 +50,8 @@ class vswitch::ovs(
} }
package { $::vswitch::params::ovs_package_name: package { $::vswitch::params::ovs_package_name:
ensure => $package_ensure, ensure => $package_ensure,
before => Service['openvswitch'], before => Service['openvswitch'],
} }
Service['openvswitch'] -> Vs_port<||> Service['openvswitch'] -> Vs_port<||>