From a07962ba554d0a56b6d60bc31da2ef449c731baf Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Wed, 8 Jul 2015 16:59: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. This patch also corrects lint errors caught by the puppet-lint-absolute_classname-check gem. We disable the puppet-lint-empty_string-check gem to be corrected by a follow-up patch. We disable the disable_arrow_alignment check in the Rakefile. Previously, the system version of puppet-lint that was being run by 'rake lint' was too old to catch this. When using 'bundle exec rake lint' the gem is new enough to catch this. Whether we want to actually fix these lint errors is a different discussion, so this patch disables it for now. Change-Id: I2b2c8511367b2e97c30b7681125d9063b3e78a86 --- .gitignore | 2 ++ Gemfile | 32 ++++++++++++++++++++++++++++++++ Rakefile | 3 ++- examples/site.pp | 10 +++++----- manifests/config.pp | 14 +++++++------- manifests/init.pp | 4 ++-- manifests/install.pp | 2 +- manifests/site/log.pp | 2 +- manifests/site/ssl.pp | 2 +- 9 files changed, 53 insertions(+), 18 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..437f433 --- /dev/null +++ b/Gemfile @@ -0,0 +1,32 @@ +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' + # Hold off on the empty string check for now + #gem 'puppet-lint-empty_string-check' + gem 'puppet-lint-leading_zero-check' + gem 'puppet-lint-variable_contains_upcase' + gem 'puppet-lint-numericvariable' + 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/Rakefile b/Rakefile index 7f22329..66c2b73 100644 --- a/Rakefile +++ b/Rakefile @@ -5,4 +5,5 @@ PuppetLint.configuration.fail_on_warnings = true PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.send('disable_autoloader_layout') PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_class_parameter_defaults') \ No newline at end of file +PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetLint.configuration.send('disable_arrow_alignment') diff --git a/examples/site.pp b/examples/site.pp index b9ae4b3..372f959 100644 --- a/examples/site.pp +++ b/examples/site.pp @@ -20,7 +20,7 @@ node 'default' { case $db_provider { 'mysql': { - class { 'mysql::server': + class { '::mysql::server': } mysql::db { 'askbotdb': @@ -32,7 +32,7 @@ node 'default' { } } 'pgsql': { - class { 'postgresql::server': } + class { '::postgresql::server': } postgresql::server::db { $db_name: user => $db_user, @@ -46,7 +46,7 @@ node 'default' { } # redis (custom module written by tipit) - class { 'redis': + class { '::redis': redis_port => $redis_port, redis_max_memory => $redis_max_memory, redis_bind => $redis_bind, @@ -56,7 +56,7 @@ node 'default' { } # solr search engine - class { 'solr': + class { '::solr': mirror => 'http://apache.mesi.com.ar/lucene/solr', version => $solr_version, cores => [ 'core-default', 'core-en', 'core-zh' ], @@ -93,7 +93,7 @@ node 'default' { require => Exec['copy-solr'], } - class { 'askbot': + class { '::askbot': db_provider => $db_provider, db_name => $db_name, db_user => $db_user, diff --git a/manifests/config.pp b/manifests/config.pp index a246da4..6934173 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -50,7 +50,7 @@ class askbot::config ( } if $site_ssl_enabled { - class { 'askbot::site::ssl': + class { '::askbot::site::ssl': site_ssl_cert_file_contents => $site_ssl_cert_file_contents, site_ssl_key_file_contents => $site_ssl_key_file_contents, site_ssl_chain_file_contents => $site_ssl_chain_file_contents, @@ -60,16 +60,16 @@ class askbot::config ( } } - class { 'askbot::site::http': + class { '::askbot::site::http': site_root => $site_root, site_name => $site_name, } - class { 'askbot::site::celeryd': + class { '::askbot::site::celeryd': site_root => $site_root, } - class { 'askbot::site::config': + class { '::askbot::site::config': site_root => $site_root, dist_root => $dist_root, db_provider => $db_provider, @@ -91,16 +91,16 @@ class askbot::config ( solr_enabled => $solr_enabled, } - class { 'askbot::site::static': + class { '::askbot::site::static': site_root => $site_root, } - class { 'askbot::site::log': + class { '::askbot::site::log': site_root => $site_root, www_group => $www_group, } - class { 'askbot::site::cron': + class { '::askbot::site::cron': site_root => $site_root, } diff --git a/manifests/init.pp b/manifests/init.pp index a8650ce..3b38e46 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -84,7 +84,7 @@ class askbot ( $smtp_host = 'localhost' ) { - class { 'askbot::install': + class { '::askbot::install': db_provider => $db_provider, dist_root => $dist_root, askbot_repo => $askbot_repo, @@ -110,7 +110,7 @@ class askbot ( require => [ File[$dist_root], Package['git'] ], } - class { 'askbot::config': + class { '::askbot::config': site_root => $site_root, dist_root => $dist_root, www_group => $www_group, diff --git a/manifests/install.pp b/manifests/install.pp index 3a6179c..8179c93 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -51,7 +51,7 @@ class askbot::install ( } } - include apache::mod::wsgi + include ::apache::mod::wsgi if $solr_enabled { package { [ 'django-haystack', 'pysolr' ]: diff --git a/manifests/site/log.pp b/manifests/site/log.pp index 20017c1..f6517ce 100644 --- a/manifests/site/log.pp +++ b/manifests/site/log.pp @@ -22,7 +22,7 @@ class askbot::site::log ( require => File["${site_root}/log"], } - include logrotate + include ::logrotate logrotate::file { 'askbot': log => "${site_root}/log/askbot.log", options => [ diff --git a/manifests/site/ssl.pp b/manifests/site/ssl.pp index 28576d0..c30bea2 100644 --- a/manifests/site/ssl.pp +++ b/manifests/site/ssl.pp @@ -8,7 +8,7 @@ class askbot::site::ssl ( $site_ssl_key_file = '', $site_ssl_chain_file = '', ) { - include apache::ssl + include ::apache::ssl # site x509 certificate if $site_ssl_cert_file_contents != '' {