From 1e7977e33c3808def2e76e7ce58d1251504700f5 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Thu, 13 Aug 2015 16:50:59 -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-empty_string-check gem and arrow alignment errors now caught by the newer puppet-lint gem. Change-Id: I20f0be5d20ad76ba51036089ef50675822d3b4c1 --- .gitignore | 2 ++ Gemfile | 30 ++++++++++++++++++++++++++++++ manifests/init.pp | 10 +++++----- templates/redis.2.2.conf.erb | 2 +- templates/redis.2.4.conf.erb | 2 +- templates/redis.2.6.conf.erb | 2 +- templates/redis.2.8.conf.erb | 2 +- 7 files changed, 41 insertions(+), 9 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/init.pp b/manifests/init.pp index b2b3a4b..df6e22f 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,7 +19,7 @@ class redis( $redis_port = '6379', $redis_bind = '127.0.0.1', - $redis_password = '', + $redis_password = undef, $redis_max_memory = '1gb', $redis_max_memory_policy = 'allkeys-lru', $version = '2.2.12', @@ -58,9 +58,9 @@ class redis( } service { 'redis-server': - ensure => running, - require => Package['redis-server'], - subscribe => File['/etc/redis/redis.conf'], + ensure => running, + require => Package['redis-server'], + subscribe => File['/etc/redis/redis.conf'], } -} \ No newline at end of file +} diff --git a/templates/redis.2.2.conf.erb b/templates/redis.2.2.conf.erb index 26145b1..152a914 100644 --- a/templates/redis.2.2.conf.erb +++ b/templates/redis.2.2.conf.erb @@ -147,7 +147,7 @@ slave-serve-stale-data yes # 150k passwords per second against a good box. This means that you should # use a very strong password otherwise it will be very easy to break. # -<% if @redis_password != "" %> +<% if @redis_password != nil %> requirepass <%= @redis_password %> <% end %> diff --git a/templates/redis.2.4.conf.erb b/templates/redis.2.4.conf.erb index ea74656..40218d8 100644 --- a/templates/redis.2.4.conf.erb +++ b/templates/redis.2.4.conf.erb @@ -178,7 +178,7 @@ slave-priority 100 # 150k passwords per second against a good box. This means that you should # use a very strong password otherwise it will be very easy to break. # -<% if @redis_password != "" %> +<% if @redis_password != nil %> requirepass <%= @redis_password %> <% end %> diff --git a/templates/redis.2.6.conf.erb b/templates/redis.2.6.conf.erb index b1b6ae3..a080d6c 100644 --- a/templates/redis.2.6.conf.erb +++ b/templates/redis.2.6.conf.erb @@ -255,7 +255,7 @@ slave-priority 100 # 150k passwords per second against a good box. This means that you should # use a very strong password otherwise it will be very easy to break. # -<% if @redis_password != "" %> +<% if @redis_password != nil %> requirepass <%= @redis_password %> <% end %> diff --git a/templates/redis.2.8.conf.erb b/templates/redis.2.8.conf.erb index b125c4b..4b16bd2 100644 --- a/templates/redis.2.8.conf.erb +++ b/templates/redis.2.8.conf.erb @@ -328,7 +328,7 @@ slave-priority 100 # use a very strong password otherwise it will be very easy to break. # # requirepass foobared -<% if @redis_password != "" %> +<% if @redis_password != nil %> requirepass <%= @redis_password %> <% end %>