diff --git a/Gemfile b/Gemfile index 9346669..251d6ff 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,23 @@ source ENV['GEM_SOURCE'] || 'https://rubygems.org' -group :test do - gem "json_pure", '2.0.1' if RUBY_VERSION < '2.0' - gem "rake" - gem "puppet", ENV['PUPPET_VERSION'] || '~> 3.8.4' - gem "rspec-core", '< 3.2' if RUBY_VERSION < '1.9' - gem "puppet-lint" - gem "rspec-puppet", :git => 'https://github.com/rodjek/rspec-puppet.git' - gem "puppet-syntax" - gem "puppetlabs_spec_helper" - gem "metadata-json-lint" +puppetversion = ENV.key?('PUPPET_VERSION') ? ENV['PUPPET_VERSION'] : ['>= 3.3'] +gem "json", '< 2' if RUBY_VERSION < '2.0' +gem "json_pure", '2.0.1' if RUBY_VERSION < '2.0' +gem 'metadata-json-lint' +gem 'puppet', puppetversion +gem 'puppetlabs_spec_helper', '>= 1.0.0' +gem 'puppet-lint', '>= 1.0.0' +gem 'facter', '>= 1.7.0' +gem 'rspec-puppet' + +# rspec must be v2 for ruby 1.8.7 +if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' + gem 'rspec', '~> 2.0' + gem 'rake', '~> 10.0' +elsif RUBY_VERSION < '2' + gem 'rubocop', '< 0.42' +else + gem 'rubocop' end group :development do diff --git a/manifests/init.pp b/manifests/init.pp index 53207d0..2e5b2a9 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,7 +35,9 @@ if $install_repository == true { if $repo_custom_url == undef or $repo_custom_url == '' { - validate_re("$token", '^[0-9a-zA-Z\-]+$', 'You need to provide a valid token. See https://github.com/tubemogul/puppet-maxscale#before-you-begin for more details.') + # From stdlib doc: Compilation terminates if the first argument is not a string. Always use quotes to force stringification + # Dirty hack to avoid only_variable_string lint issue + validate_re("-${token}", '^-[0-9a-zA-Z\-]+$', 'You need to provide a valid token. See https://github.com/tubemogul/puppet-maxscale#before-you-begin for more details.') } } diff --git a/manifests/install.pp b/manifests/install.pp index b754b9c..417d8e0 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -39,7 +39,7 @@ } -> yumrepo { 'maxscale': enabled => '1', - descr => "MariaDB-MaxScale", + descr => 'MariaDB-MaxScale', baseurl => $repo_location, gpgcheck => '1', gpgkey => 'file:///etc/pki/rpm-gpg/MariaDB-MaxScale-GPG-KEY', diff --git a/manifests/params.pp b/manifests/params.pp index f3eaa34..d24240b 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,7 +28,7 @@ $repo_keyserver = '' $repo_release = '' if $::operatingsystem == 'RedHat' { - $_os = "rhel" + $_os = 'rhel' } else { $_os = downcase($::operatingsystem) } diff --git a/spec/classes/maxscale_spec.rb b/spec/classes/maxscale_spec.rb index 49b3216..6192a3d 100644 --- a/spec/classes/maxscale_spec.rb +++ b/spec/classes/maxscale_spec.rb @@ -59,7 +59,7 @@ it { should create_class('maxscale') } it { should contain_class('maxscale::params') } - it { should contain_class('maxscale::install').that_comes_before('maxscale::config') } + it { should contain_class('maxscale::install').that_comes_before('Class[maxscale::config]') } it { should contain_class('maxscale::config') } it do @@ -141,7 +141,7 @@ it { should create_class('maxscale') } it { should contain_class('maxscale::params') } - it { should contain_class('maxscale::install').that_comes_before('maxscale::config') } + it { should contain_class('maxscale::install').that_comes_before('Class[maxscale::config]') } it { should contain_class('maxscale::config') } case osfamily