From d3742090cb2c184fe625724daf9705b8379837f9 Mon Sep 17 00:00:00 2001 From: Daniel Sundqvist Date: Mon, 22 Jun 2026 14:36:07 +0200 Subject: [PATCH 1/2] Migrate CI from PDK to Vox Pupuli workflows - Replace puppetlabs/cat-github-actions with voxpupuli/gha-puppet beaker.yml@v4 - Simplify Gemfile using voxpupuli-test and voxpupuli-acceptance - Simplify Rakefile to use voxpupuli/test/rake - Replace .rubocop.yml with voxpupuli-test inherited config - Migrate acceptance tests from puppet_litmus to beaker - Require Puppet >= 8.0.0 - Remove PDK metadata fields and Gemfile.lock --- .devcontainer/README.md | 4 +- .github/workflows/ci.yml | 22 +- .rubocop.yml | 725 +----------------- Gemfile | 69 +- Rakefile | 27 +- metadata.json | 7 +- .../00_install_testing_dependencies_spec.rb | 19 - spec/acceptance/default_deployment_spec.rb | 13 +- spec/acceptance/transport_maps_spec.rb | 23 +- spec/spec_helper_acceptance.rb | 8 +- 10 files changed, 103 insertions(+), 814 deletions(-) delete mode 100644 spec/acceptance/00_install_testing_dependencies_spec.rb diff --git a/.devcontainer/README.md b/.devcontainer/README.md index a719361..9839fb0 100644 --- a/.devcontainer/README.md +++ b/.devcontainer/README.md @@ -1,11 +1,11 @@ # devcontainer -For format details, see https://aka.ms/devcontainer.json. +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)", diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8f8d933..305d8f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,18 +2,20 @@ name: "CI" on: - pull_request: + pull_request: {} + push: + branches: + - main + - master concurrency: - group: ${{ github.workflow }}-${{ github.ref }} + group: ${{ github.ref_name }} cancel-in-progress: true -jobs: - Spec: - uses: "puppetlabs/cat-github-actions/.github/workflows/module_ci.yml@main" - secrets: "inherit" +permissions: + contents: read - Acceptance: - needs: Spec - uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" - secrets: "inherit" +jobs: + puppet: + name: Puppet + uses: voxpupuli/gha-puppet/.github/workflows/beaker.yml@v4 diff --git a/.rubocop.yml b/.rubocop.yml index 21b82b9..68d6200 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,730 +1,59 @@ --- -require: -- rubocop-performance -- rubocop-rspec +inherit_gem: + voxpupuli-test: rubocop.yml + AllCops: NewCops: enable - DisplayCopNames: true - TargetRubyVersion: '2.6' - Include: - - "**/*.rb" - Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" + TargetRubyVersion: '3.1' + 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 -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/GemFilename: - Enabled: false -Bundler/InsecureProtocolSource: - Enabled: false -Capybara/CurrentPathExpectation: - Enabled: false -Capybara/VisibilityMatcher: - 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/FeatureMethods: - Enabled: false -RSpec/ContainExactly: - Enabled: false -RSpec/ContextMethod: - Enabled: false -RSpec/ContextWording: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/EmptyHook: - Enabled: false + +RSpec/BeforeAfterAll: + Exclude: + - spec/acceptance/**/*.rb + 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/MatchArray: - Enabled: false -RSpec/MissingExampleGroupArgument: + +RSpec/HookArgument: 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/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 -Capybara/MatchStyle: - Enabled: false -Capybara/NegationMatcher: - Enabled: false -Capybara/SpecificActions: - Enabled: false -Capybara/SpecificFinders: - Enabled: false -Capybara/SpecificMatcher: - Enabled: false -Gemspec/DeprecatedAttributeAssignment: - Enabled: false -Gemspec/DevelopmentDependencies: - Enabled: false -Gemspec/RequireMFA: - Enabled: false -Layout/LineContinuationLeadingSpace: - Enabled: false -Layout/LineContinuationSpacing: - Enabled: false -Layout/LineEndStringConcatenationIndentation: - Enabled: false -Layout/SpaceBeforeBrackets: - Enabled: false -Lint/AmbiguousAssignment: - Enabled: false -Lint/AmbiguousOperatorPrecedence: - Enabled: false -Lint/AmbiguousRange: - Enabled: false -Lint/ConstantOverwrittenInRescue: - Enabled: false -Lint/DeprecatedConstants: - Enabled: false -Lint/DuplicateBranch: - Enabled: false -Lint/DuplicateMagicComment: - Enabled: false -Lint/DuplicateMatchPattern: - Enabled: false -Lint/DuplicateRegexpCharacterClassElement: - Enabled: false -Lint/EmptyBlock: - Enabled: false -Lint/EmptyClass: - Enabled: false -Lint/EmptyInPattern: - Enabled: false -Lint/IncompatibleIoSelectWithFiberScheduler: - Enabled: false -Lint/LambdaWithoutLiteralBlock: - Enabled: false -Lint/NoReturnInBeginEndBlocks: - Enabled: false -Lint/NonAtomicFileOperation: - Enabled: false -Lint/NumberedParameterAssignment: - Enabled: false -Lint/OrAssignmentToConstant: - Enabled: false -Lint/RedundantDirGlobSort: - Enabled: false -Lint/RefinementImportMethods: - Enabled: false -Lint/RequireRangeParentheses: - Enabled: false -Lint/RequireRelativeSelfPath: - Enabled: false -Lint/SymbolConversion: - Enabled: false -Lint/ToEnumArguments: - Enabled: false -Lint/TripleQuotes: - Enabled: false -Lint/UnexpectedBlockArity: - Enabled: false -Lint/UnmodifiedReduceAccumulator: - Enabled: false -Lint/UselessRescue: - Enabled: false -Lint/UselessRuby2Keywords: - Enabled: false -Metrics/CollectionLiteralLength: - Enabled: false -Naming/BlockForwarding: - Enabled: false -Performance/CollectionLiteralInLoop: - Enabled: false -Performance/ConcurrentMonotonicTime: - Enabled: false -Performance/MapCompact: - Enabled: false -Performance/RedundantEqualityComparisonBlock: - Enabled: false -Performance/RedundantSplitRegexpArgument: - Enabled: false -Performance/StringIdentifierArgument: - Enabled: false -RSpec/BeEq: - Enabled: false -RSpec/BeNil: - Enabled: false -RSpec/ChangeByZero: - Enabled: false -RSpec/ClassCheck: - Enabled: false -RSpec/DuplicatedMetadata: - Enabled: false -RSpec/ExcessiveDocstringSpacing: - Enabled: false -RSpec/FactoryBot/ConsistentParenthesesStyle: - Enabled: false -RSpec/FactoryBot/FactoryNameStyle: - Enabled: false -RSpec/FactoryBot/SyntaxMethods: - Enabled: false -RSpec/IdenticalEqualityAssertion: - Enabled: false -RSpec/NoExpectationExample: - Enabled: false -RSpec/PendingWithoutReason: - Enabled: false -RSpec/Rails/AvoidSetupHook: - Enabled: false -RSpec/Rails/HaveHttpStatus: - Enabled: false -RSpec/Rails/InferredSpecType: - Enabled: false -RSpec/Rails/MinitestAssertions: - Enabled: false -RSpec/Rails/TravelAround: - Enabled: false -RSpec/RedundantAround: - Enabled: false -RSpec/SkipBlockInsideExample: - Enabled: false -RSpec/SortMetadata: - Enabled: false -RSpec/SubjectDeclaration: - Enabled: false -RSpec/VerifiedDoubleReference: - Enabled: false -Security/CompoundHash: - Enabled: false -Security/IoMethods: - Enabled: false -Style/ArgumentsForwarding: - Enabled: false -Style/ArrayIntersect: - Enabled: false -Style/CollectionCompact: - Enabled: false -Style/ComparableClamp: - Enabled: false -Style/ConcatArrayLiterals: - Enabled: false -Style/DataInheritance: - Enabled: false -Style/DirEmpty: - Enabled: false -Style/DocumentDynamicEvalDefinition: - Enabled: false -Style/EmptyHeredoc: - Enabled: false -Style/EndlessMethod: - Enabled: false -Style/EnvHome: - Enabled: false -Style/FetchEnvVar: - Enabled: false -Style/FileEmpty: - Enabled: false -Style/FileRead: - Enabled: false -Style/FileWrite: - Enabled: false -Style/HashConversion: - Enabled: false -Style/HashExcept: - Enabled: false -Style/IfWithBooleanLiteralBranches: - Enabled: false -Style/InPatternThen: - Enabled: false -Style/MagicCommentFormat: - Enabled: false -Style/MapCompactWithConditionalBlock: - Enabled: false -Style/MapToHash: - Enabled: false -Style/MapToSet: - Enabled: false -Style/MinMaxComparison: - Enabled: false -Style/MultilineInPatternThen: - Enabled: false -Style/NegatedIfElseCondition: - Enabled: false -Style/NestedFileDirname: - Enabled: false -Style/NilLambda: - Enabled: false -Style/NumberedParameters: - Enabled: false -Style/NumberedParametersLimit: - Enabled: false -Style/ObjectThen: - Enabled: false -Style/OpenStructUse: - Enabled: false -Style/OperatorMethodCall: - Enabled: false -Style/QuotedSymbols: - Enabled: false -Style/RedundantArgument: - Enabled: false -Style/RedundantConstantBase: - Enabled: false -Style/RedundantDoubleSplatHashBraces: - Enabled: false -Style/RedundantEach: - Enabled: false -Style/RedundantHeredocDelimiterQuotes: - Enabled: false -Style/RedundantInitialize: - Enabled: false -Style/RedundantLineContinuation: - Enabled: false -Style/RedundantSelfAssignmentBranch: - Enabled: false -Style/RedundantStringEscape: - Enabled: false -Style/SelectByRegexp: - Enabled: false -Style/StringChars: + +Style/TrailingCommaInArguments: Enabled: false -Style/SwapValues: + +Style/WordArray: Enabled: false diff --git a/Gemfile b/Gemfile index 8e9f845..f03da6e 100644 --- a/Gemfile +++ b/Gemfile @@ -1,67 +1,28 @@ +# frozen_string_literal: true + source ENV['GEM_SOURCE'] || 'https://rubygems.org' -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} +puppet_version = ENV['PUPPET_GEM_VERSION'] - 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 +gem 'puppet', puppet_version, require: false if puppet_version +gem 'facter', ENV['FACTER_GEM_VERSION'], require: false if ENV['FACTER_GEM_VERSION'] + +group :test do + gem 'voxpupuli-test', '~> 9.0', require: false + gem 'puppet_metadata', '~> 4.0', require: false end group :development do - 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', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "deep_merge", '~> 1.2.2', require: false - gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false - gem "facterdb", '~> 2.1', require: false - gem "metadata-json-lint", '~> 4.0', require: false - gem "rspec-puppet-facts", '~> 4.0', require: false - gem "dependency_checker", '~> 1.0.0', require: false - gem "parallel_tests", '= 3.12.1', require: false - gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.9', require: false - gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '~> 1.50.0', require: false - gem "rubocop-performance", '= 1.16.0', require: false - gem "rubocop-rspec", '= 2.19.0', require: false - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "rexml", '>= 3.0.0', '< 3.2.7', require: false -end -group :development, :release_prep do - gem "puppet-strings", '~> 4.0', require: false - gem "puppetlabs_spec_helper", '~> 7.0', require: false + gem 'pry', '~> 0.10', require: false + gem 'puppet-strings', '~> 4.0', require: false end + group :system_tests do - gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] - gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "serverspec", '~> 2.41', require: false + gem 'voxpupuli-acceptance', '~> 3.0', require: false 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 - -gems.each do |gem_name, gem_params| - gem gem_name, *gem_params +group :release do + gem 'voxpupuli-release', '~> 3.0', require: false end # Evaluate Gemfile.local and ~/.gemfile if they exist diff --git a/Rakefile b/Rakefile index 7ee45da..520b3bf 100644 --- a/Rakefile +++ b/Rakefile @@ -1,12 +1,23 @@ # frozen_string_literal: true -require 'bundler' -require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus' -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + # Neither available - acceptance-only run + end +end -PuppetLint.configuration.send('disable_relative') -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_140chars') +begin + require 'voxpupuli/acceptance/rake' +rescue LoadError + # voxpupuli-acceptance not available +end +begin + require 'puppet-strings/tasks' +rescue LoadError + # puppet-strings not available +end diff --git a/metadata.json b/metadata.json index 3733a2c..45e3733 100644 --- a/metadata.json +++ b/metadata.json @@ -61,10 +61,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 6.0.0 < 9.0.0" + "version_requirement": ">= 8.0.0 < 9.0.0" } - ], - "pdk-version": "3.3.0", - "template-url": "pdk-default#3.3.0", - "template-ref": "tags/3.3.0-0-g5d17ec1" + ] } diff --git a/spec/acceptance/00_install_testing_dependencies_spec.rb b/spec/acceptance/00_install_testing_dependencies_spec.rb deleted file mode 100644 index 6664536..0000000 --- a/spec/acceptance/00_install_testing_dependencies_spec.rb +++ /dev/null @@ -1,19 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper_acceptance' - -describe 'fixes for CentOS 8/9' do - pp = <<-MANIFEST - # Fix for RedHad based OS flavours, needs to run first and once - # ss used by serverspecs is missing in container, it is available in iproute package - if "${facts['os']['name']}-${facts['os']['release']['major']}" in ['AlmaLinux-8', 'CentOS-8', 'CentOS-9', 'Rocky-8',] { - package { 'iproute': - ensure => installed, - } - } - MANIFEST - - it 'applies the manifest twice with no stderr' do - idempotent_apply(pp) - end -end diff --git a/spec/acceptance/default_deployment_spec.rb b/spec/acceptance/default_deployment_spec.rb index 0fb4dce..6a83060 100644 --- a/spec/acceptance/default_deployment_spec.rb +++ b/spec/acceptance/default_deployment_spec.rb @@ -4,8 +4,7 @@ describe 'postfix with default deployment' do pp = <<-MANIFEST - # RedHad based OS flavours containers have problems with ipv6, so we use ipv4 only for testing - if "${facts['os']['name']}-${facts['os']['release']['major']}" in ['AlmaLinux-8', 'CentOS-9', 'Rocky-8',] { + if $facts['os']['family'] == 'RedHat' { class { 'postfix': main_inet_protocols => 'ipv4', } @@ -14,8 +13,12 @@ class { 'postfix': } } MANIFEST - it 'applies the manifest twice with no stderr' do - idempotent_apply(pp) + it 'applies the manifest without errors' do + apply_manifest(pp, catch_failures: true) + end + + it 'is idempotent' do + apply_manifest(pp, catch_changes: true) end describe package('postfix') do @@ -42,7 +45,7 @@ class { 'postfix': } describe file('/etc/postfix/main.cf') do it { is_expected.to exist } it { is_expected.to be_file } - it { is_expected.to be_mode 6_44 } + it { is_expected.to be_mode 644 } it { is_expected.to be_owned_by 'root' } it { is_expected.to be_grouped_into 'root' } its(:content) { is_expected.to match %r{# This file is being maintained by Puppet} } diff --git a/spec/acceptance/transport_maps_spec.rb b/spec/acceptance/transport_maps_spec.rb index d3e4fb9..9d0fb59 100644 --- a/spec/acceptance/transport_maps_spec.rb +++ b/spec/acceptance/transport_maps_spec.rb @@ -4,27 +4,30 @@ describe 'postfix with transport_maps set' do pp = <<-MANIFEST - # RedHad based OS flavours containers have problems with ipv6, so we use ipv4 only for testing - if "${facts['os']['name']}-${facts['os']['release']['major']}" in ['AlmaLinux-8', 'CentOS-9', 'Rocky-8'] { + if $facts['os']['family'] == 'RedHat' { class { 'postfix': main_inet_protocols => 'ipv4', - main_transport_maps => '/etc/postfix/transport', # needed for OS flavours without given default value - transport_maps => { + main_transport_maps => '/etc/postfix/transport', + transport_maps => { 'test@test.ing' => 'test.ing', }, } } else { class { 'postfix': - main_transport_maps => '/etc/postfix/transport', # needed for OS flavours without given default value - transport_maps => { + main_transport_maps => '/etc/postfix/transport', + transport_maps => { 'test@test.ing' => 'test.ing', }, } } MANIFEST - it 'applies the manifest twice with no stderr' do - idempotent_apply(pp) + it 'applies the manifest without errors' do + apply_manifest(pp, catch_failures: true) + end + + it 'is idempotent' do + apply_manifest(pp, catch_changes: true) end describe service('postfix') do @@ -39,10 +42,10 @@ class { 'postfix': describe file('/etc/postfix/transport') do it { is_expected.to exist } it { is_expected.to be_file } - it { is_expected.to be_mode 6_44 } + it { is_expected.to be_mode 644 } it { is_expected.to be_owned_by 'root' } it { is_expected.to be_grouped_into 'root' } - its(:content) { is_expected.to match %r{test@test.ing\s*test.ing} } + its(:content) { is_expected.to match %r{test@test\.ing\s*test\.ing} } end describe file('/etc/postfix/transport.db') do diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 73a0238..5445c73 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true -require 'puppet_litmus' -PuppetLitmus.configure! +require 'voxpupuli/acceptance/spec_helper_acceptance' -require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) +configure_beaker do |host| + # Install iproute for ss command on EL-based systems + install_package(host, 'iproute') if fact_on(host, 'os.family') == 'RedHat' +end From 8ad77e039daae4513b7f1a8e853870d0491a9074 Mon Sep 17 00:00:00 2001 From: Daniel Sundqvist Date: Wed, 24 Jun 2026 06:58:38 +0200 Subject: [PATCH 2/2] Add support for RedHat 10 and Rocky 10 - Add hiera data for RedHat 10 and Rocky 10 - Add test fixtures for RedHat 10 and Rocky 10 --- data/os/RedHat/10.yaml | 43 +++++++++++++++++++++++++ data/os/Rocky/10.yaml | 34 +++++++++++++++++++ spec/fixtures/testing/RedHat-10_main.cf | 40 +++++++++++++++++++++++ spec/fixtures/testing/Rocky-10_main.cf | 33 +++++++++++++++++++ 4 files changed, 150 insertions(+) create mode 100644 data/os/RedHat/10.yaml create mode 100644 data/os/Rocky/10.yaml create mode 100644 spec/fixtures/testing/RedHat-10_main.cf create mode 100644 spec/fixtures/testing/Rocky-10_main.cf diff --git a/data/os/RedHat/10.yaml b/data/os/RedHat/10.yaml new file mode 100644 index 0000000..34e14ec --- /dev/null +++ b/data/os/RedHat/10.yaml @@ -0,0 +1,43 @@ +--- +postfix::main_alias_database: 'hash:/etc/aliases' +postfix::main_alias_maps: 'hash:/etc/aliases' +postfix::main_command_directory: '/usr/sbin' +postfix::main_compatibility_level: '2' +postfix::main_daemon_directory: '/usr/libexec/postfix' +postfix::main_data_directory: '/var/lib/postfix' +postfix::main_debug_peer_level: '2' +postfix::main_html_directory: 'no' +postfix::main_inet_protocols: 'all' +postfix::main_mail_owner: 'postfix' +postfix::main_mailq_path: '/usr/bin/mailq.postfix' +postfix::main_manpage_directory: '/usr/share/man' +postfix::main_meta_directory: '/etc/postfix' +postfix::main_newaliases_path: '/usr/bin/newaliases.postfix' +postfix::main_readme_directory: '/usr/share/doc/postfix/README_FILES' +postfix::main_sample_directory: '/usr/share/doc/postfix/samples' +postfix::main_sendmail_path: '/usr/sbin/sendmail.postfix' +postfix::main_setgid_group: 'postdrop' +postfix::main_shlib_directory: '/usr/lib64/postfix' +postfix::main_smtpd_tls_cert_file: '/etc/pki/tls/certs/postfix.pem' +postfix::main_smtpd_tls_key_file: '/etc/pki/tls/certs/postfix.key' +postfix::main_smtpd_tls_security_level: 'may' +postfix::main_smtp_tls_cafile: '/etc/pki/tls/certs/ca-bundle.crt' +postfix::main_smtp_tls_capath: '/etc/pki/tls/certs' +postfix::main_smtp_tls_security_level: 'may' +postfix::main_unknown_local_recipient_reject_code: 550 +postfix::main_append_dot_mydomain: 'no' +postfix::main_biff: 'no' +postfix::main_mailbox_size_limit: 0 +postfix::main_recipient_delimiter: '+' +postfix::main_relayhost: "mailhost.%{facts.networking.domain}" +postfix::main_mydestination: 'localhost' +postfix::main_myorigin: '$myhostname' +postfix::main_myhostname: "%{facts.networking.fqdn}" +postfix::main_queue_directory: '/var/spool/postfix' +postfix::main_transport_maps: '/etc/postfix/transport' +postfix::main_virtual_alias_maps: '/etc/postfix/virtual' +postfix::service_name: 'postfix' +postfix::main_inet_interfaces: + - 'localhost' +postfix::main_mynetworks: + - '127.0.0.0/8' diff --git a/data/os/Rocky/10.yaml b/data/os/Rocky/10.yaml new file mode 100644 index 0000000..dc82984 --- /dev/null +++ b/data/os/Rocky/10.yaml @@ -0,0 +1,34 @@ +--- +postfix::main_compatibility_level: '2' +postfix::main_queue_directory: '/var/spool/postfix' +postfix::main_command_directory: '/usr/sbin' +postfix::main_daemon_directory: '/usr/libexec/postfix' +postfix::main_data_directory: '/var/lib/postfix' +postfix::main_mail_owner: 'postfix' +postfix::main_inet_protocols: 'all' +postfix::main_mydestination: '$myhostname, localhost.$mydomain, localhost' +postfix::main_unknown_local_recipient_reject_code: 550 +postfix::main_alias_maps: 'hash:/etc/aliases' +postfix::main_alias_database: 'hash:/etc/aliases' +postfix::main_debug_peer_level: '2' +postfix::main_sendmail_path: '/usr/sbin/sendmail.postfix' +postfix::main_newaliases_path: '/usr/bin/newaliases.postfix' +postfix::main_mailq_path: '/usr/bin/mailq.postfix' +postfix::main_setgid_group: 'postdrop' +postfix::main_html_directory: 'no' +postfix::main_manpage_directory: '/usr/share/man' +postfix::main_sample_directory: '/usr/share/doc/postfix/samples' +postfix::main_readme_directory: '/usr/share/doc/postfix/README_FILES' +postfix::main_smtpd_tls_cert_file: '/etc/pki/tls/certs/postfix.pem' +postfix::main_smtpd_tls_key_file: '/etc/pki/tls/private/postfix.key' +postfix::main_smtpd_tls_security_level: 'may' +postfix::main_smtp_tls_capath: '/etc/pki/tls/certs' +postfix::main_smtp_tls_cafile: '/etc/pki/tls/certs/ca-bundle.crt' +postfix::main_smtp_tls_security_level: 'may' +postfix::main_meta_directory: '/etc/postfix' +postfix::main_shlib_directory: '/usr/lib64/postfix' +postfix::service_name: 'postfix' +postfix::main_inet_interfaces: + - 'localhost' +postfix::main_custom: + 'debugger_command': 'PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5' diff --git a/spec/fixtures/testing/RedHat-10_main.cf b/spec/fixtures/testing/RedHat-10_main.cf new file mode 100644 index 0000000..c32a78e --- /dev/null +++ b/spec/fixtures/testing/RedHat-10_main.cf @@ -0,0 +1,40 @@ +# This file is being maintained by Puppet. +# DO NOT EDIT + +alias_database = hash:/etc/aliases +alias_maps = hash:/etc/aliases +append_dot_mydomain = no +biff = no +command_directory = /usr/sbin +daemon_directory = /usr/libexec/postfix +data_directory = /var/lib/postfix +inet_interfaces = localhost +inet_protocols = all +smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt +smtp_tls_CApath = /etc/pki/tls/certs +smtp_tls_security_level = may +smtpd_tls_security_level = may +smtpd_tls_key_file = /etc/pki/tls/certs/postfix.key +smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem +compatibility_level = 2 +debug_peer_level = 2 +html_directory = no +mailbox_size_limit = 0 +mailq_path = /usr/bin/mailq.postfix +mail_owner = postfix +manpage_directory = /usr/share/man +meta_directory = /etc/postfix +mydestination = localhost +myhostname = foo.example.com +mynetworks = 127.0.0.0/8 +myorigin = $myhostname +newaliases_path = /usr/bin/newaliases.postfix +queue_directory = /var/spool/postfix +readme_directory = /usr/share/doc/postfix/README_FILES +recipient_delimiter = + +sample_directory = /usr/share/doc/postfix/samples +sendmail_path = /usr/sbin/sendmail.postfix +relayhost = mailhost.example.com:25 +setgid_group = postdrop +shlib_directory = /usr/lib64/postfix +unknown_local_recipient_reject_code = 550 diff --git a/spec/fixtures/testing/Rocky-10_main.cf b/spec/fixtures/testing/Rocky-10_main.cf new file mode 100644 index 0000000..1102ca5 --- /dev/null +++ b/spec/fixtures/testing/Rocky-10_main.cf @@ -0,0 +1,33 @@ +# This file is being maintained by Puppet. +# DO NOT EDIT + +alias_database = hash:/etc/aliases +alias_maps = hash:/etc/aliases +command_directory = /usr/sbin +daemon_directory = /usr/libexec/postfix +data_directory = /var/lib/postfix +inet_interfaces = localhost +inet_protocols = all +smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt +smtp_tls_CApath = /etc/pki/tls/certs +smtp_tls_security_level = may +smtpd_tls_security_level = may +smtpd_tls_key_file = /etc/pki/tls/private/postfix.key +smtpd_tls_cert_file = /etc/pki/tls/certs/postfix.pem +compatibility_level = 2 +debug_peer_level = 2 +html_directory = no +mailq_path = /usr/bin/mailq.postfix +mail_owner = postfix +manpage_directory = /usr/share/man +meta_directory = /etc/postfix +mydestination = $myhostname, localhost.$mydomain, localhost +newaliases_path = /usr/bin/newaliases.postfix +queue_directory = /var/spool/postfix +readme_directory = /usr/share/doc/postfix/README_FILES +sample_directory = /usr/share/doc/postfix/samples +sendmail_path = /usr/sbin/sendmail.postfix +setgid_group = postdrop +shlib_directory = /usr/lib64/postfix +unknown_local_recipient_reject_code = 550 +debugger_command = PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5