From 3ad9e7d8d3fce78e42dcf17815e04d31f811b774 Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 09:26:45 +0200 Subject: [PATCH 01/10] Make rake lint happy by fixing WARNINGS --- manifests/init.pp | 50 +++++++++++++++++------------------ manifests/logging/category.pp | 2 +- manifests/server.pp | 2 +- manifests/updater.pp | 4 +-- manifests/zone.pp | 8 +++--- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d820662..d3c16da 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -15,7 +15,7 @@ class bind ( File { ensure => present, owner => 'root', - group => $bind_group, + group => $::bind::defaults::bind_group, mode => '0644', require => Package['bind'], notify => Service['bind'], @@ -25,7 +25,7 @@ class bind ( package { 'bind': ensure => latest, - name => $bind_package, + name => $::bind::defaults::bind_package, } if $dnssec { @@ -42,7 +42,7 @@ class bind ( bind::key { 'rndc-key': algorithm => 'hmac-md5', secret_bits => '512', - keydir => $confdir, + keydir => $bind::defaults::confdir, keyfile => 'rndc.key', include => false, } @@ -55,36 +55,36 @@ class bind ( content => template('bind/rndc-helper.erb'), } - file { "${confdir}/zones": - ensure => directory, - mode => '2755', + file { "${::bind::defaults::confdir}/zones": + ensure => directory, + mode => '2755', } - file { $namedconf: + file { $::bind::defaults::namedconf: content => template('bind/named.conf.erb'), } - if $include_default_zones and $default_zones_source { - file { $default_zones_include: - source => $default_zones_source, + if $::bind::defaults::include_default_zones and $::bind::defaults::default_zones_source { + file { $::bind::defaults::default_zones_include: + source => $::bind::defaults::default_zones_source, } } - class { 'bind::keydir': - keydir => "${confdir}/keys", + class { '::bind::keydir': + keydir => "${::bind::defaults::confdir}/keys", } concat { [ - "${confdir}/acls.conf", - "${confdir}/keys.conf", - "${confdir}/views.conf", - "${confdir}/servers.conf", - "${confdir}/logging.conf", - "${confdir}/view-mappings.txt", - "${confdir}/domain-mappings.txt", + "${::bind::defaults::confdir}/acls.conf", + "${::bind::defaults::confdir}/keys.conf", + "${::bind::defaults::confdir}/views.conf", + "${::bind::defaults::confdir}/servers.conf", + "${::bind::defaults::confdir}/logging.conf", + "${::bind::defaults::confdir}/view-mappings.txt", + "${::bind::defaults::confdir}/domain-mappings.txt", ]: owner => 'root', - group => $bind_group, + group => $::bind::defaults::bind_group, mode => '0644', warn => true, require => Package['bind'], @@ -92,20 +92,20 @@ class bind ( } concat::fragment { 'bind-logging-header': - order => "00-header", - target => "${confdir}/logging.conf", + order => '00-header', + target => "${::bind::defaults::confdir}/logging.conf", content => "logging {\n"; } concat::fragment { 'bind-logging-footer': - order => "99-footer", - target => "${confdir}/logging.conf", + order => '99-footer', + target => "${::bind::defaults::confdir}/logging.conf", content => "};\n"; } service { 'bind': ensure => running, - name => $bind_service, + name => $::bind::defaults::bind_service, enable => true, hasrestart => true, hasstatus => true, diff --git a/manifests/logging/category.pp b/manifests/logging/category.pp index 6f613c2..15af2e0 100644 --- a/manifests/logging/category.pp +++ b/manifests/logging/category.pp @@ -1,7 +1,7 @@ # ex: syntax=puppet si ts=4 sw=4 et define bind::logging::category ( - $channels + $channels ) { concat::fragment { "bind-logging-category-${name}": order => "60-${name}", diff --git a/manifests/server.pp b/manifests/server.pp index fe9475f..0bf9412 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -6,7 +6,7 @@ define bind::server ( $key = undef, $transfers = undef, ) { - include bind + include ::bind concat::fragment { "bind-server-${name}": order => 10, diff --git a/manifests/updater.pp b/manifests/updater.pp index c90aedf..499aa9e 100644 --- a/manifests/updater.pp +++ b/manifests/updater.pp @@ -4,10 +4,10 @@ class bind::updater ( $keydir = undef, ) inherits bind::defaults { - if $nsupdate_package { + if $::bind::defaults::nsupdate_package { package { 'bind-tools': ensure => present, - name => $nsupdate_package, + name => $::bind::defaults::nsupdate_package, } } diff --git a/manifests/zone.pp b/manifests/zone.pp index 6fe0b05..867697d 100644 --- a/manifests/zone.pp +++ b/manifests/zone.pp @@ -22,7 +22,7 @@ define bind::zone ( $forwarders_port = 53, ) { # where there is a zone, there is a server - include bind + include ::bind # Pull some platform defaults and `bind` class parameters into the local scope $cachedir = $::bind::defaults::cachedir @@ -54,15 +54,15 @@ define bind::zone ( } unless !($allow_updates != '' and ! $dynamic) { - fail("allow_updates may only be provided for bind::zone resources with dynamic set to true") + fail('allow_updates may only be provided for bind::zone resources with dynamic set to true') } unless !($dnssec and ! $dynamic) { - fail("dnssec may only be true for bind::zone resources with dynamic set to true") + fail('dnssec may only be true for bind::zone resources with dynamic set to true') } unless !($key_directory != '' and ! $dnssec) { - fail("key_directory may only be provided for bind::zone resources with dnssec set to true") + fail('key_directory may only be provided for bind::zone resources with dnssec set to true') } unless !($allow_notify != '' and ! member(['slave', 'stub'], $zone_type)) { From 835d8ec27cf18974540f01b74a21990dfd01f7ba Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 09:29:58 +0200 Subject: [PATCH 02/10] Gitignore extended & rubocop added From gareth/puppet-module-skeleton example : https://github.com/garethr/puppet-module-skeleton --- .gitignore | 3 +- .rubocop.yml | 480 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 482 insertions(+), 1 deletion(-) create mode 100644 .rubocop.yml diff --git a/.gitignore b/.gitignore index 6ba09a0..5fd5ee3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ pkg/ .*.sw? -spec/fixtures Gemfile.lock +spec/fixtures/manifests +spec/fixtures/modules .rspec_system .vagrant .bundle diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..e4d810a --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,480 @@ +AllCops: + Exclude: + # Ignore HTML related things + - '**/*.erb' + # Ignore vendored gems + - 'vendor/**/*' + # Ignore code from test fixtures + - 'spec/fixtures/**/*' + +Lint/ConditionPosition: + Enabled: true + +Lint/ElseLayout: + Enabled: true + +Lint/UnreachableCode: + Enabled: true + +Lint/UselessComparison: + Enabled: true + +Lint/EnsureReturn: + Enabled: true + +Lint/HandleExceptions: + Enabled: true + +Lint/LiteralInCondition: + Enabled: true + +Lint/ShadowingOuterLocalVariable: + Enabled: true + +Lint/LiteralInInterpolation: + Enabled: true + +Style/RedundantReturn: + Enabled: true + +Lint/AmbiguousOperator: + Enabled: true + +Lint/AssignmentInCondition: + Enabled: true + +Style/SpaceBeforeComment: + Enabled: true + +# DISABLED - not useful +Style/HashSyntax: + Enabled: false + +# USES: as shortcut for non nil&valid checking a = x() and a.empty? +# DISABLED - not useful +Style/AndOr: + Enabled: false + +# DISABLED - not useful +Style/RedundantSelf: + Enabled: false + +# DISABLED - not useful +Metrics/MethodLength: + Enabled: false + +# DISABLED - not useful +Style/WhileUntilModifier: + Enabled: false + +# DISABLED - the offender is just haskell envy +Lint/AmbiguousRegexpLiteral: + Enabled: false + +# DISABLED +Lint/Eval: + Enabled: false + +# DISABLED +Lint/BlockAlignment: + Enabled: false + +# DISABLED +Lint/DefEndAlignment: + Enabled: false + +# DISABLED +Lint/EndAlignment: + Enabled: false + +# DISABLED +Lint/DeprecatedClassMethods: + Enabled: false + +# DISABLED +Lint/Loop: + Enabled: false + +# DISABLED +Lint/ParenthesesAsGroupedExpression: + Enabled: false + +Lint/RescueException: + Enabled: false + +Lint/StringConversionInInterpolation: + Enabled: false + +Lint/UnusedBlockArgument: + Enabled: false + +Lint/UnusedMethodArgument: + Enabled: false + +Lint/UselessAccessModifier: + Enabled: true + +Lint/UselessAssignment: + Enabled: true + +Lint/Void: + Enabled: true + +Style/AccessModifierIndentation: + Enabled: false + +Style/AccessorMethodName: + Enabled: false + +Style/Alias: + Enabled: false + +Style/AlignArray: + Enabled: false + +Style/AlignHash: + Enabled: false + +Style/AlignParameters: + Enabled: false + +Metrics/BlockNesting: + Enabled: false + +Style/AsciiComments: + Enabled: false + +Style/Attr: + Enabled: false + +Style/BracesAroundHashParameters: + Enabled: false + +Style/CaseEquality: + Enabled: false + +Style/CaseIndentation: + Enabled: false + +Style/CharacterLiteral: + Enabled: false + +Style/ClassAndModuleCamelCase: + Enabled: false + +Style/ClassAndModuleChildren: + Enabled: false + +Style/ClassCheck: + Enabled: false + +Metrics/ClassLength: + Enabled: false + +Style/ClassMethods: + Enabled: false + +Style/ClassVars: + Enabled: false + +Style/WhenThen: + Enabled: false + +# DISABLED - not useful +Style/WordArray: + Enabled: false + +Style/UnneededPercentQ: + Enabled: false + +Style/Tab: + Enabled: false + +Style/SpaceBeforeSemicolon: + Enabled: false + +Style/TrailingBlankLines: + Enabled: false + +Style/SpaceInsideBlockBraces: + Enabled: false + +Style/SpaceInsideBrackets: + Enabled: false + +Style/SpaceInsideHashLiteralBraces: + Enabled: false + +Style/SpaceInsideParens: + Enabled: false + +Style/LeadingCommentSpace: + Enabled: false + +Style/SingleSpaceBeforeFirstArg: + Enabled: false + +Style/SpaceAfterColon: + Enabled: false + +Style/SpaceAfterComma: + Enabled: false + +Style/SpaceAfterControlKeyword: + Enabled: false + +Style/SpaceAfterMethodName: + Enabled: false + +Style/SpaceAfterNot: + Enabled: false + +Style/SpaceAfterSemicolon: + Enabled: false + +Style/SpaceAroundEqualsInParameterDefault: + Enabled: false + +Style/SpaceAroundOperators: + Enabled: false + +Style/SpaceBeforeBlockBraces: + Enabled: false + +Style/SpaceBeforeComma: + Enabled: false + +Style/CollectionMethods: + Enabled: false + +Style/CommentIndentation: + Enabled: false + +Style/ColonMethodCall: + Enabled: false + +Style/CommentAnnotation: + Enabled: false + +Metrics/CyclomaticComplexity: + Enabled: false + +Style/ConstantName: + Enabled: false + +Style/Documentation: + Enabled: false + +Style/DefWithParentheses: + Enabled: false + +Style/DeprecatedHashMethods: + Enabled: false + +Style/DotPosition: + Enabled: false + +# DISABLED - used for converting to bool +Style/DoubleNegation: + Enabled: false + +Style/EachWithObject: + Enabled: false + +Style/EmptyLineBetweenDefs: + Enabled: false + +Style/IndentArray: + Enabled: false + +Style/IndentHash: + Enabled: false + +Style/IndentationConsistency: + Enabled: false + +Style/IndentationWidth: + Enabled: false + +Style/EmptyLines: + Enabled: false + +Style/EmptyLinesAroundAccessModifier: + Enabled: false + +Style/EmptyLiteral: + Enabled: false + +Metrics/LineLength: + Enabled: false + +Style/MethodCallParentheses: + Enabled: false + +Style/MethodDefParentheses: + Enabled: false + +Style/LineEndConcatenation: + Enabled: false + +Style/TrailingWhitespace: + Enabled: false + +Style/StringLiterals: + Enabled: false + +Style/TrailingComma: + Enabled: false + +Style/GlobalVars: + Enabled: false + +Style/GuardClause: + Enabled: false + +Style/IfUnlessModifier: + Enabled: false + +Style/MultilineIfThen: + Enabled: false + +Style/NegatedIf: + Enabled: false + +Style/NegatedWhile: + Enabled: false + +Style/Next: + Enabled: false + +Style/SingleLineBlockParams: + Enabled: false + +Style/SingleLineMethods: + Enabled: false + +Style/SpecialGlobalVars: + Enabled: false + +Style/TrivialAccessors: + Enabled: false + +Style/UnlessElse: + Enabled: false + +Style/VariableInterpolation: + Enabled: false + +Style/VariableName: + Enabled: false + +Style/WhileUntilDo: + Enabled: false + +Style/EvenOdd: + Enabled: false + +Style/FileName: + Enabled: false + +Style/For: + Enabled: false + +Style/Lambda: + Enabled: false + +Style/MethodName: + Enabled: false + +Style/MultilineTernaryOperator: + Enabled: false + +Style/NestedTernaryOperator: + Enabled: false + +Style/NilComparison: + Enabled: false + +Style/FormatString: + Enabled: false + +Style/MultilineBlockChain: + Enabled: false + +Style/Semicolon: + Enabled: false + +Style/SignalException: + Enabled: false + +Style/NonNilCheck: + Enabled: false + +Style/Not: + Enabled: false + +Style/NumericLiterals: + Enabled: false + +Style/OneLineConditional: + Enabled: false + +Style/OpMethod: + Enabled: false + +Style/ParenthesesAroundCondition: + Enabled: false + +Style/PercentLiteralDelimiters: + Enabled: false + +Style/PerlBackrefs: + Enabled: false + +Style/PredicateName: + Enabled: false + +Style/RedundantException: + Enabled: false + +Style/SelfAssignment: + Enabled: false + +Style/Proc: + Enabled: false + +Style/RaiseArgs: + Enabled: false + +Style/RedundantBegin: + Enabled: false + +Style/RescueModifier: + Enabled: false + +Style/RegexpLiteral: + Enabled: false + +Lint/UnderscorePrefixedVariableName: + Enabled: false + +Metrics/ParameterLists: + Enabled: false + +Lint/RequireParentheses: + Enabled: false + +Lint/SpaceBeforeFirstArg: + Enabled: false + +Style/ModuleFunction: + Enabled: false + +Lint/Debugger: + Enabled: false + +Style/IfWithSemicolon: + Enabled: false + +Style/Encoding: + Enabled: false From db092386e3fbb3448b6b954fffe368fb3f87e759 Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 09:38:06 +0200 Subject: [PATCH 03/10] Fix metadata.json opened dependencies --- metadata.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/metadata.json b/metadata.json index dcadf2b..ee76472 100644 --- a/metadata.json +++ b/metadata.json @@ -27,8 +27,8 @@ } ], "dependencies": [ - { "name": "puppetlabs/stdlib" }, - { "name": "puppetlabs/concat", "version_requirement": ">=2.0.0" } + { "name": "puppetlabs/stdlib", "version_requirement": ">=4.15 < 5.0.0" }, + { "name": "puppetlabs/concat", "version_requirement": ">=2.0.0 < 3.0.0" } ], "data_provider": "hiera" } From 3b97ec6626415af9d034ba01becb746770eee4cd Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 09:41:27 +0200 Subject: [PATCH 04/10] Add modern Gemfile based on gareth skeleton --- Gemfile | 45 ++++++++++++++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 11 deletions(-) diff --git a/Gemfile b/Gemfile index 3504806..63c4959 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,37 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" -if ENV.include?('PUPPET_VERSION') - puppetversion = "~>#{ENV['PUPPET_VERSION']}" -else - puppetversion = '~>4.5.0' +group :test do + gem "rake", '< 11.0' + gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0' + gem "rspec", '<= 3.1.0' + gem "rspec-puppet" + gem "puppetlabs_spec_helper" + gem "metadata-json-lint" + gem "rspec-puppet-facts" + gem 'rubocop', '0.33.0' + gem 'simplecov', '>= 0.11.0' + gem 'simplecov-console' + + gem "puppet-lint-absolute_classname-check" + gem "puppet-lint-leading_zero-check" + gem "puppet-lint-trailing_comma-check" + gem "puppet-lint-version_comparison-check" + gem "puppet-lint-classes_and_types_beginning_with_digits-check" + gem "puppet-lint-unquoted_string-check" + gem 'puppet-lint-resource_reference_syntax' + + gem 'json_pure', '<= 2.0.1' if RUBY_VERSION < '2.0.0' end -gem 'rake' -gem 'puppet', puppetversion -gem 'puppet-lint' -gem 'rspec-puppet' -gem 'puppetlabs_spec_helper' -gem 'metadata-json-lint' +group :development do + gem "travis" if RUBY_VERSION >= '2.1.0' + gem "travis-lint" if RUBY_VERSION >= '2.1.0' + gem "puppet-blacksmith" + gem "guard-rake" if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep +end + +group :system_tests do + gem "beaker" + gem "beaker-rspec" + gem "beaker-puppet_install_helper" +end From d85effdf4162efb5dc2e7bcd65c06f807137e2ec Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 10:10:42 +0200 Subject: [PATCH 05/10] Update Gemfile and modernize Rakefile --- Gemfile | 15 +++++++++------ Rakefile | 58 +++++++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 21 deletions(-) diff --git a/Gemfile b/Gemfile index 63c4959..3e18996 100644 --- a/Gemfile +++ b/Gemfile @@ -1,14 +1,15 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do - gem "rake", '< 11.0' - gem "puppet", ENV['PUPPET_GEM_VERSION'] || '~> 3.8.0' - gem "rspec", '<= 3.1.0' + puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 4.9'] + gem "rake" + gem "puppet", puppetversion + gem "rspec", '> 3.4.0' gem "rspec-puppet" gem "puppetlabs_spec_helper" gem "metadata-json-lint" gem "rspec-puppet-facts" - gem 'rubocop', '0.33.0' + gem 'rubocop', '0.42.0' gem 'simplecov', '>= 0.11.0' gem 'simplecov-console' @@ -24,10 +25,12 @@ group :test do end group :development do - gem "travis" if RUBY_VERSION >= '2.1.0' - gem "travis-lint" if RUBY_VERSION >= '2.1.0' + gem "travis" if RUBY_VERSION >= '2.1.0' + gem "travis-lint" if RUBY_VERSION >= '2.1.0' gem "puppet-blacksmith" gem "guard-rake" if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep + gem 'yard' + gem 'puppet-strings' end group :system_tests do diff --git a/Rakefile b/Rakefile index bf74c98..94fd3f0 100644 --- a/Rakefile +++ b/Rakefile @@ -1,40 +1,68 @@ +require 'rubygems' +require 'bundler/setup' + require 'puppetlabs_spec_helper/rake_tasks' +require 'puppet/version' require 'puppet-lint/tasks/puppet-lint' require 'puppet-syntax/tasks/puppet-syntax' +require 'metadata-json-lint/rake_task' +require 'rubocop/rake_task' + +if Puppet.version.to_f >= 4.9 + require 'semantic_puppet' +elsif Puppet.version.to_f >= 3.6 && Puppet.version.to_f < 4.9 + require 'puppet/vendor/semantic/lib/semantic' +end + +# These gems aren't always present, for instance +# on Travis with --without development +begin + require 'puppet_blacksmith/rake_tasks' +rescue LoadError # rubocop:disable Lint/HandleExceptions +end + +#RuboCop::RakeTask.new exclude_paths = [ - 'bundle/**/*', - 'pkg/**/*', - 'vendor/**/*', - 'spec/**/*' + "bundle/**/*", + "pkg/**/*", + "vendor/**/*", + "spec/**/*", ] +# Coverage from puppetlabs-spec-helper requires rcov which +# doesn't work in anything since 1.8.7 +#Rake::Task[:coverage].clear + Rake::Task[:lint].clear + +PuppetLint.configuration.relative = true +PuppetLint.configuration.disable_80chars +PuppetLint.configuration.disable_class_inherits_from_params_class +PuppetLint.configuration.disable_class_parameter_defaults +PuppetLint.configuration.fail_on_warnings = true + PuppetLint::RakeTask.new :lint do |config| - config.fail_on_warnings = true config.ignore_paths = exclude_paths - config.disable_checks = [ - '80chars', - 'class_parameter_defaults', - 'documentation', - 'autoloader_layout' - ] end PuppetSyntax.exclude_paths = exclude_paths +desc "Run acceptance tests" RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance' end -task :metadata do - sh 'metadata-json-lint metadata.json' +desc "Populate CONTRIBUTORS file" +task :contributors do + system("git log --format='%aN' | sort -u > CONTRIBUTORS") end -desc 'Run syntax, lint, and spec tests.' +desc "Run syntax, lint, and spec tests." task :test => [ + :metadata_lint, :syntax, :lint, + :rubocop, :spec, - :metadata ] From 7671acbcf6f914dbab45997538e2501c3bb8a82f Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 10:12:14 +0200 Subject: [PATCH 06/10] Updated travis & removed Gemfile.lock --- .rspec | 4 ++++ .travis.yml | 27 ++++++++++++++++--------- Gemfile.lock | 57 ---------------------------------------------------- 3 files changed, 21 insertions(+), 67 deletions(-) create mode 100644 .rspec delete mode 100644 Gemfile.lock diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..8cf94aa --- /dev/null +++ b/.rspec @@ -0,0 +1,4 @@ +--format documentation +--color + + diff --git a/.travis.yml b/.travis.yml index 9ad0b9a..4d340f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,19 @@ +--- language: ruby -rvm: - - 2.0.0 - - 2.1.0 +sudo: false +bundler_args: --without development system_tests +before_install: rm Gemfile.lock || true +script: bundle exec rake test env: - - PUPPET_VERSION=4.0.0 - - PUPPET_VERSION=4.5.0 -gemfile: Gemfile.travis -before_install: 'cp Gemfile Gemfile.travis' -notifications: - email: - - 'inkblot@movealong.org' + - PUPPET_GEM_VERSION="~> 4.0.0" + - PUPPET_GEM_VERSION="~> 4.5.0" + - PUPPET_GEM_VERSION="~> 4.9.0" +rvm: + - 2.2 +matrix: + exclude: + - rvm: 2.2 + env: PUPPET_GEM_VERSION="~> 3.7.0" + - rvm: 2.2 + env: PUPPET_GEM_VERSION="~> 3.8.0" + fast_finish: false diff --git a/Gemfile.lock b/Gemfile.lock deleted file mode 100644 index b95d779..0000000 --- a/Gemfile.lock +++ /dev/null @@ -1,57 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - CFPropertyList (2.2.8) - diff-lcs (1.2.5) - facter (2.4.6) - CFPropertyList (~> 2.2.6) - hiera (3.2.1) - json_pure (2.0.2) - metaclass (0.0.4) - metadata-json-lint (0.0.2) - mocha (1.1.0) - metaclass (~> 0.0.1) - puppet (4.5.3) - CFPropertyList (~> 2.2.6) - facter (> 2.0, < 4) - hiera (>= 2.0, < 4) - json_pure - puppet-lint (1.1.0) - puppet-syntax (1.3.0) - rake - puppetlabs_spec_helper (0.8.2) - mocha - puppet-lint - puppet-syntax - rake - rspec - rspec-puppet - rake (10.4.2) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) - diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-puppet (1.0.1) - rspec - rspec-support (3.1.2) - -PLATFORMS - ruby - -DEPENDENCIES - metadata-json-lint - puppet (~> 4.5.0) - puppet-lint - puppetlabs_spec_helper - rake - rspec-puppet - -BUNDLED WITH - 1.13.5 From b126ad5405bf2ef8c93455ba4d9372066dd36506 Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 10:13:53 +0200 Subject: [PATCH 07/10] Added Gemfile.lock to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5fd5ee3..6bb873d 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ pkg/ Gemfile.lock spec/fixtures/manifests spec/fixtures/modules +Gemfile.lock .rspec_system .vagrant .bundle From d0dc06d4ca8aed6c4b06ee89ab1e7e0b48c9175b Mon Sep 17 00:00:00 2001 From: Cedric DEFORTIS Date: Thu, 27 Apr 2017 11:37:25 +0200 Subject: [PATCH 08/10] Fix global variable error & update concat version --- manifests/init.pp | 2 +- metadata.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index d3c16da..40b39d6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -64,7 +64,7 @@ class bind ( content => template('bind/named.conf.erb'), } - if $::bind::defaults::include_default_zones and $::bind::defaults::default_zones_source { + if $include_default_zones and $::bind::defaults::default_zones_source { file { $::bind::defaults::default_zones_include: source => $::bind::defaults::default_zones_source, } diff --git a/metadata.json b/metadata.json index ee76472..412112f 100644 --- a/metadata.json +++ b/metadata.json @@ -28,7 +28,7 @@ ], "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">=4.15 < 5.0.0" }, - { "name": "puppetlabs/concat", "version_requirement": ">=2.0.0 < 3.0.0" } + { "name": "puppetlabs/concat", "version_requirement": ">=2.2.1 < 3.0.0" } ], "data_provider": "hiera" } From 3ff354877b6146f00e6d032be09ae11456c844d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Defortis?= Date: Tue, 2 May 2017 11:57:57 +0200 Subject: [PATCH 09/10] Fix Rubocop offenses --- .rubocop.yml | 21 +++++++++++---------- Gemfile | 26 +++++++++++++------------- 2 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index e4d810a..f70c35c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -63,6 +63,10 @@ Style/RedundantSelf: Metrics/MethodLength: Enabled: false +# DISABLED +Metrics/BlockLength: + Enabled: false + # DISABLED - not useful Style/WhileUntilModifier: Enabled: false @@ -72,7 +76,7 @@ Lint/AmbiguousRegexpLiteral: Enabled: false # DISABLED -Lint/Eval: +Security/Eval: Enabled: false # DISABLED @@ -211,16 +215,13 @@ Style/SpaceInsideParens: Style/LeadingCommentSpace: Enabled: false -Style/SingleSpaceBeforeFirstArg: - Enabled: false - Style/SpaceAfterColon: Enabled: false Style/SpaceAfterComma: Enabled: false -Style/SpaceAfterControlKeyword: +Style/SpaceAroundKeyword: Enabled: false Style/SpaceAfterMethodName: @@ -268,8 +269,8 @@ Style/Documentation: Style/DefWithParentheses: Enabled: false -Style/DeprecatedHashMethods: - Enabled: false +#Style/DeprecatedHashMethods: +# Enabled: false Style/DotPosition: Enabled: false @@ -308,7 +309,7 @@ Style/EmptyLiteral: Metrics/LineLength: Enabled: false -Style/MethodCallParentheses: +Style/MethodCallWithoutArgsParentheses: Enabled: false Style/MethodDefParentheses: @@ -323,7 +324,7 @@ Style/TrailingWhitespace: Style/StringLiterals: Enabled: false -Style/TrailingComma: +Style/TrailingCommaInLiteral: Enabled: false Style/GlobalVars: @@ -464,7 +465,7 @@ Metrics/ParameterLists: Lint/RequireParentheses: Enabled: false -Lint/SpaceBeforeFirstArg: +Style/SpaceBeforeFirstArg: Enabled: false Style/ModuleFunction: diff --git a/Gemfile b/Gemfile index 3e18996..94f72bb 100644 --- a/Gemfile +++ b/Gemfile @@ -2,39 +2,39 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :test do puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>= 4.9'] - gem "rake" + gem "metadata-json-lint" gem "puppet", puppetversion + gem "puppetlabs_spec_helper" + gem "rake" gem "rspec", '> 3.4.0' gem "rspec-puppet" - gem "puppetlabs_spec_helper" - gem "metadata-json-lint" gem "rspec-puppet-facts" - gem 'rubocop', '0.42.0' + gem 'rubocop' gem 'simplecov', '>= 0.11.0' gem 'simplecov-console' gem "puppet-lint-absolute_classname-check" - gem "puppet-lint-leading_zero-check" - gem "puppet-lint-trailing_comma-check" - gem "puppet-lint-version_comparison-check" gem "puppet-lint-classes_and_types_beginning_with_digits-check" - gem "puppet-lint-unquoted_string-check" + gem "puppet-lint-leading_zero-check" gem 'puppet-lint-resource_reference_syntax' + gem "puppet-lint-trailing_comma-check" + gem "puppet-lint-unquoted_string-check" + gem "puppet-lint-version_comparison-check" gem 'json_pure', '<= 2.0.1' if RUBY_VERSION < '2.0.0' end group :development do - gem "travis" if RUBY_VERSION >= '2.1.0' - gem "travis-lint" if RUBY_VERSION >= '2.1.0' - gem "puppet-blacksmith" gem "guard-rake" if RUBY_VERSION >= '2.2.5' # per dependency https://rubygems.org/gems/ruby_dep - gem 'yard' + gem "puppet-blacksmith" gem 'puppet-strings' + gem "travis" if RUBY_VERSION >= '2.1.0' + gem "travis-lint" if RUBY_VERSION >= '2.1.0' + gem 'yard' end group :system_tests do gem "beaker" - gem "beaker-rspec" gem "beaker-puppet_install_helper" + gem "beaker-rspec" end From 17ee328c0fd0ea155e2400196ed75276ffed1202 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Defortis?= Date: Tue, 2 May 2017 12:13:51 +0200 Subject: [PATCH 10/10] Fix extra rubocop offenses Also removed lib/ directory from rubocop inspection --- .rubocop.yml | 3 +++ Rakefile | 8 +------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index f70c35c..f9cdddb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -6,6 +6,9 @@ AllCops: - 'vendor/**/*' # Ignore code from test fixtures - 'spec/fixtures/**/*' + # Ignore lib/** as it contains a lot of offenses for now. + # TODO : fix lib/** offenses + - 'lib/**/*' Lint/ConditionPosition: Enabled: true diff --git a/Rakefile b/Rakefile index 94fd3f0..d786f98 100644 --- a/Rakefile +++ b/Rakefile @@ -59,10 +59,4 @@ task :contributors do end desc "Run syntax, lint, and spec tests." -task :test => [ - :metadata_lint, - :syntax, - :lint, - :rubocop, - :spec, -] +task :test => %i(metadata_lint syntax lint rubocop spec)