From 3a57b1fe30ff42b9b0c65e1bc28dd96bd822a970 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Mon, 3 Aug 2015 22:31:20 -0700 Subject: [PATCH] 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. Also fix lint errors caught by the puppet-lint-absolute_classname-check and puppet-lint-empty_string-check gems. This patch changes a scope.lookupvar function call to ruby instance variable in the jenkins-log-client.default.erb template. This is safe to do because the template is called in the log_processor::client class and the variable in question is within that scope. Change-Id: Ia7d6af8bc76a65e37f5dfd184e37855fe3b97046 --- .gitignore | 2 ++ Gemfile | 30 ++++++++++++++++++++++++ manifests/client.pp | 4 ++-- manifests/init.pp | 2 +- manifests/worker.pp | 2 +- templates/jenkins-log-client.default.erb | 4 ++-- 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .gitignore create mode 100644 Gemfile diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dade81e --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +Gemfile.lock +.bundled_gems/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..96912da --- /dev/null +++ b/Gemfile @@ -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 diff --git a/manifests/client.pp b/manifests/client.pp index 8081e57..999a4af 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -17,7 +17,7 @@ # class log_processor::client ( $config_file, - $statsd_host = '', + $statsd_host = undef, ) { file { '/etc/logstash/jenkins-log-client.yaml': @@ -57,7 +57,7 @@ class log_processor::client ( require => File['/etc/init.d/jenkins-log-client'], } - include logrotate + include ::logrotate logrotate::file { 'log-client-debug.log': log => '/var/log/logstash/log-client-debug.log', options => [ diff --git a/manifests/init.pp b/manifests/init.pp index 661ca0e..eb08cf4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,7 +33,7 @@ class log_processor ( ensure => present, } - include pip + include ::pip package { 'gear': ensure => latest, provider => 'pip', diff --git a/manifests/worker.pp b/manifests/worker.pp index ec5653b..cfe173d 100644 --- a/manifests/worker.pp +++ b/manifests/worker.pp @@ -51,7 +51,7 @@ define log_processor::worker ( ], } - include logrotate + include ::logrotate logrotate::file { "log-worker${suffix}-debug.log": log => "/var/log/logstash/log-worker${suffix}-debug.log", options => [ diff --git a/templates/jenkins-log-client.default.erb b/templates/jenkins-log-client.default.erb index a048fad..884ad76 100644 --- a/templates/jenkins-log-client.default.erb +++ b/templates/jenkins-log-client.default.erb @@ -1,5 +1,5 @@ -<% if scope.lookupvar("log_processor::client::statsd_host") != "" %> -export STATSD_HOST=<%= scope.lookupvar("log_processor::client::statsd_host") %> +<% if @statsd_host != nil %> +export STATSD_HOST=<%= @statsd_host %> export STATSD_PORT=8125 export STATSD_PREFIX="logstash.geard" <% end %>