Add Gemfile and puppet 4 checks

In anticipation of puppet 4, start trying to deal with puppet 4 things
that can be helpfully predicted by puppet lint plugins. This patch also
corrects lint errors caught by the puppet-lint-absolute_classname-check
and puppet-lint-empty_string-check gems as well as arrow alignment
which wasn't being caught under the system version of puppet-lint.

Change-Id: I5552777ba63d07039f9b2bed9c4100a44e6a0255
This commit is contained in:
Colleen Murphy 2015-07-20 17:43:16 -07:00
parent 937c3d7f49
commit f1b7e20f52
4 changed files with 45 additions and 13 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
Gemfile.lock
.bundled_gems/

30
Gemfile Normal file
View File

@ -0,0 +1,30 @@
source 'https://rubygems.org'
group :development, :test do
gem 'puppetlabs_spec_helper', :require => false
gem 'metadata-json-lint'
# This is nice and all, but let's not worry about it until we've actually
# got puppet 4.x sorted
# gem 'puppet-lint-param-docs'
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-empty_string-check'
gem 'puppet-lint-leading_zero-check'
gem 'puppet-lint-variable_contains_upcase'
gem 'puppet-lint-spaceship_operator_without_tag-check'
gem 'puppet-lint-undef_in_function-check'
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', '~> 3.0', :require => false
end
end
# vim:ft=ruby

View File

@ -18,14 +18,14 @@
# #
class elastic_recheck::bot ( class elastic_recheck::bot (
$gerrit_host, $gerrit_host,
$gerrit_ssh_host_key = '', $gerrit_ssh_host_key = undef,
$recheck_gerrit_user = 'elasticrecheck', $recheck_gerrit_user = 'elasticrecheck',
$recheck_ssh_private_key = '', $recheck_ssh_private_key = undef,
$recheck_ssh_public_key = '', $recheck_ssh_public_key = undef,
$recheck_bot_passwd, $recheck_bot_passwd,
$recheck_bot_nick, $recheck_bot_nick,
) { ) {
include elastic_recheck include ::elastic_recheck
file { '/etc/elastic-recheck/elastic-recheck.conf': file { '/etc/elastic-recheck/elastic-recheck.conf':
ensure => present, ensure => present,
@ -52,7 +52,7 @@ class elastic_recheck::bot (
require => Class['elastic_recheck'], require => Class['elastic_recheck'],
} }
if $recheck_ssh_private_key != '' { if $recheck_ssh_private_key != undef {
file { '/home/recheck/.ssh/id_rsa': file { '/home/recheck/.ssh/id_rsa':
owner => 'recheck', owner => 'recheck',
group => 'recheck', group => 'recheck',
@ -63,7 +63,7 @@ class elastic_recheck::bot (
} }
} }
if $recheck_ssh_public_key != '' { if $recheck_ssh_public_key != undef {
file { '/home/recheck/.ssh/id_rsa.pub': file { '/home/recheck/.ssh/id_rsa.pub':
owner => 'recheck', owner => 'recheck',
group => 'recheck', group => 'recheck',
@ -74,7 +74,7 @@ class elastic_recheck::bot (
} }
} }
if $gerrit_ssh_host_key != '' { if $gerrit_ssh_host_key != undef {
file { '/home/recheck/.ssh/known_hosts': file { '/home/recheck/.ssh/known_hosts':
owner => 'recheck', owner => 'recheck',
group => 'recheck', group => 'recheck',

View File

@ -46,7 +46,7 @@ class elastic_recheck (
source => 'https://git.openstack.org/openstack-infra/elastic-recheck', source => 'https://git.openstack.org/openstack-infra/elastic-recheck',
} }
include pip include ::pip
exec { 'install_elastic-recheck' : exec { 'install_elastic-recheck' :
command => 'pip install /opt/elastic-recheck', command => 'pip install /opt/elastic-recheck',
path => '/usr/local/bin:/usr/bin:/bin/', path => '/usr/local/bin:/usr/bin:/bin/',
@ -56,11 +56,11 @@ class elastic_recheck (
} }
file { '/usr/local/bin/er_safe_run.sh': file { '/usr/local/bin/er_safe_run.sh':
ensure => present, ensure => present,
source => 'puppet:///modules/elastic_recheck/er_safe_run.sh', source => 'puppet:///modules/elastic_recheck/er_safe_run.sh',
mode => '0755', mode => '0755',
owner => 'root', owner => 'root',
group => 'root', group => 'root',
} }
file { '/var/run/elastic-recheck': file { '/var/run/elastic-recheck':