From d3a27252338451f72f4cec847aab05e12791fbe7 Mon Sep 17 00:00:00 2001 From: dleich Date: Mon, 7 Mar 2022 11:33:31 -0500 Subject: [PATCH 01/20] add viewer class requirements & fully qualify function dependency --- manifests/viewer.pp | 4 +++- metadata.json | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/manifests/viewer.pp b/manifests/viewer.pp index ac6c3f6..5564513 100644 --- a/manifests/viewer.pp +++ b/manifests/viewer.pp @@ -1,3 +1,5 @@ +# A class to configure the diff viewer webservice. For full details, see +# https://github.com/camptocamp/puppet-catalog-diff-viewer class catalog_diff::viewer ( String $remote = 'https://github.com/camptocamp/puppet-catalog-diff-viewer.git', String $password = 'puppet', @@ -35,7 +37,7 @@ htpasswd { 'puppet': username => 'puppet', - cryptpasswd => ht_crypt($password, $::uuid), + cryptpasswd => htpasswd::ht_crypt($password, $::uuid), target => '/var/www/.htpasswd', } diff --git a/metadata.json b/metadata.json index 4edb660..01fb040 100644 --- a/metadata.json +++ b/metadata.json @@ -8,7 +8,22 @@ "project_page": "https://github.com/camptocamp/puppet-catalog-diff", "issues_url": "https://github.com/camptocamp/puppet-catalog-diff/issues", "dependencies": [ - + { + "name": "puppetlabs/apache", + "version_requirement": ">=6.0.0 < 8.0.0" + }, + { + "name": "citrin/htpasswd", + "version_requirement": ">=1.0.0 < 2.0.0" + }, + { + "name": "puppetlabs/vcsrepo", + "version_requirement": ">=4.0.0 < 6.0.0" + }, + { + "name": "puppetlabs/git", + "version_requirement": ">=0.5.0 < 1.0.0" + } ], "operatingsystem_support": [ { From 69528c249f1a078107b96246621c2c80f2a3f0ae Mon Sep 17 00:00:00 2001 From: dleich Date: Mon, 7 Mar 2022 11:49:20 -0500 Subject: [PATCH 02/20] pdk update --- .devcontainer/Dockerfile | 6 + .devcontainer/README.md | 34 +++ .devcontainer/devcontainer.json | 17 ++ .gitignore | 1 + .pdkignore | 5 + .rubocop.yml | 424 ++++++++++++++++++++++++++++++-- .travis.yml | 6 +- Gemfile | 28 +-- Rakefile | 2 + appveyor.yml | 13 +- metadata.json | 6 +- pdk.yaml | 2 + spec/spec_helper.rb | 12 + 13 files changed, 498 insertions(+), 58 deletions(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/README.md create mode 100644 .devcontainer/devcontainer.json create mode 100644 pdk.yaml diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..12ed4ff --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM puppet/pdk:latest + +# [Optional] Uncomment this section to install additional packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..cc4675e --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,34 @@ +# devcontainer + + +For format details, see https://aka.ms/devcontainer.json. + +For config options, see the README at: +https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet + +``` json +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.shell.linux": "/bin/bash" + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ] + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pdk --version", +} +``` + + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fe7a8b1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } + }, + + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ] +} diff --git a/.gitignore b/.gitignore index 2767022..988dcbb 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ .project .envrc /inventory.yaml +/spec/fixtures/litmus_inventory.yaml diff --git a/.pdkignore b/.pdkignore index e6215cd..c538bea 100644 --- a/.pdkignore +++ b/.pdkignore @@ -25,13 +25,16 @@ .project .envrc /inventory.yaml +/spec/fixtures/litmus_inventory.yaml /appveyor.yml +/.editorconfig /.fixtures.yml /Gemfile /.gitattributes /.gitignore /.gitlab-ci.yml /.pdkignore +/.puppet-lint.rc /Rakefile /rakelib/ /.rspec @@ -40,3 +43,5 @@ /.yardopts /spec/ /.vscode/ +/.sync.yml +/.devcontainer/ diff --git a/.rubocop.yml b/.rubocop.yml index b7c972b..29fcedb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,12 @@ --- require: +- rubocop-performance - rubocop-rspec -- rubocop-i18n AllCops: DisplayCopNames: true - TargetRubyVersion: '2.1' + TargetRubyVersion: '2.4' Include: - - "./**/*.rb" + - "**/*.rb" Exclude: - bin/* - ".vendor/**/*" @@ -18,16 +18,9 @@ AllCops: - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" -Metrics/LineLength: +Layout/LineLength: Description: People have wide screens, use them. Max: 200 -GetText: - Enabled: false -GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. @@ -36,14 +29,13 @@ RSpec/BeforeAfterAll: RSpec/HookArgument: Description: Prefer explicit :each argument, matching existing module's style EnforcedStyle: each +RSpec/DescribeSymbol: + Exclude: + - spec/unit/facter/**/*.rb Style/BlockDelimiters: Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: false Style/ClassAndModuleChildren: Description: Compact style reduces the required amount of indentation. EnforcedStyle: compact @@ -72,7 +64,7 @@ Style/TrailingCommaInArguments: Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma @@ -88,26 +80,170 @@ Style/Documentation: - spec/**/* Style/WordArray: EnforcedStyle: brackets +Performance/AncestorsInclude: + Enabled: true +Performance/BigDecimalWithNumericArgument: + Enabled: true +Performance/BlockGivenWithExplicitBlock: + Enabled: true +Performance/CaseWhenSplat: + Enabled: true +Performance/ConstantRegexp: + Enabled: true +Performance/MethodObjectAsBlock: + Enabled: true +Performance/RedundantSortBlock: + Enabled: true +Performance/RedundantStringChars: + Enabled: true +Performance/ReverseFirst: + Enabled: true +Performance/SortReverse: + Enabled: true +Performance/Squeeze: + Enabled: true +Performance/StringInclude: + Enabled: true +Performance/Sum: + Enabled: true Style/CollectionMethods: Enabled: true Style/MethodCalledOnDoEndBlock: Enabled: true Style/StringMethods: Enabled: true -GetText/DecorateFunctionMessage: +Bundler/InsecureProtocolSource: + Enabled: false +Gemspec/DuplicatedAssignment: + Enabled: false +Gemspec/OrderedDependencies: + Enabled: false +Gemspec/RequiredRubyVersion: + Enabled: false +Gemspec/RubyVersionGlobalsUsage: + Enabled: false +Layout/ArgumentAlignment: + Enabled: false +Layout/BeginEndAlignment: + Enabled: false +Layout/ClosingHeredocIndentation: Enabled: false -GetText/DecorateStringFormattingUsingInterpolation: +Layout/EmptyComment: Enabled: false -GetText/DecorateStringFormattingUsingPercent: +Layout/EmptyLineAfterGuardClause: + Enabled: false +Layout/EmptyLinesAroundArguments: + Enabled: false +Layout/EmptyLinesAroundAttributeAccessor: Enabled: false Layout/EndOfLine: Enabled: false -Layout/IndentHeredoc: +Layout/FirstArgumentIndentation: + Enabled: false +Layout/HashAlignment: + Enabled: false +Layout/HeredocIndentation: + Enabled: false +Layout/LeadingEmptyLines: + Enabled: false +Layout/SpaceAroundMethodCallOperator: + Enabled: false +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: false +Layout/SpaceInsideReferenceBrackets: + Enabled: false +Lint/BigDecimalNew: + Enabled: false +Lint/BooleanSymbol: + Enabled: false +Lint/ConstantDefinitionInBlock: + Enabled: false +Lint/DeprecatedOpenSSLConstant: + Enabled: false +Lint/DisjunctiveAssignmentInConstructor: + Enabled: false +Lint/DuplicateElsifCondition: + Enabled: false +Lint/DuplicateRequire: + Enabled: false +Lint/DuplicateRescueException: + Enabled: false +Lint/EmptyConditionalBody: + Enabled: false +Lint/EmptyFile: + Enabled: false +Lint/ErbNewArguments: + Enabled: false +Lint/FloatComparison: + Enabled: false +Lint/HashCompareByIdentity: + Enabled: false +Lint/IdentityComparison: + Enabled: false +Lint/InterpolationCheck: + Enabled: false +Lint/MissingCopEnableDirective: + Enabled: false +Lint/MixedRegexpCaptureTypes: + Enabled: false +Lint/NestedPercentLiteral: + Enabled: false +Lint/NonDeterministicRequireOrder: + Enabled: false +Lint/OrderedMagicComments: + Enabled: false +Lint/OutOfRangeRegexpRef: + Enabled: false +Lint/RaiseException: + Enabled: false +Lint/RedundantCopEnableDirective: + Enabled: false +Lint/RedundantRequireStatement: + Enabled: false +Lint/RedundantSafeNavigation: + Enabled: false +Lint/RedundantWithIndex: + Enabled: false +Lint/RedundantWithObject: + Enabled: false +Lint/RegexpAsCondition: + Enabled: false +Lint/ReturnInVoidContext: + Enabled: false +Lint/SafeNavigationConsistency: + Enabled: false +Lint/SafeNavigationWithEmpty: + Enabled: false +Lint/SelfAssignment: + Enabled: false +Lint/SendWithMixinArgument: + Enabled: false +Lint/ShadowedArgument: + Enabled: false +Lint/StructNewOverride: + Enabled: false +Lint/ToJSON: + Enabled: false +Lint/TopLevelReturnWithArgument: + Enabled: false +Lint/TrailingCommaInAttributeDeclaration: + Enabled: false +Lint/UnreachableLoop: + Enabled: false +Lint/UriEscapeUnescape: + Enabled: false +Lint/UriRegexp: + Enabled: false +Lint/UselessMethodDefinition: + Enabled: false +Lint/UselessTimes: Enabled: false Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false +Metrics/BlockNesting: + Enabled: false Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: @@ -120,19 +256,265 @@ Metrics/ParameterLists: Enabled: false Metrics/PerceivedComplexity: Enabled: false +Migration/DepartmentName: + Enabled: false +Naming/AccessorMethodName: + Enabled: false +Naming/BlockParameterName: + Enabled: false +Naming/HeredocDelimiterCase: + Enabled: false +Naming/HeredocDelimiterNaming: + Enabled: false +Naming/MemoizedInstanceVariableName: + Enabled: false +Naming/MethodParameterName: + Enabled: false +Naming/RescuedExceptionsVariableName: + Enabled: false +Naming/VariableNumber: + Enabled: false +Performance/BindCall: + Enabled: false +Performance/DeletePrefix: + Enabled: false +Performance/DeleteSuffix: + Enabled: false +Performance/InefficientHashSearch: + Enabled: false +Performance/UnfreezeString: + Enabled: false +Performance/UriDefaultParser: + Enabled: false +RSpec/Be: + Enabled: false +RSpec/Capybara/CurrentPathExpectation: + Enabled: false +RSpec/Capybara/FeatureMethods: + Enabled: false +RSpec/Capybara/VisibilityMatcher: + Enabled: false +RSpec/ContextMethod: + Enabled: false +RSpec/ContextWording: + Enabled: false RSpec/DescribeClass: Enabled: false +RSpec/EmptyHook: + Enabled: false +RSpec/EmptyLineAfterExample: + Enabled: false +RSpec/EmptyLineAfterExampleGroup: + Enabled: false +RSpec/EmptyLineAfterHook: + Enabled: false RSpec/ExampleLength: Enabled: false -RSpec/MessageExpectation: +RSpec/ExampleWithoutDescription: + Enabled: false +RSpec/ExpectChange: + Enabled: false +RSpec/ExpectInHook: + Enabled: false +RSpec/FactoryBot/AttributeDefinedStatically: + Enabled: false +RSpec/FactoryBot/CreateList: + Enabled: false +RSpec/FactoryBot/FactoryClassName: + Enabled: false +RSpec/HooksBeforeExamples: + Enabled: false +RSpec/ImplicitBlockExpectation: + Enabled: false +RSpec/ImplicitSubject: + Enabled: false +RSpec/LeakyConstantDeclaration: + Enabled: false +RSpec/LetBeforeExamples: + Enabled: false +RSpec/MissingExampleGroupArgument: Enabled: false RSpec/MultipleExpectations: Enabled: false +RSpec/MultipleMemoizedHelpers: + Enabled: false +RSpec/MultipleSubjects: + Enabled: false RSpec/NestedGroups: Enabled: false +RSpec/PredicateMatcher: + Enabled: false +RSpec/ReceiveCounts: + Enabled: false +RSpec/ReceiveNever: + Enabled: false +RSpec/RepeatedExampleGroupBody: + Enabled: false +RSpec/RepeatedExampleGroupDescription: + Enabled: false +RSpec/RepeatedIncludeExample: + Enabled: false +RSpec/ReturnFromStub: + Enabled: false +RSpec/SharedExamples: + Enabled: false +RSpec/StubbedMock: + Enabled: false +RSpec/UnspecifiedException: + Enabled: false +RSpec/VariableDefinition: + Enabled: false +RSpec/VoidExpect: + Enabled: false +RSpec/Yield: + Enabled: false +Security/Open: + Enabled: false +Style/AccessModifierDeclarations: + Enabled: false +Style/AccessorGrouping: + Enabled: false Style/AsciiComments: Enabled: false +Style/BisectedAttrAccessor: + Enabled: false +Style/CaseLikeIf: + Enabled: false +Style/ClassEqualityComparison: + Enabled: false +Style/ColonMethodDefinition: + Enabled: false +Style/CombinableLoops: + Enabled: false +Style/CommentedKeyword: + Enabled: false +Style/Dir: + Enabled: false +Style/DoubleCopDisableDirective: + Enabled: false +Style/EmptyBlockParameter: + Enabled: false +Style/EmptyLambdaParameter: + Enabled: false +Style/Encoding: + Enabled: false +Style/EvalWithLocation: + Enabled: false +Style/ExpandPathArguments: + Enabled: false +Style/ExplicitBlockArgument: + Enabled: false +Style/ExponentialNotation: + Enabled: false +Style/FloatDivision: + Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false +Style/GlobalStdStream: + Enabled: false +Style/HashAsLastArrayItem: + Enabled: false +Style/HashLikeCase: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false Style/IfUnlessModifier: Enabled: false +Style/KeywordParametersOrder: + Enabled: false +Style/MinMax: + Enabled: false +Style/MixinUsage: + Enabled: false +Style/MultilineWhenThen: + Enabled: false +Style/NegatedUnless: + Enabled: false +Style/NumericPredicate: + Enabled: false +Style/OptionalBooleanParameter: + Enabled: false +Style/OrAssignment: + Enabled: false +Style/RandomWithOffset: + Enabled: false +Style/RedundantAssignment: + Enabled: false +Style/RedundantCondition: + Enabled: false +Style/RedundantConditional: + Enabled: false +Style/RedundantFetchBlock: + Enabled: false +Style/RedundantFileExtensionInRequire: + Enabled: false +Style/RedundantRegexpCharacterClass: + Enabled: false +Style/RedundantRegexpEscape: + Enabled: false +Style/RedundantSelfAssignment: + Enabled: false +Style/RedundantSort: + Enabled: false +Style/RescueStandardError: + Enabled: false +Style/SingleArgumentDig: + Enabled: false +Style/SlicingWithRange: + Enabled: false +Style/SoleNestedConditional: + Enabled: false +Style/StderrPuts: + Enabled: false +Style/StringConcatenation: + Enabled: false +Style/Strip: + Enabled: false Style/SymbolProc: Enabled: false +Style/TrailingBodyOnClass: + Enabled: false +Style/TrailingBodyOnMethodDefinition: + Enabled: false +Style/TrailingBodyOnModule: + Enabled: false +Style/TrailingCommaInHashLiteral: + Enabled: false +Style/TrailingMethodEndStatement: + Enabled: false +Style/UnpackFirst: + Enabled: false +Lint/DuplicateBranch: + Enabled: false +Lint/DuplicateRegexpCharacterClassElement: + Enabled: false +Lint/EmptyBlock: + Enabled: false +Lint/EmptyClass: + Enabled: false +Lint/NoReturnInBeginEndBlocks: + Enabled: false +Lint/ToEnumArguments: + Enabled: false +Lint/UnexpectedBlockArity: + Enabled: false +Lint/UnmodifiedReduceAccumulator: + Enabled: false +Performance/CollectionLiteralInLoop: + Enabled: false +Style/ArgumentsForwarding: + Enabled: false +Style/CollectionCompact: + Enabled: false +Style/DocumentDynamicEvalDefinition: + Enabled: false +Style/NegatedIfElseCondition: + Enabled: false +Style/NilLambda: + Enabled: false +Style/RedundantArgument: + Enabled: false +Style/SwapValues: + Enabled: false diff --git a/.travis.yml b/.travis.yml index 825663b..c11ec7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,12 +28,8 @@ jobs: fast_finish: true include: - - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" + env: CHECK="validate lint check rubocop" stage: static - - - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec - rvm: 2.4.5 - stage: spec - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec rvm: 2.5.7 diff --git a/Gemfile b/Gemfile index baaebda..37942af 100644 --- a/Gemfile +++ b/Gemfile @@ -17,20 +17,20 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "github_changelog_generator", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') gem "coveralls", require: false end +group :system_tests do + gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] +end puppet_version = ENV['PUPPET_GEM_VERSION'] facter_version = ENV['FACTER_GEM_VERSION'] @@ -46,16 +46,6 @@ gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version -if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} - # If we're using a Puppet gem on Windows which handles its own win32-xxx gem - # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). - gems['win32-dir'] = ['<= 0.4.9', require: false] - gems['win32-eventlog'] = ['<= 0.6.5', require: false] - gems['win32-process'] = ['<= 0.7.5', require: false] - gems['win32-security'] = ['<= 0.2.5', require: false] - gems['win32-service'] = ['0.8.8', require: false] -end - gems.each do |gem_name, gem_params| gem gem_name, *gem_params end diff --git a/Rakefile b/Rakefile index fd9aeca..95e9a13 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'bundler' require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' @@ -42,6 +43,7 @@ end PuppetLint.configuration.send('disable_relative') + if Bundler.rubygems.find_name('github_changelog_generator').any? GitHubChangelogGenerator::RakeTask.new :changelog do |config| raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? diff --git a/appveyor.yml b/appveyor.yml index f6a0927..a70c01e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,6 @@ --- version: 1.1.x.{build} +skip_branch_with_pr: true branches: only: - main @@ -16,16 +17,8 @@ init: environment: matrix: - - RUBY_VERSION: 24-x64 - CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop - - - PUPPET_GEM_VERSION: ~> 5.0 - RUBY_VERSION: 24 - CHECK: parallel_spec - - - PUPPET_GEM_VERSION: ~> 5.0 - RUBY_VERSION: 24-x64 - CHECK: parallel_spec + RUBY_VERSION: 25-x64 + CHECK: validate lint check rubocop - PUPPET_GEM_VERSION: ~> 6.0 RUBY_VERSION: 25 diff --git a/metadata.json b/metadata.json index 01fb040..6b75b7e 100644 --- a/metadata.json +++ b/metadata.json @@ -76,7 +76,7 @@ "version_requirement": ">= 4.10.0 < 7.0.0" } ], - "pdk-version": "1.17.0", - "template-url": "https://github.com/puppetlabs/pdk-templates.git#master", - "template-ref": "heads/master-0-ga58fd92" + "pdk-version": "2.4.0", + "template-url": "pdk-default#2.4.0", + "template-ref": "tags/2.4.0-0-gfa6b6d2" } diff --git a/pdk.yaml b/pdk.yaml new file mode 100644 index 0000000..4bef4bd --- /dev/null +++ b/pdk.yaml @@ -0,0 +1,2 @@ +--- +ignore: [] diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 16764b6..07db734 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -48,6 +48,18 @@ c.after(:suite) do RSpec::Puppet::Coverage.report!(0) end + + # Filter backtrace noise + backtrace_exclusion_patterns = [ + %r{spec_helper}, + %r{gems}, + ] + + if c.respond_to?(:backtrace_exclusion_patterns) + c.backtrace_exclusion_patterns = backtrace_exclusion_patterns + elsif c.respond_to?(:backtrace_clean_patterns) + c.backtrace_clean_patterns = backtrace_exclusion_patterns + end end # Ensures that a module is defined From 566220325cc894230c0f53c25ad458c33f4d7ae0 Mon Sep 17 00:00:00 2001 From: dleich Date: Mon, 7 Mar 2022 13:46:53 -0500 Subject: [PATCH 03/20] tweaks to enable spec testing of viewer class --- .fixtures.yml | 7 ++++++- metadata.json | 4 ++++ spec/classes/viewer_spec.rb | 14 ++++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 spec/classes/viewer_spec.rb diff --git a/.fixtures.yml b/.fixtures.yml index 2296adb..99173e4 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,4 +3,9 @@ --- fixtures: forge_modules: -# stdlib: "puppetlabs/stdlib" + stdlib: "puppetlabs/stdlib" + apache: "puppetlabs/apache" + htpasswd: "citrin/htpasswd" + vcsrepo: "puppetlabs/vcsrepo" + git: "puppetlabs/git" + concat: "puppetlabs/concat" diff --git a/metadata.json b/metadata.json index 6b75b7e..f747b1d 100644 --- a/metadata.json +++ b/metadata.json @@ -23,6 +23,10 @@ { "name": "puppetlabs/git", "version_requirement": ">=0.5.0 < 1.0.0" + }, + { + "name": "puppetlabs/concat", + "version_requirement": ">=7.0.0 < 8.0.0" } ], "operatingsystem_support": [ diff --git a/spec/classes/viewer_spec.rb b/spec/classes/viewer_spec.rb new file mode 100644 index 0000000..45be11f --- /dev/null +++ b/spec/classes/viewer_spec.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +require 'spec_helper' + +describe 'catalog_diff::viewer' do + on_supported_os.each do |os, os_facts| + next unless os_facts[:kernel] == 'Linux' + context "on #{os}" do + let(:facts) { os_facts } + + it { is_expected.to compile } + end + end +end From 48772875db3971f4d59b60aeca5d5401d9c16eaf Mon Sep 17 00:00:00 2001 From: dleich Date: Mon, 7 Mar 2022 14:05:16 -0500 Subject: [PATCH 04/20] create more targeted tests for viewer class --- spec/classes/viewer_spec.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spec/classes/viewer_spec.rb b/spec/classes/viewer_spec.rb index 45be11f..b4cde4f 100644 --- a/spec/classes/viewer_spec.rb +++ b/spec/classes/viewer_spec.rb @@ -9,6 +9,12 @@ let(:facts) { os_facts } it { is_expected.to compile } + it { is_expected.to contain_class('apache') } + it { is_expected.to contain_apache__vhost('172.16.254.254:1495') } + it { is_expected.to contain_htpasswd('puppet') } + it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_file('/var/www/.htpasswd') } + it { is_expected.to contain_vcsrepo('/var/www/diff') } end end end From 9c5e4c33eb11631f80d3c6fc9304bb5bcf41c36b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 24 May 2022 10:08:47 +0200 Subject: [PATCH 05/20] auth.conf: Document how to update it with Puppet --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 501f948..c314163 100644 --- a/README.md +++ b/README.md @@ -125,6 +125,19 @@ If you are on Puppet 6, you can activate the certless API instead with: }, ``` +You can update the `auth.conf` with the following Puppet code (uses the +[puppetlabs/puppet_authorization](https://forge.puppet.com/modules/puppetlabs/puppet_authorization) module): + +```puppet +puppet_authorization::rule { 'catalog-diff certless catalog': + match_request_path => '^/puppet/v4/catalog', + match_request_type => 'regex', + match_request_method => 'post', + allow => 'catalog-diff', + sort_order => 500, + path => '/etc/puppetlabs/puppetserver/conf.d/auth.conf', +} +``` ## Usage From 2c894d161dbf0027863fee95d8a7f4469cdb3007 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 24 May 2022 14:39:11 +0200 Subject: [PATCH 06/20] comparer: cleanup trailing whitespace --- lib/puppet/catalog-diff/comparer.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/puppet/catalog-diff/comparer.rb b/lib/puppet/catalog-diff/comparer.rb index d6eb981..a2ae64c 100644 --- a/lib/puppet/catalog-diff/comparer.rb +++ b/lib/puppet/catalog-diff/comparer.rb @@ -125,8 +125,8 @@ def validate_encoding(str) str.encode!('UTF-8', 'UTF-8', :invalid => :replace) end str - end - + end + def str_diff(cont1, cont2) return nil unless cont1 && cont2 From 2d0b046636832849201bd7a0244b699cba75482a Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 24 May 2022 16:55:02 +0200 Subject: [PATCH 07/20] Cleanup old code This is commented out and not required anymore. --- lib/puppet/face/catalog/pull.rb | 1 - lib/puppet/face/catalog/seed.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/lib/puppet/face/catalog/pull.rb b/lib/puppet/face/catalog/pull.rb index e957e52..30fd315 100644 --- a/lib/puppet/face/catalog/pull.rb +++ b/lib/puppet/face/catalog/pull.rb @@ -1,7 +1,6 @@ require 'puppet/face' require 'thread' require 'digest' -# require 'puppet/application/master' Puppet::Face.define(:catalog, '0.0.1') do action :pull do diff --git a/lib/puppet/face/catalog/seed.rb b/lib/puppet/face/catalog/seed.rb index 0955abd..0e4bec8 100644 --- a/lib/puppet/face/catalog/seed.rb +++ b/lib/puppet/face/catalog/seed.rb @@ -1,6 +1,5 @@ require 'puppet/face' require 'thread' -# require 'puppet/application/master' Puppet::Face.define(:catalog, '0.0.1') do action :seed do From 856bc8bcdb9d085ffcb165d82150cc636c5d541c Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Mon, 16 May 2022 13:17:15 +0200 Subject: [PATCH 08/20] compilecatalog: Switch to new HTTP client implementation The new HTTP client was introduced in https://github.com/puppetlabs/puppet/pull/7826. First released in Puppet 6.11.0. The old HTTP client is deprecated. The new implementation makes it quite easy to configure additional/custom TLS certificates. I plan to implement that in another PR. --- README.md | 9 +++++-- lib/puppet/catalog-diff/compilecatalog.rb | 30 +++++++++++++---------- lib/puppet/catalog-diff/searchfacts.rb | 20 +++++++-------- metadata.json | 2 +- 4 files changed, 35 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index c314163..f195b1a 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,12 @@ This will let you gauge the impact of a change before actually touching any of your nodes. This tool is delivered as a collection of Puppet Faces. -It thus requires a Puppet installation to properly run. +It thus requires a Puppet 6.11 (or newer) installation to properly run. + +Only the system that runs the catalog-diff needs to be Puppet 6.11 or newer. +You can run it on a Puppetserver that also provides you the old or new +catalogs. However, you can also get catalogs from remote +Puppetservers/PuppetDBs. PuppetDB 2.3 and newer are supported. The diff tool recognizes catalogs in yaml, marshall, json, or pson formats. Currently automatic generation of the catalogs is done in the pson format. @@ -59,7 +64,7 @@ should contain only machines that have not been decommissioned in PuppetDB (impo as compiling their catalogs would also reactive them and their exports otherwise). When you are comparing between different versions of Puppet using two Master servers -you are going to need to copy facts from the old Master to the new one in order to be +you are going to need to copy facts from the old Master to the new one in order to be able to compile catalogs on the new Master. This is useful when upgrading Puppet version. To upload facts to PuppetDB on a Master see the [Upload facts](#upload-facts-to-puppetdb) script. diff --git a/lib/puppet/catalog-diff/compilecatalog.rb b/lib/puppet/catalog-diff/compilecatalog.rb index ea17364..1694a04 100644 --- a/lib/puppet/catalog-diff/compilecatalog.rb +++ b/lib/puppet/catalog-diff/compilecatalog.rb @@ -49,19 +49,21 @@ def get_catalog_from_puppetdb(node_name, server) Puppet.debug("Getting PuppetDB catalog for #{node_name}") require 'puppet/util/puppetdb' server_url = Puppet::Util::Puppetdb.config.server_urls[0] - port = server_url.port - use_ssl = port != 8080 - connection = Puppet::Network::HttpPool.http_instance(server_url.host, port, use_ssl) query = ['and', ['=', 'certname', node_name.to_s]] _server, environment = server.split('/') environment ||= lookup_environment(node_name) query.concat([['=', 'environment', environment]]) json_query = URI.encode_www_form_component(query.to_json) - ret = connection.request_get("/pdb/query/v4/catalogs?query=#{json_query}", 'Accept' => 'application/json').body + request_url = URI("#{server_url}/pdb/query/v4/catalogs?query=#{json_query}") + headers = { 'Accept-Content' => 'application/json'} + ret = Puppet.runtime[:http].get(request_url, headers: headers) + unless ret.success? + raise "HTTP request to PuppetDB failed with: HTTP #{ret.code} - #{ret.reason}" + end begin - catalog = PSON.parse(ret) + catalog = PSON.parse(ret.body) rescue PSON::ParserError => e - raise "Error parsing json output of puppetdb catalog query for #{node_name}: #{e.message}\ncontent: #{ret}" + raise "Error parsing json output of puppetdb catalog query for #{node_name}: #{e.message}\ncontent: #{ret.body}" end convert_pdb(catalog) @@ -95,23 +97,25 @@ def compile_catalog(node_name, server, certless) endpoint = "/puppet/v3/catalog/#{node_name}?environment=#{environment}" end - Puppet.debug("Connecting to server: #{server}#{endpoint}") + uri = URI("https://#{server}:#{port}#{endpoint}") + Puppet.debug("Connecting to server: #{uri}") begin - connection = Puppet::Network::HttpPool.http_instance(server, port) - ret = if certless - connection.request_post(endpoint, body.to_json, headers).body + Puppet.runtime[:http].post(uri, body.to_json, headers: headers) else - connection.request_get(endpoint, headers).body + Puppet.runtime[:http].get(uri, headers: headers) end + unless ret.success? + raise "HTTP request to PuppetDB failed with: HTTP #{ret.code} - #{ret.reason}" + end rescue Exception => e raise "Failed to retrieve catalog for #{node_name} from #{server} in environment #{environment}: #{e.message}" end begin - catalog = PSON.parse(ret) + catalog = PSON.parse(ret.body) rescue PSON::ParserError => e - raise "Error parsing json output of puppet catalog query for #{node_name}: #{e.message}. Content: #{ret}" + raise "Error parsing json output of puppet catalog query for #{node_name}: #{e.message}. Content: #{ret.body}" end if catalog.key?('issue_kind') raise catalog['message'] diff --git a/lib/puppet/catalog-diff/searchfacts.rb b/lib/puppet/catalog-diff/searchfacts.rb index 159520b..ac4e4bc 100644 --- a/lib/puppet/catalog-diff/searchfacts.rb +++ b/lib/puppet/catalog-diff/searchfacts.rb @@ -42,9 +42,10 @@ def build_query(env, version) query end - def get_puppetdb_version(connection) - result = connection.request_get('/pdb/meta/v1/version', 'Accept' => 'application/json') - if result.code.to_i == 200 + def get_puppetdb_version(server) + headers = { 'Accept' => 'application/json'} + result = Puppet.runtime[:http].get(URI("#{server}/pdb/meta/v1/version"), headers: headers) + if result.code == 200 body = JSON.parse(result.body) version = body['version'] Puppet.debug("Got PuppetDB version: #{version} from HTTP API.") @@ -58,20 +59,19 @@ def get_puppetdb_version(connection) def find_nodes_puppetdb(env) require 'puppet/util/puppetdb' server_url = Puppet::Util::Puppetdb.config.server_urls[0] - port = server_url.port - use_ssl = port != 8080 - connection = Puppet::Network::HttpPool.http_instance(server_url.host, port, use_ssl) - puppetdb_version = get_puppetdb_version(connection) + puppetdb_version = get_puppetdb_version(server_url) query = build_query(env, puppetdb_version) json_query = URI.escape(query.to_json) + headers = { 'Accept' => 'application/json'} + Puppet.debug("Querying #{server_url} for environment #{env}") begin - result = connection.request_get("/pdb/query/v4/nodes?query=#{json_query}", 'Accept' => 'application/json') - if result.code.to_i >= 400 + result = Puppet.runtime[:http].get(URI("#{server_url}/pdb/query/v4/nodes?query=#{json_query}"), headers: headers) + if result.code >= 400 puppetdb_version = '2.3' Puppet::debug("Query returned HTTP code #{result.code}. Falling back to older version of API used in PuppetDB version #{puppetdb_version}.") query = build_query(env, puppetdb_version) json_query = URI.escape(query.to_json) - result = connection.request_get("/v4/nodes/?query=#{json_query}", 'Accept' => 'application/json') + result = Puppet.runtime[:http].get(URI("#{server_url}/pdb/query/v4/nodes?query=#{json_query}"), headers: headers) end filtered = PSON.parse(result.body) rescue PSON::ParserError => e diff --git a/metadata.json b/metadata.json index f747b1d..54c3a28 100644 --- a/metadata.json +++ b/metadata.json @@ -77,7 +77,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 4.10.0 < 7.0.0" + "version_requirement": ">= 6.11.0 < 7.0.0" } ], "pdk-version": "2.4.0", From a27098435f99685615680053bcaa9d2e5b3fe4a8 Mon Sep 17 00:00:00 2001 From: Alexander Fisher Date: Thu, 13 Jan 2022 17:11:23 +0000 Subject: [PATCH 09/20] Don't format Floats as Strings Previously if the only change in a class was a parameter's data type from a `Float` to a `String`, then the class resource would be marked as different, but [str_diff](https://github.com/camptocamp/puppet-catalog-diff/blob/b7f3031e380502eb6154242b1710b9ab7c105b42/lib/puppet/catalog-diff/comparer.rb#L130) would return `nil` causing a `Error: undefined method split' for nil:NilClass` error [here](https://github.com/camptocamp/puppet-catalog-diff/blob/b7f3031e380502eb6154242b1710b9ab7c105b42/lib/puppet/catalog-diff/comparer.rb#L60) Fixes #32 --- lib/puppet/catalog-diff/formater.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puppet/catalog-diff/formater.rb b/lib/puppet/catalog-diff/formater.rb index 3705ce3..97d99d5 100644 --- a/lib/puppet/catalog-diff/formater.rb +++ b/lib/puppet/catalog-diff/formater.rb @@ -9,7 +9,7 @@ def initialize; end def format_simple(v, indent = '', do_indent = false, comma = '') str = '' str << indent if do_indent - v = "\"#{v}\"" unless [Integer, TrueClass, FalseClass].include?(v.class) + v = "\"#{v}\"" unless [Integer, Float, TrueClass, FalseClass].include?(v.class) str << v.to_s << comma << "\n" end From a54e9523ff0683c9fcaca64d1bcbcce61463dc33 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 12:49:50 +0200 Subject: [PATCH 10/20] rebase --- .editorconfig | 15 + .github/CONTRIBUTING.md | 251 +++++++++++++++ .github/ISSUE_TEMPLATE.md | 26 ++ .github/PULL_REQUEST_TEMPLATE.md | 20 ++ .github/SECURITY.md | 3 + .github/workflows/ci.yml | 16 + .github/workflows/release.yml | 22 ++ .gitignore | 49 ++- .msync.yml | 5 + .overcommit.yml | 65 ++++ .pdkignore | 47 --- .pmtignore | 37 +++ .puppet-lint.rc | 4 +- .rspec | 5 +- .rspec_parallel | 4 + .rubocop.yml | 525 +------------------------------ .travis.yml | 54 ---- .yardopts | 1 - Dockerfile | 24 ++ Gemfile | 72 ++--- Rakefile | 134 ++++---- appveyor.yml | 49 --- spec/default_facts.yml | 8 - spec/spec_helper.rb | 75 +---- 24 files changed, 616 insertions(+), 895 deletions(-) create mode 100644 .editorconfig create mode 100644 .github/CONTRIBUTING.md create mode 100644 .github/ISSUE_TEMPLATE.md create mode 100644 .github/PULL_REQUEST_TEMPLATE.md create mode 100644 .github/SECURITY.md create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml create mode 100644 .msync.yml create mode 100644 .overcommit.yml delete mode 100644 .pdkignore create mode 100644 .pmtignore create mode 100644 .rspec_parallel delete mode 100644 .travis.yml delete mode 100644 .yardopts create mode 100644 Dockerfile delete mode 100644 appveyor.yml delete mode 100644 spec/default_facts.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ecb10a8 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,15 @@ +# editorconfig.org + +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +tab_width = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..8b466cf --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,251 @@ +# Contribution guidelines + +## Table of contents + +* [Contributing](#contributing) +* [Writing proper commits - short version](#writing-proper-commits-short-version) +* [Writing proper commits - long version](#writing-proper-commits-long-version) +* [Dependencies](#dependencies) + * [Note for OS X users](#note-for-os-x-users) +* [The test matrix](#the-test-matrix) +* [Syntax and style](#syntax-and-style) +* [Running the unit tests](#running-the-unit-tests) +* [Unit tests in docker](#unit-tests-in-docker) +* [Integration tests](#integration-tests) + +This module has grown over time based on a range of contributions from +people using it. If you follow these contributing guidelines your patch +will likely make it into a release a little more quickly. + +## Contributing + +Please note that this project is released with a Contributor Code of Conduct. +By participating in this project you agree to abide by its terms. +[Contributor Code of Conduct](https://voxpupuli.org/coc/). + +* Fork the repo. +* Create a separate branch for your change. +* We only take pull requests with passing tests, and documentation. [GitHub Actions](https://docs.github.com/en/actions) run the tests for us. You can also execute them locally. This is explained [in a later section](#the-test-matrix). +* Checkout [our docs](https://voxpupuli.org/docs/reviewing_pr/) we use to review a module and the [official styleguide](https://puppet.com/docs/puppet/6.0/style_guide.html). They provide some guidance for new code that might help you before you submit a pull request. +* Add a test for your change. Only refactoring and documentation changes require no new tests. If you are adding functionality or fixing a bug, please add a test. +* Squash your commits down into logical components. Make sure to rebase against our current master. +* Push the branch to your fork and submit a pull request. + +Please be prepared to repeat some of these steps as our contributors review your code. + +Also consider sending in your profile code that calls this component module as an acceptance test or provide it via an issue. This helps reviewers a lot to test your use case and prevents future regressions! + +## Writing proper commits - short version + +* Make commits of logical units. +* Check for unnecessary whitespace with "git diff --check" before committing. +* Commit using Unix line endings (check the settings around "crlf" in git-config(1)). +* Do not check in commented out code or unneeded files. +* The first line of the commit message should be a short description (50 characters is the soft limit, excluding ticket number(s)), and should skip the full stop. +* Associate the issue in the message. The first line should include the issue number in the form "(#XXXX) Rest of message". +* The body should provide a meaningful commit message, which: + *uses the imperative, present tense: `change`, not `changed` or `changes`. + * includes motivation for the change, and contrasts its implementation with the previous behavior. + * Make sure that you have tests for the bug you are fixing, or feature you are adding. + * Make sure the test suites passes after your commit: + * When introducing a new feature, make sure it is properly documented in the README.md + +## Writing proper commits - long version + + 1. Make separate commits for logically separate changes. + + Please break your commits down into logically consistent units + which include new or changed tests relevant to the rest of the + change. The goal of doing this is to make the diff easier to + read for whoever is reviewing your code. In general, the easier + your diff is to read, the more likely someone will be happy to + review it and get it into the code base. + + If you are going to refactor a piece of code, please do so as a + separate commit from your feature or bug fix changes. + + We also really appreciate changes that include tests to make + sure the bug is not re-introduced, and that the feature is not + accidentally broken. + + Describe the technical detail of the change(s). If your + description starts to get too long, that is a good sign that you + probably need to split up your commit into more finely grained + pieces. + + Commits which plainly describe the things which help + reviewers check the patch and future developers understand the + code are much more likely to be merged in with a minimum of + bike-shedding or requested changes. Ideally, the commit message + would include information, and be in a form suitable for + inclusion in the release notes for the version of Puppet that + includes them. + + Please also check that you are not introducing any trailing + whitespace or other "whitespace errors". You can do this by + running "git diff --check" on your changes before you commit. + + 2. Sending your patches + + To submit your changes via a GitHub pull request, we _highly_ + recommend that you have them on a topic branch, instead of + directly on `master`. + It makes things much easier to keep track of, especially if + you decide to work on another thing before your first change + is merged in. + + GitHub has some pretty good + [general documentation](http://help.github.com/) on using + their site. They also have documentation on + [creating pull requests](http://help.github.com/send-pull-requests/). + + In general, after pushing your topic branch up to your + repository on GitHub, you can switch to the branch in the + GitHub UI and click "Pull Request" towards the top of the page + in order to open a pull request. + + + 3. Update the related GitHub issue. + + If there is a GitHub issue associated with the change you + submitted, then you should update the ticket to include the + location of your branch, along with any other commentary you + may wish to make. + +## Dependencies + +The testing and development tools have a bunch of dependencies, +all managed by [bundler](http://bundler.io/) according to the +[Puppet support matrix](http://docs.puppetlabs.com/guides/platforms.html#ruby-versions). + +By default the tests use a baseline version of Puppet. + +If you have Ruby 2.x or want a specific version of Puppet, +you must set an environment variable such as: + +```sh +export PUPPET_GEM_VERSION="~> 6.1.0" +``` + +You can install all needed gems for spec tests into the modules directory by +running: + +```sh +bundle install --path .vendor/ --without development system_tests release --jobs "$(nproc)" +``` + +If you also want to run acceptance tests: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)" +``` + +Our all in one solution if you don't know if you need to install or update gems: + +```sh +bundle install --path .vendor/ --with system_tests --without development release --jobs "$(nproc)"; bundle update; bundle clean +``` + +As an alternative to the `--jobs "$(nproc)` parameter, you can set an +environment variable: + +```sh +BUNDLE_JOBS="$(nproc)" +``` + +### Note for OS X users + +`nproc` isn't a valid command under OS x. As an alternative, you can do: + +```sh +--jobs "$(sysctl -n hw.ncpu)" +``` + +## The test matrix + +### Syntax and style + +The test suite will run [Puppet Lint](http://puppet-lint.com/) and +[Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to +check various syntax and style things. You can run these locally with: + +```sh +bundle exec rake lint +bundle exec rake validate +``` + +It will also run some [Rubocop](http://batsov.com/rubocop/) tests +against it. You can run those locally ahead of time with: + +```sh +bundle exec rake rubocop +``` + +### Running the unit tests + +The unit test suite covers most of the code, as mentioned above please +add tests if you're adding new functionality. If you've not used +[rspec-puppet](http://rspec-puppet.com/) before then feel free to ask +about how best to test your new feature. + +To run the linter, the syntax checker and the unit tests: + +```sh +bundle exec rake test +``` + +To run your all the unit tests + +```sh +bundle exec rake spec +``` + +To run a specific spec test set the `SPEC` variable: + +```sh +bundle exec rake spec SPEC=spec/foo_spec.rb +``` + +#### Unit tests in docker + +Some people don't want to run the dependencies locally or don't want to install +ruby. We ship a Dockerfile that enables you to run all unit tests and linting. +You only need to run: + +```sh +docker build . +``` + +Please ensure that a docker daemon is running and that your user has the +permission to talk to it. You can specify a remote docker host by setting the +`DOCKER_HOST` environment variable. it will copy the content of the module into +the docker image. So it will not work if a Gemfile.lock exists. + +### Integration tests + +The unit tests just check the code runs, not that it does exactly what +we want on a real machine. For that we're using +[beaker](https://github.com/puppetlabs/beaker). + +This fires up a new virtual machine (using vagrant) and runs a series of +simple tests against it after applying the module. You can run this +with: + +```sh +BEAKER_setfile=debian11-64 bundle exec rake beaker +``` + +You can replace the string `debian10` with any common operating system. +The following strings are known to work: + +* ubuntu1804 +* ubuntu2004 +* debian10 +* debian11 +* centos7 +* centos8 + +For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests). + +The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb) +repository. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..593e7aa --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,26 @@ + + +## Affected Puppet, Ruby, OS and module versions/distributions + +- Puppet: +- Ruby: +- Distribution: +- Module version: + +## How to reproduce (e.g Puppet code you use) + +## What are you seeing + +## What behaviour did you expect instead + +## Output log + +## Any additional information you'd like to impart diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..342807b --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,20 @@ + +#### Pull Request (PR) description + + +#### This Pull Request (PR) fixes the following issues + diff --git a/.github/SECURITY.md b/.github/SECURITY.md new file mode 100644 index 0000000..cacadf2 --- /dev/null +++ b/.github/SECURITY.md @@ -0,0 +1,3 @@ +# Vox Pupuli Security Policy + +Our vulnerabilities reporting process is at https://voxpupuli.org/security/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..49981e3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,16 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: CI + +on: pull_request + +concurrency: + group: ${{ github.ref_name }} + cancel-in-progress: true + +jobs: + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/basic.yml@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..15f1721 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +name: Release + +on: + push: + tags: + - '*' + +jobs: + release: + name: Release + uses: voxpupuli/gha-puppet/.github/workflows/release.yml@v1 + with: + allowed_owner: 'voxpupuli' + secrets: + # Configure secrets here: + # https://docs.github.com/en/actions/security-guides/encrypted-secrets + username: ${{ secrets.PUPPET_FORGE_USERNAME }} + api_key: ${{ secrets.PUPPET_FORGE_API_KEY }} diff --git a/.gitignore b/.gitignore index 988dcbb..9b95224 100644 --- a/.gitignore +++ b/.gitignore @@ -1,28 +1,23 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock *.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/ -/tmp/ -/vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml -/spec/fixtures/litmus_inventory.yaml +.*.sw? +.yardoc/ +Guardfile diff --git a/.msync.yml b/.msync.yml new file mode 100644 index 0000000..0235385 --- /dev/null +++ b/.msync.yml @@ -0,0 +1,5 @@ +--- +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +modulesync_config_version: '5.3.0' diff --git a/.overcommit.yml b/.overcommit.yml new file mode 100644 index 0000000..d367ada --- /dev/null +++ b/.overcommit.yml @@ -0,0 +1,65 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ +# +# Hooks are only enabled if you take action. +# +# To enable the hooks run: +# +# ``` +# bundle exec overcommit --install +# # ensure .overcommit.yml does not harm to you and then +# bundle exec overcommit --sign +# ``` +# +# (it will manage the .git/hooks directory): +# +# Examples howto skip a test for a commit or push: +# +# ``` +# SKIP=RuboCop git commit +# SKIP=PuppetLint git commit +# SKIP=RakeTask git push +# ``` +# +# Don't invoke overcommit at all: +# +# ``` +# OVERCOMMIT_DISABLE=1 git commit +# ``` +# +# Read more about overcommit: https://github.com/brigade/overcommit +# +# To manage this config yourself in your module add +# +# ``` +# .overcommit.yml: +# unmanaged: true +# ``` +# +# to your modules .sync.yml config +--- +PreCommit: + RuboCop: + enabled: true + description: 'Runs rubocop on modified files only' + command: ['bundle', 'exec', 'rubocop'] + PuppetLint: + enabled: true + description: 'Runs puppet-lint on modified files only' + command: ['bundle', 'exec', 'puppet-lint'] + YamlSyntax: + enabled: true + JsonSyntax: + enabled: true + TrailingWhitespace: + enabled: true + +PrePush: + RakeTarget: + enabled: true + description: 'Run rake targets' + targets: + - 'validate' + - 'test' + - 'rubocop' + command: ['bundle', 'exec', 'rake'] diff --git a/.pdkignore b/.pdkignore deleted file mode 100644 index c538bea..0000000 --- a/.pdkignore +++ /dev/null @@ -1,47 +0,0 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns -*.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/ -/tmp/ -/vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml -/spec/fixtures/litmus_inventory.yaml -/appveyor.yml -/.editorconfig -/.fixtures.yml -/Gemfile -/.gitattributes -/.gitignore -/.gitlab-ci.yml -/.pdkignore -/.puppet-lint.rc -/Rakefile -/rakelib/ -/.rspec -/.rubocop.yml -/.travis.yml -/.yardopts -/spec/ -/.vscode/ -/.sync.yml -/.devcontainer/ diff --git a/.pmtignore b/.pmtignore new file mode 100644 index 0000000..65f5051 --- /dev/null +++ b/.pmtignore @@ -0,0 +1,37 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +docs/ +pkg/ +Gemfile +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/ +Rakefile +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.github/ +.librarian/ +Puppetfile.lock +*.iml +.editorconfig +.fixtures.yml +.gitignore +.msync.yml +.overcommit.yml +.pmtignore +.rspec +.rspec_parallel +.rubocop.yml +.sync.yml +.*.sw? +.yardoc/ +.yardopts +Dockerfile diff --git a/.puppet-lint.rc b/.puppet-lint.rc index cc96ece..dd8272c 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1 +1,3 @@ ---relative +--fail-on-warnings +--no-parameter_documentation-check +--no-parameter_types-check diff --git a/.rspec b/.rspec index 16f9cdb..f634583 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,5 @@ ---color +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + --format documentation +--color diff --git a/.rspec_parallel b/.rspec_parallel new file mode 100644 index 0000000..a9a84f8 --- /dev/null +++ b/.rspec_parallel @@ -0,0 +1,4 @@ +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +--format progress diff --git a/.rubocop.yml b/.rubocop.yml index 29fcedb..fded90c 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,520 +1,7 @@ --- -require: -- rubocop-performance -- rubocop-rspec -AllCops: - DisplayCopNames: true - TargetRubyVersion: '2.4' - Include: - - "**/*.rb" - Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" -Layout/LineLength: - Description: People have wide screens, use them. - Max: 200 -RSpec/BeforeAfterAll: - Description: Beware of using after(:all) as it may cause state to leak between tests. - A necessary evil in acceptance testing. - Exclude: - - spec/acceptance/**/*.rb -RSpec/HookArgument: - Description: Prefer explicit :each argument, matching existing module's style - EnforcedStyle: each -RSpec/DescribeSymbol: - Exclude: - - spec/unit/facter/**/*.rb -Style/BlockDelimiters: - Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to - be consistent then. - EnforcedStyle: braces_for_chaining -Style/ClassAndModuleChildren: - Description: Compact style reduces the required amount of indentation. - EnforcedStyle: compact -Style/EmptyElse: - Description: Enforce against empty else clauses, but allow `nil` for clarity. - EnforcedStyle: empty -Style/FormatString: - Description: Following the main puppet project's style, prefer the % format format. - EnforcedStyle: percent -Style/FormatStringToken: - Description: Following the main puppet project's style, prefer the simpler template - tokens over annotated ones. - EnforcedStyle: template -Style/Lambda: - Description: Prefer the keyword for easier discoverability. - EnforcedStyle: literal -Style/RegexpLiteral: - Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 - EnforcedStyle: percent_r -Style/TernaryParentheses: - Description: Checks for use of parentheses around ternary conditions. Enforce parentheses - on complex expressions for better readability, but seriously consider breaking - it up. - EnforcedStyle: require_parentheses_when_complex -Style/TrailingCommaInArguments: - Description: Prefer always trailing comma on multiline argument lists. This makes - diffs, and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/TrailingCommaInArrayLiteral: - Description: Prefer always trailing comma on multiline literals. This makes diffs, - and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/SymbolArray: - Description: Using percent style obscures symbolic intent of array's contents. - EnforcedStyle: brackets -inherit_from: ".rubocop_todo.yml" -RSpec/MessageSpies: - EnforcedStyle: receive -Style/Documentation: - Exclude: - - lib/puppet/parser/functions/**/* - - spec/**/* -Style/WordArray: - EnforcedStyle: brackets -Performance/AncestorsInclude: - Enabled: true -Performance/BigDecimalWithNumericArgument: - Enabled: true -Performance/BlockGivenWithExplicitBlock: - Enabled: true -Performance/CaseWhenSplat: - Enabled: true -Performance/ConstantRegexp: - Enabled: true -Performance/MethodObjectAsBlock: - Enabled: true -Performance/RedundantSortBlock: - Enabled: true -Performance/RedundantStringChars: - Enabled: true -Performance/ReverseFirst: - Enabled: true -Performance/SortReverse: - Enabled: true -Performance/Squeeze: - Enabled: true -Performance/StringInclude: - Enabled: true -Performance/Sum: - Enabled: true -Style/CollectionMethods: - Enabled: true -Style/MethodCalledOnDoEndBlock: - Enabled: true -Style/StringMethods: - Enabled: true -Bundler/InsecureProtocolSource: - Enabled: false -Gemspec/DuplicatedAssignment: - Enabled: false -Gemspec/OrderedDependencies: - Enabled: false -Gemspec/RequiredRubyVersion: - Enabled: false -Gemspec/RubyVersionGlobalsUsage: - Enabled: false -Layout/ArgumentAlignment: - Enabled: false -Layout/BeginEndAlignment: - Enabled: false -Layout/ClosingHeredocIndentation: - Enabled: false -Layout/EmptyComment: - Enabled: false -Layout/EmptyLineAfterGuardClause: - Enabled: false -Layout/EmptyLinesAroundArguments: - Enabled: false -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: false -Layout/EndOfLine: - Enabled: false -Layout/FirstArgumentIndentation: - Enabled: false -Layout/HashAlignment: - Enabled: false -Layout/HeredocIndentation: - Enabled: false -Layout/LeadingEmptyLines: - Enabled: false -Layout/SpaceAroundMethodCallOperator: - Enabled: false -Layout/SpaceInsideArrayLiteralBrackets: - Enabled: false -Layout/SpaceInsideReferenceBrackets: - Enabled: false -Lint/BigDecimalNew: - Enabled: false -Lint/BooleanSymbol: - Enabled: false -Lint/ConstantDefinitionInBlock: - Enabled: false -Lint/DeprecatedOpenSSLConstant: - Enabled: false -Lint/DisjunctiveAssignmentInConstructor: - Enabled: false -Lint/DuplicateElsifCondition: - Enabled: false -Lint/DuplicateRequire: - Enabled: false -Lint/DuplicateRescueException: - Enabled: false -Lint/EmptyConditionalBody: - Enabled: false -Lint/EmptyFile: - Enabled: false -Lint/ErbNewArguments: - Enabled: false -Lint/FloatComparison: - Enabled: false -Lint/HashCompareByIdentity: - Enabled: false -Lint/IdentityComparison: - Enabled: false -Lint/InterpolationCheck: - Enabled: false -Lint/MissingCopEnableDirective: - Enabled: false -Lint/MixedRegexpCaptureTypes: - Enabled: false -Lint/NestedPercentLiteral: - Enabled: false -Lint/NonDeterministicRequireOrder: - Enabled: false -Lint/OrderedMagicComments: - Enabled: false -Lint/OutOfRangeRegexpRef: - Enabled: false -Lint/RaiseException: - Enabled: false -Lint/RedundantCopEnableDirective: - Enabled: false -Lint/RedundantRequireStatement: - Enabled: false -Lint/RedundantSafeNavigation: - Enabled: false -Lint/RedundantWithIndex: - Enabled: false -Lint/RedundantWithObject: - Enabled: false -Lint/RegexpAsCondition: - Enabled: false -Lint/ReturnInVoidContext: - Enabled: false -Lint/SafeNavigationConsistency: - Enabled: false -Lint/SafeNavigationWithEmpty: - Enabled: false -Lint/SelfAssignment: - Enabled: false -Lint/SendWithMixinArgument: - Enabled: false -Lint/ShadowedArgument: - Enabled: false -Lint/StructNewOverride: - Enabled: false -Lint/ToJSON: - Enabled: false -Lint/TopLevelReturnWithArgument: - Enabled: false -Lint/TrailingCommaInAttributeDeclaration: - Enabled: false -Lint/UnreachableLoop: - Enabled: false -Lint/UriEscapeUnescape: - Enabled: false -Lint/UriRegexp: - Enabled: false -Lint/UselessMethodDefinition: - Enabled: false -Lint/UselessTimes: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/BlockNesting: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Migration/DepartmentName: - Enabled: false -Naming/AccessorMethodName: - Enabled: false -Naming/BlockParameterName: - Enabled: false -Naming/HeredocDelimiterCase: - Enabled: false -Naming/HeredocDelimiterNaming: - Enabled: false -Naming/MemoizedInstanceVariableName: - Enabled: false -Naming/MethodParameterName: - Enabled: false -Naming/RescuedExceptionsVariableName: - Enabled: false -Naming/VariableNumber: - Enabled: false -Performance/BindCall: - Enabled: false -Performance/DeletePrefix: - Enabled: false -Performance/DeleteSuffix: - Enabled: false -Performance/InefficientHashSearch: - Enabled: false -Performance/UnfreezeString: - Enabled: false -Performance/UriDefaultParser: - Enabled: false -RSpec/Be: - Enabled: false -RSpec/Capybara/CurrentPathExpectation: - Enabled: false -RSpec/Capybara/FeatureMethods: - Enabled: false -RSpec/Capybara/VisibilityMatcher: - Enabled: false -RSpec/ContextMethod: - Enabled: false -RSpec/ContextWording: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/EmptyHook: - Enabled: false -RSpec/EmptyLineAfterExample: - Enabled: false -RSpec/EmptyLineAfterExampleGroup: - Enabled: false -RSpec/EmptyLineAfterHook: - Enabled: false -RSpec/ExampleLength: - Enabled: false -RSpec/ExampleWithoutDescription: - Enabled: false -RSpec/ExpectChange: - Enabled: false -RSpec/ExpectInHook: - Enabled: false -RSpec/FactoryBot/AttributeDefinedStatically: - Enabled: false -RSpec/FactoryBot/CreateList: - Enabled: false -RSpec/FactoryBot/FactoryClassName: - Enabled: false -RSpec/HooksBeforeExamples: - Enabled: false -RSpec/ImplicitBlockExpectation: - Enabled: false -RSpec/ImplicitSubject: - Enabled: false -RSpec/LeakyConstantDeclaration: - Enabled: false -RSpec/LetBeforeExamples: - Enabled: false -RSpec/MissingExampleGroupArgument: - Enabled: false -RSpec/MultipleExpectations: - Enabled: false -RSpec/MultipleMemoizedHelpers: - Enabled: false -RSpec/MultipleSubjects: - Enabled: false -RSpec/NestedGroups: - Enabled: false -RSpec/PredicateMatcher: - Enabled: false -RSpec/ReceiveCounts: - Enabled: false -RSpec/ReceiveNever: - Enabled: false -RSpec/RepeatedExampleGroupBody: - Enabled: false -RSpec/RepeatedExampleGroupDescription: - Enabled: false -RSpec/RepeatedIncludeExample: - Enabled: false -RSpec/ReturnFromStub: - Enabled: false -RSpec/SharedExamples: - Enabled: false -RSpec/StubbedMock: - Enabled: false -RSpec/UnspecifiedException: - Enabled: false -RSpec/VariableDefinition: - Enabled: false -RSpec/VoidExpect: - Enabled: false -RSpec/Yield: - Enabled: false -Security/Open: - Enabled: false -Style/AccessModifierDeclarations: - Enabled: false -Style/AccessorGrouping: - Enabled: false -Style/AsciiComments: - Enabled: false -Style/BisectedAttrAccessor: - Enabled: false -Style/CaseLikeIf: - Enabled: false -Style/ClassEqualityComparison: - Enabled: false -Style/ColonMethodDefinition: - Enabled: false -Style/CombinableLoops: - Enabled: false -Style/CommentedKeyword: - Enabled: false -Style/Dir: - Enabled: false -Style/DoubleCopDisableDirective: - Enabled: false -Style/EmptyBlockParameter: - Enabled: false -Style/EmptyLambdaParameter: - Enabled: false -Style/Encoding: - Enabled: false -Style/EvalWithLocation: - Enabled: false -Style/ExpandPathArguments: - Enabled: false -Style/ExplicitBlockArgument: - Enabled: false -Style/ExponentialNotation: - Enabled: false -Style/FloatDivision: - Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false -Style/GlobalStdStream: - Enabled: false -Style/HashAsLastArrayItem: - Enabled: false -Style/HashLikeCase: - Enabled: false -Style/HashTransformKeys: - Enabled: false -Style/HashTransformValues: - Enabled: false -Style/IfUnlessModifier: - Enabled: false -Style/KeywordParametersOrder: - Enabled: false -Style/MinMax: - Enabled: false -Style/MixinUsage: - Enabled: false -Style/MultilineWhenThen: - Enabled: false -Style/NegatedUnless: - Enabled: false -Style/NumericPredicate: - Enabled: false -Style/OptionalBooleanParameter: - Enabled: false -Style/OrAssignment: - Enabled: false -Style/RandomWithOffset: - Enabled: false -Style/RedundantAssignment: - Enabled: false -Style/RedundantCondition: - Enabled: false -Style/RedundantConditional: - Enabled: false -Style/RedundantFetchBlock: - Enabled: false -Style/RedundantFileExtensionInRequire: - Enabled: false -Style/RedundantRegexpCharacterClass: - Enabled: false -Style/RedundantRegexpEscape: - Enabled: false -Style/RedundantSelfAssignment: - Enabled: false -Style/RedundantSort: - Enabled: false -Style/RescueStandardError: - Enabled: false -Style/SingleArgumentDig: - Enabled: false -Style/SlicingWithRange: - Enabled: false -Style/SoleNestedConditional: - Enabled: false -Style/StderrPuts: - Enabled: false -Style/StringConcatenation: - Enabled: false -Style/Strip: - Enabled: false -Style/SymbolProc: - Enabled: false -Style/TrailingBodyOnClass: - Enabled: false -Style/TrailingBodyOnMethodDefinition: - Enabled: false -Style/TrailingBodyOnModule: - Enabled: false -Style/TrailingCommaInHashLiteral: - Enabled: false -Style/TrailingMethodEndStatement: - Enabled: false -Style/UnpackFirst: - Enabled: false -Lint/DuplicateBranch: - Enabled: false -Lint/DuplicateRegexpCharacterClassElement: - Enabled: false -Lint/EmptyBlock: - Enabled: false -Lint/EmptyClass: - Enabled: false -Lint/NoReturnInBeginEndBlocks: - Enabled: false -Lint/ToEnumArguments: - Enabled: false -Lint/UnexpectedBlockArity: - Enabled: false -Lint/UnmodifiedReduceAccumulator: - Enabled: false -Performance/CollectionLiteralInLoop: - Enabled: false -Style/ArgumentsForwarding: - Enabled: false -Style/CollectionCompact: - Enabled: false -Style/DocumentDynamicEvalDefinition: - Enabled: false -Style/NegatedIfElseCondition: - Enabled: false -Style/NilLambda: - Enabled: false -Style/RedundantArgument: - Enabled: false -Style/SwapValues: - Enabled: false +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +inherit_from: .rubocop_todo.yml +inherit_gem: + voxpupuli-test: rubocop.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c11ec7c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -os: linux -dist: xenial -language: ruby -cache: bundler -before_install: - - bundle -v - - rm -f Gemfile.lock - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v -script: - - 'bundle exec rake $CHECK' -bundler_args: --without system_tests -rvm: - - 2.5.7 -stages: - - static - - spec - - acceptance - - - if: tag =~ ^v\d - name: deploy -jobs: - fast_finish: true - include: - - - env: CHECK="validate lint check rubocop" - stage: static - - - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec - rvm: 2.5.7 - stage: spec - - - env: DEPLOY_TO_FORGE=yes - stage: deploy -branches: - only: - - main - - /^v\d/ -notifications: - email: false -deploy: - provider: puppetforge - username: camptocamp - password: - secure: "K4iXyf0gsTwNZ9m8a+lxOZROp2DK7BOkU34M7O7cq8RKjOJ1UInO4Ewni3el+2o6zJ1mTZmaBfBAetnimaKnoiADTG5V6MfJIST0M8xzVdlXppqel9//UNyDaynId9AxIg17XjO86xDm3F4X3HaPhgXRraUEpzrgVRXppTVyzrlV5Zn2nUqxJ7LW9HQ4Q3l4vIm00qUfjeTsqW3HJZ6l6947jvpUGdFf7tv+Tcjarjm71TRtPmEtUpPChTOKKQoBdDMCOqzAB4kvpZa8/WRNyQKpNSJIzaOVVoVdCxtW/TRoIR1Jg+mOyTEnTJIjcTwPeuIyFGAJKnKd/Si1vGBmGWkgEtyqQuVjWLBMIxsEP21d5OUPGMhoFabcGDR/C0ppdX7w1DPTqwsn3SES+JbSIdFPh6jcI0QSqXs1k+NCu62Hhj7VzCjBLI55Npay8ukpoY2OBOM8Eg+H3IYENm8Y+8u8vELHUdmB7YQGQUhx3huzbc6xO+M5YQf6fVdG/fgLPea8apoKTbpZfoiIoS+rP9sl0df3c6DTdpn4kMGAzBt/5tngmhR3uwlXgwGwQT+DTnKahLGPWzn+ITecbN8MxYBmkmXy4aQ09m0OAiiagmQlsHX7K+h6hw2Lu5yIPGsFTluRzGsF8T9J9hNCjmPKVZacKRcFRgA8E92J9i4QA+k=" - on: - tags: true - all_branches: true - condition: "$DEPLOY_TO_FORGE = yes" diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 29c933b..0000000 --- a/.yardopts +++ /dev/null @@ -1 +0,0 @@ ---markup markdown diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8dd82d6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +# MANAGED BY MODULESYNC +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + +FROM ruby:2.7 + +WORKDIR /opt/puppet + +# https://github.com/puppetlabs/puppet/blob/06ad255754a38f22fb3a22c7c4f1e2ce453d01cb/lib/puppet/provider/service/runit.rb#L39 +RUN mkdir -p /etc/sv + +ARG PUPPET_GEM_VERSION="~> 6.0" +ARG PARALLEL_TEST_PROCESSORS=4 + +# Cache gems +COPY Gemfile . +RUN bundle install --without system_tests development release --path=${BUNDLE_PATH:-vendor/bundle} + +COPY . . + +RUN bundle install +RUN bundle exec rake release_checks + +# Container should not saved +RUN exit 1 diff --git a/Gemfile b/Gemfile index 37942af..eb22e39 100644 --- a/Gemfile +++ b/Gemfile @@ -1,64 +1,40 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} +source ENV['GEM_SOURCE'] || 'https://rubygems.org' - if place_or_version && (git_url = place_or_version.match(git_url_regex)) - [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact - elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) - ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] - else - [place_or_version, { require: false }] - end +group :test do + gem 'voxpupuli-test', '~> 5.4', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'puppet_metadata', '~> 1.0', :require => false end -ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments -minor_version = ruby_version_segments[0..1].join('.') - group :development do - gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "github_changelog_generator", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') - gem "coveralls", require: false + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false + gem 'github_changelog_generator', :require => false + gem 'coveralls', :require => false end group :system_tests do gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] end -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] -hiera_version = ENV['HIERA_GEM_VERSION'] - -gems = {} - -gems['puppet'] = location_for(puppet_version) - -# If facter or hiera versions have been specified via the environment -# variables - -gems['facter'] = location_for(facter_version) if facter_version -gems['hiera'] = location_for(hiera_version) if hiera_version +group :system_tests do + gem 'voxpupuli-acceptance', '~> 1.0', :require => false +end -gems.each do |gem_name, gem_params| - gem gem_name, *gem_params +group :release do + gem 'github_changelog_generator', '>= 1.16.1', :require => false if RUBY_VERSION >= '2.5' + gem 'voxpupuli-release', '>= 1.2.0', :require => false + gem 'puppet-strings', '>= 2.2', :require => false end -# Evaluate Gemfile.local and ~/.gemfile if they exist -extra_gemfiles = [ - "#{__FILE__}.local", - File.join(Dir.home, '.gemfile'), -] +gem 'rake', :require => false +gem 'facter', ENV['FACTER_GEM_VERSION'], :require => false, :groups => [:test] + +puppetversion = ENV['PUPPET_GEM_VERSION'] || '>= 6.0' +gem 'puppet', puppetversion, :require => false, :groups => [:test] -extra_gemfiles.each do |gemfile| - if File.file?(gemfile) && File.readable?(gemfile) - eval(File.read(gemfile), binding) - end -end # vim: syntax=ruby diff --git a/Rakefile b/Rakefile index 95e9a13..f92f051 100644 --- a/Rakefile +++ b/Rakefile @@ -1,90 +1,72 @@ -# frozen_string_literal: true +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ -require 'bundler' -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? -require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? -require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? - -def changelog_user - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = nil || JSON.load(File.read('metadata.json'))['author'] - raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator user:#{returnVal}" - returnVal +# Attempt to load voxpupuli-test (which pulls in puppetlabs_spec_helper), +# otherwise attempt to load it directly. +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end end -def changelog_project - return unless Rake.application.top_level_tasks.include? "changelog" +# load optional tasks for acceptance +# only available if gem group releases is installed +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError +end - returnVal = nil - returnVal ||= begin - metadata_source = JSON.load(File.read('metadata.json'))['source'] - metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'voxpupuli/release/rake_tasks' +rescue LoadError +end - metadata_source_match && metadata_source_match[1] +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' end - - raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? - - puts "GitHubChangelogGenerator project:#{returnVal}" - returnVal end -def changelog_future_release - return unless Rake.application.top_level_tasks.include? "changelog" - returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] - raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? - puts "GitHubChangelogGenerator future_release:#{returnVal}" - returnVal +desc 'Generate REFERENCE.md' +task :reference, [:debug, :backtrace] do |t, args| + patterns = '' + Rake::Task['strings:generate:reference'].invoke(patterns, args[:debug], args[:backtrace]) end -PuppetLint.configuration.send('disable_relative') - - -if Bundler.rubygems.find_name('github_changelog_generator').any? +begin + require 'github_changelog_generator/task' + require 'puppet_blacksmith' GitHubChangelogGenerator::RakeTask.new :changelog do |config| - raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? - config.user = "#{changelog_user}" - config.project = "#{changelog_project}" - config.since_tag = "v1.6.0" - config.future_release = "#{changelog_future_release}" - config.exclude_labels = ['maintenance'] - config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." - config.add_pr_wo_labels = true - config.issues = false - config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" - config.configure_sections = { - "Changed" => { - "prefix" => "### Changed", - "labels" => ["backwards-incompatible"], - }, - "Added" => { - "prefix" => "### Added", - "labels" => ["enhancement", "feature"], - }, - "Fixed" => { - "prefix" => "### Fixed", - "labels" => ["bug", "documentation", "bugfix"], - }, - } + metadata = Blacksmith::Modulefile.new + config.future_release = "v#{metadata.version}" if metadata.version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' + config.project = metadata.metadata['name'] end -else - desc 'Generate a Changelog from GitHub' - task :changelog do - raise < 1.15' - condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" -EOM + + # Workaround for https://github.com/github-changelog-generator/github-changelog-generator/issues/715 + require 'rbconfig' + if RbConfig::CONFIG['host_os'] =~ /linux/ + task :changelog do + puts 'Fixing line endings...' + changelog_file = File.join(__dir__, 'CHANGELOG.md') + changelog_txt = File.read(changelog_file) + new_contents = changelog_txt.gsub(%r{\r\n}, "\n") + File.open(changelog_file, "w") {|file| file.puts new_contents } + end end -end +rescue LoadError +end +# vim: syntax=ruby diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index a70c01e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -version: 1.1.x.{build} -skip_branch_with_pr: true -branches: - only: - - main - - release -skip_commits: - message: /^\(?doc\)?.*/ -clone_depth: 10 -init: - - SET - - 'mkdir C:\ProgramData\PuppetLabs\code && exit 0' - - 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0' - - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0' - - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0' -environment: - matrix: - - - RUBY_VERSION: 25-x64 - CHECK: validate lint check rubocop - - - PUPPET_GEM_VERSION: ~> 6.0 - RUBY_VERSION: 25 - CHECK: parallel_spec - - - PUPPET_GEM_VERSION: ~> 6.0 - RUBY_VERSION: 25-x64 - CHECK: parallel_spec -matrix: - fast_finish: true -install: - - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% - - bundle install --jobs 4 --retry 2 --without system_tests - - type Gemfile.lock -build: off -test_script: - - bundle exec puppet -V - - ruby -v - - gem -v - - bundle -v - - bundle exec rake %CHECK% -notifications: - - provider: Email - to: - - nobody@nowhere.com - on_build_success: false - on_build_failure: false - on_build_status_changed: false diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index f777abf..0000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,8 +0,0 @@ -# Use default_module_facts.yml for module specific facts. -# -# Facts specified here will override the values provided by rspec-puppet-facts. ---- -ipaddress: "172.16.254.254" -ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" -is_pe: false -macaddress: "AA:AA:AA:AA:AA:AA" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 07db734..5a6deb9 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,74 +1,21 @@ # frozen_string_literal: true +# Managed by modulesync - DO NOT EDIT +# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/ + RSpec.configure do |c| c.mock_with :rspec end -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' - -require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) - -include RspecPuppetFacts - -default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version, -} - -default_fact_files = [ - File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), - File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), -] +# puppetlabs_spec_helper will set up coverage if the env variable is set. +# We want to do this if lib exists and it hasn't been explicitly set. +ENV['COVERAGE'] ||= 'yes' if Dir.exist?(File.expand_path('../lib', __dir__)) -default_fact_files.each do |f| - next unless File.exist?(f) && File.readable?(f) && File.size?(f) +require 'voxpupuli/test/spec_helper' - begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e - RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" +if File.exist?(File.join(__dir__, 'default_module_facts.yml')) + facts = YAML.safe_load(File.read(File.join(__dir__, 'default_module_facts.yml'))) + facts&.each do |name, value| + add_custom_fact name.to_sym, value end end - -# read default_facts and merge them over what is provided by facterdb -default_facts.each do |fact, value| - add_custom_fact fact, value -end - -RSpec.configure do |c| - c.default_facts = default_facts - c.before :each do - # set to strictest setting for testing - # by default Puppet runs at warning level - Puppet.settings[:strict] = :warning - Puppet.settings[:strict_variables] = true - end - c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] - c.after(:suite) do - RSpec::Puppet::Coverage.report!(0) - end - - # Filter backtrace noise - backtrace_exclusion_patterns = [ - %r{spec_helper}, - %r{gems}, - ] - - if c.respond_to?(:backtrace_exclusion_patterns) - c.backtrace_exclusion_patterns = backtrace_exclusion_patterns - elsif c.respond_to?(:backtrace_clean_patterns) - c.backtrace_clean_patterns = backtrace_exclusion_patterns - end -end - -# Ensures that a module is defined -# @param module_name Name of the module -def ensure_module_defined(module_name) - module_name.split('::').reduce(Object) do |last_module, next_module| - last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) - last_module.const_get(next_module, false) - end -end - -# 'spec_overrides' from sync.yml will appear below this line From 93af16cc19a75bb069c8b12ff0933e7b20e5f55d Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 12:51:58 +0200 Subject: [PATCH 11/20] cleanup .sync.yml --- .sync.yml | 29 ----------------------------- 1 file changed, 29 deletions(-) delete mode 100644 .sync.yml diff --git a/.sync.yml b/.sync.yml deleted file mode 100644 index 7837cdf..0000000 --- a/.sync.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -".travis.yml": - user: camptocamp - secure: "K4iXyf0gsTwNZ9m8a+lxOZROp2DK7BOkU34M7O7cq8RKjOJ1UInO4Ewni3el+2o6zJ1mTZmaBfBAetnimaKnoiADTG5V6MfJIST0M8xzVdlXppqel9//UNyDaynId9AxIg17XjO86xDm3F4X3HaPhgXRraUEpzrgVRXppTVyzrlV5Zn2nUqxJ7LW9HQ4Q3l4vIm00qUfjeTsqW3HJZ6l6947jvpUGdFf7tv+Tcjarjm71TRtPmEtUpPChTOKKQoBdDMCOqzAB4kvpZa8/WRNyQKpNSJIzaOVVoVdCxtW/TRoIR1Jg+mOyTEnTJIjcTwPeuIyFGAJKnKd/Si1vGBmGWkgEtyqQuVjWLBMIxsEP21d5OUPGMhoFabcGDR/C0ppdX7w1DPTqwsn3SES+JbSIdFPh6jcI0QSqXs1k+NCu62Hhj7VzCjBLI55Npay8ukpoY2OBOM8Eg+H3IYENm8Y+8u8vELHUdmB7YQGQUhx3huzbc6xO+M5YQf6fVdG/fgLPea8apoKTbpZfoiIoS+rP9sl0df3c6DTdpn4kMGAzBt/5tngmhR3uwlXgwGwQT+DTnKahLGPWzn+ITecbN8MxYBmkmXy4aQ09m0OAiiagmQlsHX7K+h6hw2Lu5yIPGsFTluRzGsF8T9J9hNCjmPKVZacKRcFRgA8E92J9i4QA+k=" - -".gitlab-ci.yml": - delete: true - -".rubocop.yml": - default_configs: - require: - - rubocop-rspec - inherit_from: .rubocop_todo.yml - - -Gemfile: - use_litmus: true - optional: - ":development": - - gem: github_changelog_generator - condition: Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') - - gem: coveralls - -spec/spec_helper.rb: - mock_with: ":rspec" - coverage_report: true - -Rakefile: - changelog_since_tag: v1.6.0 From 777b44b5562b1e8e83693ade6a98f8990194088f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 12:52:14 +0200 Subject: [PATCH 12/20] cleanup Gemfile --- Gemfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Gemfile b/Gemfile index eb22e39..5bef779 100644 --- a/Gemfile +++ b/Gemfile @@ -13,8 +13,6 @@ end group :development do gem 'guard-rake', :require => false gem 'overcommit', '>= 0.39.1', :require => false - gem 'github_changelog_generator', :require => false - gem 'coveralls', :require => false end group :system_tests do gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] From 4da32c7cda8e3a52593fa83d9ad21338040dca44 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 12:52:59 +0200 Subject: [PATCH 13/20] rebase --- manifests/viewer.pp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/viewer.pp b/manifests/viewer.pp index 5564513..3d31398 100644 --- a/manifests/viewer.pp +++ b/manifests/viewer.pp @@ -5,17 +5,17 @@ String $password = 'puppet', String $revision = 'master', Integer $port = 1495, - String $listen_ip = $::ipaddress, + String $listen_ip = $facts['networking']['ip'], ) { require git - class {'apache': + class { 'apache': default_vhost => false, default_ssl_vhost => false, } - apache::vhost {"${listen_ip}:${port}": - servername => $::fqdn, + apache::vhost { "${listen_ip}:${port}": + servername => $facts['networking']['fqdn'], ip => $listen_ip, docroot => '/var/www/diff', ip_based => true, @@ -37,7 +37,7 @@ htpasswd { 'puppet': username => 'puppet', - cryptpasswd => htpasswd::ht_crypt($password, $::uuid), + cryptpasswd => htpasswd::ht_crypt($password, $facts['dmi']['product']['uuid']), target => '/var/www/.htpasswd', } From b7d7e26e96510bd6b856c79513948c9b0ce20f5b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 12:54:53 +0200 Subject: [PATCH 14/20] regenerate rubocop todo --- .rubocop_todo.yml | 389 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 376 insertions(+), 13 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d73ee2b..da17dfc 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,21 +1,384 @@ ---- +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2022-06-08 11:21:02 UTC using RuboCop version 1.22.3. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# Cop supports --auto-correct. +Layout/ElseAlignment: + Exclude: + - 'lib/puppet/face/catalog/pull.rb' + +# Offense count: 14 +# Cop supports --auto-correct. +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/compilecatalog.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleAlignWith, Severity. +# SupportedStylesAlignWith: keyword, variable, start_of_line +Layout/EndAlignment: + Exclude: + - 'lib/puppet/face/catalog/pull.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, indented_internal_methods +Layout/IndentationConsistency: + Exclude: + - 'lib/puppet/catalog-diff/compilecatalog.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Exclude: + - 'lib/puppet/face/catalog/pull.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceBeforeBlockBraces: + Exclude: + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters. +# SupportedStyles: space, no_space +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideBlockBraces: + Exclude: + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'lib/puppet/catalog-diff/compilecatalog.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 21 +# Cop supports --auto-correct. +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'lib/puppet/catalog-diff/differ.rb' + - 'lib/puppet/catalog-diff/formater.rb' + - 'lib/puppet/face/catalog/diff.rb' + +# Offense count: 3 +# Configuration parameters: AllowSafeAssignment. Lint/AssignmentInCondition: - Enabled: false + Exclude: + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/pull.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Lint/RedundantRequireStatement: + Exclude: + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/pull.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 5 Lint/RescueException: - Enabled: false + Exclude: + - 'lib/puppet/catalog-diff/compilecatalog.rb' + - 'lib/puppet/face/catalog/pull.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 11 Lint/ShadowingOuterLocalVariable: - Enabled: false -Metrics/LineLength: - Enabled: false -Performance/FixedSize: - Enabled: false + Exclude: + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/pull.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 2 +Lint/UriEscapeUnescape: + Exclude: + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 1 +# Configuration parameters: CheckForMethodsWithNoSideEffects. +Lint/Void: + Exclude: + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 5 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: at, by, db, id, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Exclude: + - 'lib/puppet/catalog-diff/formater.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: . +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + EnforcedStyle: each + +# Offense count: 1 Security/MarshalLoad: - Enabled: false + Exclude: + - 'lib/puppet/catalog-diff/differ.rb' + +# Offense count: 15 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, IgnoredMethods, AllowBracesOnProceduralOneLiners, BracesRequiredMethods. +# SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces +# ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object +# FunctionalMethods: let, let!, subject, watch +# IgnoredMethods: lambda, proc, it +Style/BlockDelimiters: + Exclude: + - 'lib/puppet/catalog-diff/formater.rb' + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/pull.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +Style/CaseLikeIf: + Exclude: + - 'lib/puppet/catalog-diff/formater.rb' + - 'lib/puppet/face/catalog/diff.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: ==, equal?, eql? +Style/ClassEqualityComparison: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + +# Offense count: 1 Style/ClassVars: - Enabled: false + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/CollectionCompact: + Exclude: + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/ColonMethodCall: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 4 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: left_coerce, right_coerce, single_coerce, fdiv +Style/FloatDivision: + Exclude: + - 'lib/puppet/catalog-diff/differ.rb' + - 'lib/puppet/face/catalog/pull.rb' + +# Offense count: 5 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: format, sprintf, percent +Style/FormatString: + Exclude: + - 'lib/puppet/catalog-diff/differ.rb' + - 'lib/puppet/catalog-diff/formater.rb' + +# Offense count: 12 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/compilecatalog.rb' + - 'lib/puppet/catalog-diff/differ.rb' + - 'lib/puppet/catalog-diff/findcatalogs.rb' + - 'lib/puppet/catalog-diff/formater.rb' + - 'lib/puppet/catalog-diff/preprocessor.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/pull.rb' + - 'lib/puppet/face/catalog/seed.rb' + - 'spec/spec_helper_local.rb' + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 11 +# Cop supports --auto-correct. +# Configuration parameters: AllowSplatArgument. +Style/HashConversion: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/formater.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/pull.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols. +# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys +Style/HashSyntax: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + +# Offense count: 11 +# Cop supports --auto-correct. +Style/IfUnlessModifier: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/compilecatalog.rb' + - 'lib/puppet/catalog-diff/differ.rb' + - 'lib/puppet/catalog-diff/preprocessor.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + - 'lib/puppet/face/catalog/diff.rb' + - 'lib/puppet/face/catalog/seed.rb' + +# Offense count: 1 +Style/MixinUsage: + Exclude: + - 'spec/spec_helper_local.rb' + +# Offense count: 1 Style/MultilineBlockChain: - Enabled: false + Exclude: + - 'lib/puppet/face/catalog/diff.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: AllowMethodComparison. +Style/MultipleComparison: + Exclude: + - 'lib/puppet/catalog-diff/compilecatalog.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, IgnoredMethods. +# SupportedStyles: predicate, comparison Style/NumericPredicate: - Enabled: false + Exclude: + - 'spec/**/*' + - 'lib/puppet/catalog-diff/differ.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantAssignment: + Exclude: + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 3 +# Cop supports --auto-correct. +Style/RedundantParentheses: + Exclude: + - 'lib/puppet/catalog-diff/differ.rb' + - 'lib/puppet/catalog-diff/formater.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +Style/RedundantSelfAssignment: + Exclude: + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 7 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed Style/RegexpLiteral: - Enabled: false + Exclude: + - 'lib/puppet/face/catalog/pull.rb' + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: Methods. +# Methods: {"reduce"=>["acc", "elem"]}, {"inject"=>["acc", "elem"]} +Style/SingleLineBlockParams: + Exclude: + - 'lib/puppet/face/catalog/diff.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'lib/puppet/catalog-diff/formater.rb' + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Exclude: + - 'spec/unit/puppet/catalog_diff/comparer_spec.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 6 +# Cop supports --auto-correct. +# Configuration parameters: AllowMethodsWithArguments, IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/formater.rb' + - 'lib/puppet/catalog-diff/preprocessor.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 1 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArguments: + Exclude: + - 'lib/puppet/catalog-diff/comparer.rb' + - 'lib/puppet/catalog-diff/searchfacts.rb' + +# Offense count: 2 +# Cop supports --auto-correct. +# Configuration parameters: MinSize, WordRegex. +# SupportedStyles: percent, brackets +Style/WordArray: + EnforcedStyle: brackets From 7b13128a07bc6184289cbc7d39524ed40dab6d82 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 13:06:33 +0200 Subject: [PATCH 15/20] cleanup README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index f195b1a..0e69647 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ 1. [Changed depth](#changed-depth) 1. [Output report](#output-report) 1. [Limitations](#limitations) -1. [Authors](#authors) +1. [Previous Authors](#previous-authors) 1. [Contributors](#contributors) 1. [See Also](#see-also) 1. [Upload facts to PuppetDB](#upload-facts-to-puppetdb) @@ -232,10 +232,10 @@ viewed in markdown using the Rakefile in this directory. A web viewer is also available at [https://github.com/camptocamp/puppet-catalog-diff-viewer](https://github.com/camptocamp/puppet-catalog-diff-viewer) -## Authors +## Previous Authors -R.I.Pienaar / www.devco.net / @ripienaar -Zack Smith / @acidprime +R.I.Pienaar / www.devco.net / @ripienaar +Zack Smith / @acidprime Raphaƫl Pinson / @raphink From c89cc249cfe587f2d4e8610324f562139aa168ef Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 13:22:15 +0200 Subject: [PATCH 16/20] puppet-lint: validate types --- .puppet-lint.rc | 1 - .sync.yml | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 .sync.yml diff --git a/.puppet-lint.rc b/.puppet-lint.rc index dd8272c..558d766 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,3 +1,2 @@ --fail-on-warnings --no-parameter_documentation-check ---no-parameter_types-check diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 0000000..08da294 --- /dev/null +++ b/.sync.yml @@ -0,0 +1,4 @@ +--- +.puppet-lint.rc: + enabled_lint_checks: + - parameter_types From 0d3c56752249fceb3a3f0880802a1f640a3cc82b Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 24 May 2022 14:40:34 +0200 Subject: [PATCH 17/20] comparer: exit early if checksum in old/new catalog is equal There is no benefit of calling `validate_encoding()` twice if the checksums are equal. We can exit early. --- lib/puppet/catalog-diff/comparer.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/puppet/catalog-diff/comparer.rb b/lib/puppet/catalog-diff/comparer.rb index a2ae64c..8a60a67 100644 --- a/lib/puppet/catalog-diff/comparer.rb +++ b/lib/puppet/catalog-diff/comparer.rb @@ -146,11 +146,12 @@ def str_diff(cont1, cont2) sum2 = Digest::MD5.hexdigest(str2) end + return nil if sum1 == sum2 + str1 = validate_encoding(str1) str2 = validate_encoding(str2) return nil unless str1 && str2 - return nil if sum1 == sum2 @@cached_str_diffs ||= {} @@cached_str_diffs["#{sum1}/#{sum2}"] ||= do_str_diff(str1, str2) From 14f9dc0b00bd020b3925d9f11466eda2dd9e97b2 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Tue, 24 May 2022 14:52:35 +0200 Subject: [PATCH 18/20] comparer: exit earily if old/new contents are empty Previously we called `validate_encoding()` to force the old/new strings to be UTF8. Afterwards we exit if one (or both) of the strings are `nil`. If they are actuall `nil`, `validate_encoding()` will fail. Hence it makes sense to move the return statement above the `validate_encoding()` calls. --- lib/puppet/catalog-diff/comparer.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/puppet/catalog-diff/comparer.rb b/lib/puppet/catalog-diff/comparer.rb index 8a60a67..fe4319d 100644 --- a/lib/puppet/catalog-diff/comparer.rb +++ b/lib/puppet/catalog-diff/comparer.rb @@ -147,12 +147,11 @@ def str_diff(cont1, cont2) end return nil if sum1 == sum2 + return nil unless str1 && str2 str1 = validate_encoding(str1) str2 = validate_encoding(str2) - return nil unless str1 && str2 - @@cached_str_diffs ||= {} @@cached_str_diffs["#{sum1}/#{sum2}"] ||= do_str_diff(str1, str2) end From f973b20c2301ec33f721492c735935a1b1bd6d6f Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 13:49:11 +0200 Subject: [PATCH 19/20] Add Puppet 7 support --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 54c3a28..9f724a8 100644 --- a/metadata.json +++ b/metadata.json @@ -77,7 +77,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 6.11.0 < 7.0.0" + "version_requirement": ">= 6.11.0 < 8.0.0" } ], "pdk-version": "2.4.0", From cf1ddfd120f32d2033f851ceb775ef4c1510caa7 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Wed, 8 Jun 2022 13:58:27 +0200 Subject: [PATCH 20/20] Clarify supported Puppet versions in README.md --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 0e69647..9246b10 100644 --- a/README.md +++ b/README.md @@ -47,10 +47,10 @@ any of your nodes. This tool is delivered as a collection of Puppet Faces. It thus requires a Puppet 6.11 (or newer) installation to properly run. -Only the system that runs the catalog-diff needs to be Puppet 6.11 or newer. -You can run it on a Puppetserver that also provides you the old or new -catalogs. However, you can also get catalogs from remote -Puppetservers/PuppetDBs. PuppetDB 2.3 and newer are supported. +Only the system that runs catalog-diff needs to be using Puppet 6.11 or newer. +The puppetservers you are targeting to do the catalog compilation can be running +an early version of puppet; however puppetdb must be at least version 2.3. You +can use catalog-diff directly on a Puppetserver but also on another server. The diff tool recognizes catalogs in yaml, marshall, json, or pson formats. Currently automatic generation of the catalogs is done in the pson format.