diff --git a/.fixtures.yml b/.fixtures.yml index 4de712c2..c5ff6f25 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,9 +3,5 @@ fixtures: archive: "https://github.com/voxpupuli/puppet-archive.git" facts: 'https://github.com/puppetlabs/puppetlabs-facts.git' stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" - puppet_agent: - repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' - ref: v4.13.0 + puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' provision: 'https://github.com/puppetlabs/provision.git' - symlinks: - java: "#{source_dir}" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1b0e39c3..c236bbc2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,6 @@ jobs: Acceptance: needs: Spec uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" - secrets: "inherit" with: - runs_on: "ubuntu-20.04" + flags: "--nightly --arch-exclude arm" + secrets: "inherit" diff --git a/.github/workflows/labeller.yml b/.github/workflows/labeller.yml deleted file mode 100644 index ee149bf5..00000000 --- a/.github/workflows/labeller.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: Labeller - -on: - issues: - types: - - opened - - labeled - - unlabeled - pull_request_target: - types: - - opened - - labeled - - unlabeled - -jobs: - label: - runs-on: ubuntu-latest - steps: - - - uses: puppetlabs/community-labeller@v1.0.1 - name: Label issues or pull requests - with: - label_name: community - label_color: '5319e7' - org_membership: puppetlabs - fail_if_member: 'true' - token: ${{ secrets.IAC_COMMUNITY_LABELER }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index aaa4967f..9f20eccd 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -13,6 +13,6 @@ jobs: Acceptance: needs: Spec uses: "puppetlabs/cat-github-actions/.github/workflows/module_acceptance.yml@main" - secrets: "inherit" with: - runs_on: "ubuntu-20.04" + flags: "--nightly --arch-exclude arm" + secrets: "inherit" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0b7b8a05..4b3b80fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,7 +2,7 @@ name: "Publish module" on: workflow_dispatch: - + jobs: release: uses: "puppetlabs/cat-github-actions/.github/workflows/module_release.yml@main" diff --git a/.gitignore b/.gitignore index 988dcbbe..2803e566 100644 --- a/.gitignore +++ b/.gitignore @@ -16,9 +16,10 @@ /log/ /pkg/ /spec/fixtures/manifests/ -/spec/fixtures/modules/ +/spec/fixtures/modules/* /tmp/ /vendor/ +/.vendor/ /convert_report.txt /update_report.txt .DS_Store @@ -26,3 +27,9 @@ .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml +.resource_types +.modules +.task_cache.json +.plan_cache.json +.rerun.json +bolt-debug.log diff --git a/.pdkignore b/.pdkignore index 960a62ab..84684be6 100644 --- a/.pdkignore +++ b/.pdkignore @@ -16,9 +16,10 @@ /log/ /pkg/ /spec/fixtures/manifests/ -/spec/fixtures/modules/ +/spec/fixtures/modules/* /tmp/ /vendor/ +/.vendor/ /convert_report.txt /update_report.txt .DS_Store @@ -26,21 +27,23 @@ .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml -/appveyor.yml -/.editorconfig +.resource_types +.modules +.task_cache.json +.plan_cache.json +.rerun.json +bolt-debug.log /.fixtures.yml /Gemfile /.gitattributes /.github/ /.gitignore -/.gitlab-ci.yml /.pdkignore /.puppet-lint.rc /Rakefile /rakelib/ /.rspec -/.rubocop.yml -/.travis.yml +/..yml /.yardopts /spec/ /.vscode/ diff --git a/.puppet-lint.rc b/.puppet-lint.rc index cc96ece0..9e15c6e0 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1 +1,9 @@ +--fail-on-warnings --relative +--no-80chars-check +--no-140chars-check +--no-class_inherits_from_params_class-check +--no-autoloader_layout-check +--no-documentation-check +--no-single_quote_string_with_variables-check +--ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp diff --git a/.rubocop.yml b/.rubocop.yml index 2367276d..47b1aadb 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -5,9 +5,7 @@ require: AllCops: NewCops: enable DisplayCopNames: true - ExtraDetails: true - DisplayStyleGuide: true - TargetRubyVersion: '2.7' + TargetRubyVersion: 3.1 Include: - "**/*.rb" Exclude: @@ -21,6 +19,7 @@ AllCops: - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" +inherit_from: ".rubocop_todo.yml" Layout/LineLength: Description: People have wide screens, use them. Max: 200 @@ -74,7 +73,6 @@ Style/TrailingCommaInArrayLiteral: 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: @@ -83,5 +81,651 @@ 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 +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/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: + Enabled: false RSpec/MultipleExpectations: - Max: 3 + 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: + Enabled: false +Style/SwapValues: + Enabled: false diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 0157c284..32286ea0 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,49 +1,14 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-17 12:22:29 UTC using RuboCop version 1.48.1. +# on 2023-11-28 05:16:01 UTC using RuboCop version 1.48.1. # 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: 11 -# Configuration parameters: IgnoredMetadata. -RSpec/DescribeClass: - Exclude: - - '**/spec/features/**/*' - - '**/spec/requests/**/*' - - '**/spec/routing/**/*' - - '**/spec/system/**/*' - - '**/spec/views/**/*' - - 'spec/acceptance/install_spec.rb' - - 'spec/classes/java_spec.rb' - - 'spec/defines/adopt_spec.rb' - - 'spec/defines/adoptium_spec.rb' - - 'spec/defines/download_spec.rb' - - 'spec/defines/sap_spec.rb' - - 'spec/unit/facter/java_default_home_spec.rb' - - 'spec/unit/facter/java_libjvm_path_spec.rb' - - 'spec/unit/facter/java_major_version_spec.rb' - - 'spec/unit/facter/java_patch_level_spec.rb' - - 'spec/unit/facter/java_version_spec.rb' - -# Offense count: 3 +# Offense count: 2 # Configuration parameters: EnforcedStyle, IgnoreSharedExamples. # SupportedStyles: always, named_only RSpec/NamedSubject: Exclude: - - 'spec/classes/java_spec.rb' - 'spec/defines/download_spec.rb' - -# Offense count: 12 -# Configuration parameters: AllowedPatterns. -# AllowedPatterns: ^expect_, ^assert_ -RSpec/NoExpectationExample: - Exclude: - - 'spec/acceptance/install_spec.rb' - - 'spec/unit/facter/java_default_home_spec.rb' - -# Offense count: 1 -Style/MixinUsage: - Exclude: - - 'spec/spec_helper.rb' diff --git a/.sync.yml b/.sync.yml index 28f0f9b0..afecd940 100644 --- a/.sync.yml +++ b/.sync.yml @@ -3,12 +3,8 @@ delete: true appveyor.yml: delete: true - -Gemfile: - optional: - ":development": - - gem: github_changelog_generator - version: '= 1.15.2' +.rubocop.yml: + include_todos: true spec/spec_helper.rb: mock_with: ":rspec" coverage_report: true diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 2f1e4f73..6da8d472 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,6 @@ { "recommendations": [ "puppet.puppet-vscode", - "rebornix.Ruby" + "Shopify.ruby-lsp" ] } diff --git a/.whitesource b/.whitesource new file mode 100644 index 00000000..04109aad --- /dev/null +++ b/.whitesource @@ -0,0 +1,45 @@ +{ + "scanSettings": { + "configMode": "AUTO", + "configExternalURL": "", + "projectToken": "", + "baseBranches": [] + }, + "scanSettingsSAST": { + "enableScan": true, + "scanPullRequests": true, + "incrementalScan": true, + "baseBranches": [], + "snippetSize": 10 + }, + "checkRunSettings": { + "vulnerableCheckRunConclusionLevel": "failure", + "displayMode": "diff", + "useMendCheckNames": true + }, + "checkRunSettingsSAST": { + "checkRunConclusionLevel": "failure", + "severityThreshold": "high" + }, + "issueSettings": { + "minSeverityLevel": "LOW", + "issueType": "DEPENDENCY" + }, + "issueSettingsSAST": { + "minSeverityLevel": "high", + "issueType": "repo" + }, + "remediateSettings": { + "workflowRules": { + "enabled": true + } + }, + "imageSettings":{ + "imageTracing":{ + "enableImageTracingPR": false, + "addRepositoryCoordinate": false, + "addDockerfilePath": false, + "addMendIdentifier": false + } + } +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a46653af..c92ee508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,47 @@ All 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). +## [v11.2.0](https://github.com/puppetlabs/puppetlabs-java/tree/v11.2.0) - 2025-07-18 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v11.1.0...v11.2.0) + +### Other + +- puppet/archive: Allow 8.x [#611](https://github.com/puppetlabs/puppetlabs-java/pull/611) ([evgeni](https://github.com/evgeni)) +- (CAT-2296) Update github runner image to ubuntu-24.04 [#610](https://github.com/puppetlabs/puppetlabs-java/pull/610) ([shubhamshinde360](https://github.com/shubhamshinde360)) + +## [v11.1.0](https://github.com/puppetlabs/puppetlabs-java/tree/v11.1.0) - 2024-12-17 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v11.0.1...v11.1.0) + +### Fixed + +- (CAT-2158) Upgrade rexml to address CVE-2024-49761 [#605](https://github.com/puppetlabs/puppetlabs-java/pull/605) ([amitkarsale](https://github.com/amitkarsale)) + +### Other + +- Add support for Ubuntu 24.04 [#600](https://github.com/puppetlabs/puppetlabs-java/pull/600) ([choffee](https://github.com/choffee)) + +## [v11.0.1](https://github.com/puppetlabs/puppetlabs-java/tree/v11.0.1) - 2024-10-07 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v11.0.0...v11.0.1) + +### Fixed + +- (CAT-2051): Fixed SUSEConnect command so that java installation succeeds on SLES-15 [#601](https://github.com/puppetlabs/puppetlabs-java/pull/601) ([span786](https://github.com/span786)) + +## [v11.0.0](https://github.com/puppetlabs/puppetlabs-java/tree/v11.0.0) - 2024-04-16 + +[Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v10.1.2...v11.0.0) + +### Changed + +- [CAT-1427] : Removing RedHat/Scientific/OracleLinux 6 [#576](https://github.com/puppetlabs/puppetlabs-java/pull/576) ([rajat-puppet](https://github.com/rajat-puppet)) + +### Added + +- Support Debian 12 and refactor to make that easier [#585](https://github.com/puppetlabs/puppetlabs-java/pull/585) ([ekohl](https://github.com/ekohl)) + ## [v10.1.2](https://github.com/puppetlabs/puppetlabs-java/tree/v10.1.2) - 2023-07-27 [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v10.1.1...v10.1.2) @@ -30,13 +71,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v9.0.1...v10.0.0) +### Changed + +- (CONT-784) Add Support for Puppet 8 / Drop Support for Puppet 6 [#548](https://github.com/puppetlabs/puppetlabs-java/pull/548) ([david22swan](https://github.com/david22swan)) + ### Added - (CONT-356) Syntax update [#543](https://github.com/puppetlabs/puppetlabs-java/pull/543) ([LukasAud](https://github.com/LukasAud)) -### Changed -- (CONT-784) Add Support for Puppet 8 / Drop Support for Puppet 6 [#548](https://github.com/puppetlabs/puppetlabs-java/pull/548) ([david22swan](https://github.com/david22swan)) - ### Fixed - Fix shell_escape of unless command [#550](https://github.com/puppetlabs/puppetlabs-java/pull/550) ([traylenator](https://github.com/traylenator)) @@ -55,6 +97,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v8.2.0...v9.0.0) ### Changed + - (CONT-263) Update minimum required puppet version [#535](https://github.com/puppetlabs/puppetlabs-java/pull/535) ([LukasAud](https://github.com/LukasAud)) ### Fixed @@ -87,13 +130,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v7.3.0...v8.0.0) +### Changed + +- (GH-C&T-7) Remove code specific to unsupported OSs [#507](https://github.com/puppetlabs/puppetlabs-java/pull/507) ([david22swan](https://github.com/david22swan)) + ### Added - (MODULES-11234) Support Adoptium Temurin [#502](https://github.com/puppetlabs/puppetlabs-java/pull/502) ([dploeger](https://github.com/dploeger)) -### Changed -- (GH-C&T-7) Remove code specific to unsupported OSs [#507](https://github.com/puppetlabs/puppetlabs-java/pull/507) ([david22swan](https://github.com/david22swan)) - ### Fixed - pdksync - (GH-iac-334) Remove Support for Ubuntu 14.04/16.04 [#505](https://github.com/puppetlabs/puppetlabs-java/pull/505) ([david22swan](https://github.com/david22swan)) @@ -161,6 +205,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v6.5.0...v7.0.0) ### Changed + - pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0 [#463](https://github.com/puppetlabs/puppetlabs-java/pull/463) ([carabasdaniel](https://github.com/carabasdaniel)) ### Fixed @@ -235,15 +280,16 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/v4.1.0...v5.0.0) +### Changed + +- [FM-8320] Remove Oracle download [#372](https://github.com/puppetlabs/puppetlabs-java/pull/372) ([carabasdaniel](https://github.com/carabasdaniel)) + ### Added - (FM-8223) converted to use litmus [#376](https://github.com/puppetlabs/puppetlabs-java/pull/376) ([tphoney](https://github.com/tphoney)) - Add buster support, default to 11 [#369](https://github.com/puppetlabs/puppetlabs-java/pull/369) ([mhjacks](https://github.com/mhjacks)) - Add support for debian buster [#364](https://github.com/puppetlabs/puppetlabs-java/pull/364) ([TomRitserveldt](https://github.com/TomRitserveldt)) -### Changed -- [FM-8320] Remove Oracle download [#372](https://github.com/puppetlabs/puppetlabs-java/pull/372) ([carabasdaniel](https://github.com/carabasdaniel)) - ### Fixed - (FM-8343) use release numbers not lsbdistcodename [#375](https://github.com/puppetlabs/puppetlabs-java/pull/375) ([tphoney](https://github.com/tphoney)) @@ -261,6 +307,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/3.3.0...v4.0.0) +### Changed + +- pdksync - (MODULES-8444) - Raise lower Puppet bound [#356](https://github.com/puppetlabs/puppetlabs-java/pull/356) ([david22swan](https://github.com/david22swan)) + ### Added - (FM-7921) - Implement Puppet Strings [#353](https://github.com/puppetlabs/puppetlabs-java/pull/353) ([david22swan](https://github.com/david22swan)) @@ -268,9 +318,6 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a - Add ability to override basedir and package type for oracle java [#345](https://github.com/puppetlabs/puppetlabs-java/pull/345) ([fraenki](https://github.com/fraenki)) - MODULES-8613: Add option to set a custom JCE download URL [#344](https://github.com/puppetlabs/puppetlabs-java/pull/344) ([HielkeJ](https://github.com/HielkeJ)) -### Changed -- pdksync - (MODULES-8444) - Raise lower Puppet bound [#356](https://github.com/puppetlabs/puppetlabs-java/pull/356) ([david22swan](https://github.com/david22swan)) - ### Fixed - MODULES-8698: Fix $install_path on CentOS with tar.gz package type [#349](https://github.com/puppetlabs/puppetlabs-java/pull/349) ([fraenki](https://github.com/fraenki)) @@ -316,13 +363,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a [Full Changelog](https://github.com/puppetlabs/puppetlabs-java/compare/2.4.0...3.0.0) +### Changed + +- [FM-6963] Removal of unsupported OS from java [#295](https://github.com/puppetlabs/puppetlabs-java/pull/295) ([david22swan](https://github.com/david22swan)) + ### Added - (MODULES-7561) - Addition of support for Ubuntu 18.04 to java [#299](https://github.com/puppetlabs/puppetlabs-java/pull/299) ([david22swan](https://github.com/david22swan)) -### Changed -- [FM-6963] Removal of unsupported OS from java [#295](https://github.com/puppetlabs/puppetlabs-java/pull/295) ([david22swan](https://github.com/david22swan)) - ### Fixed - Remove ensure_resource to avoid potential conflict [#287](https://github.com/puppetlabs/puppetlabs-java/pull/287) ([sevencastles](https://github.com/sevencastles)) @@ -404,7 +452,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Fixed - Fix typo in documentation for class oracle [#170](https://github.com/puppetlabs/puppetlabs-java/pull/170) ([gerhardsam](https://github.com/gerhardsam)) -- Fix up rspec deprecation warnings. [#166](https://github.com/puppetlabs/puppetlabs-java/pull/166) ([alexharv074](https://github.com/alexharv074)) +- Fix up rspec deprecation warnings. [#166](https://github.com/puppetlabs/puppetlabs-java/pull/166) ([alex-harvey-z3q](https://github.com/alex-harvey-z3q)) ## [1.5.0](https://github.com/puppetlabs/puppetlabs-java/tree/1.5.0) - 2016-04-12 @@ -420,7 +468,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a ### Fixed -- Fix typo in README.markdown [#165](https://github.com/puppetlabs/puppetlabs-java/pull/165) ([alexharv074](https://github.com/alexharv074)) +- Fix typo in README.markdown [#165](https://github.com/puppetlabs/puppetlabs-java/pull/165) ([alex-harvey-z3q](https://github.com/alex-harvey-z3q)) ## [1.4.3](https://github.com/puppetlabs/puppetlabs-java/tree/1.4.3) - 2015-12-07 diff --git a/CODEOWNERS b/CODEOWNERS index a5d109e9..13360c54 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -1,2 +1,3 @@ # Setting ownership to the modules team -* @puppetlabs/modules +# include Trusted Contributors +* @puppetlabs/modules @bastelfreak diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e7a3a7c3..25bf5ebc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,3 +1,3 @@ # Contributing to Puppet modules -Check out our [Contributing to Supported Modules Blog Post](https://puppetlabs.github.io/iac/docs/contributing_to_a_module.html) to find all the information that you will need. +Check out our [Contributing to Puppet modules docs](https://help.puppet.com/core//current/Content/PuppetCore/contributing.htm) to find all the information that you will need. diff --git a/Gemfile b/Gemfile index 6235e42e..4e7de031 100644 --- a/Gemfile +++ b/Gemfile @@ -1,60 +1,86 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' +# frozen_string_literal: true -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} +# For puppetcore, set GEM_SOURCE_PUPPETCORE = 'https://rubygems-puppetcore.puppet.com' +gemsource_default = ENV['GEM_SOURCE'] || 'https://rubygems.org' +gemsource_puppetcore = if ENV['PUPPET_FORGE_TOKEN'] + 'https://rubygems-puppetcore.puppet.com' +else + ENV['GEM_SOURCE_PUPPETCORE'] || gemsource_default +end +source gemsource_default + +def location_for(place_or_constraint, fake_constraint = nil, opts = {}) + git_url_regex = /\A(?(?:https?|git)[:@][^#]*)(?:#(?.*))?/ + file_url_regex = %r{\Afile://(?.*)} + + if place_or_constraint && (git_url = place_or_constraint.match(git_url_regex)) + # Git source → ignore :source, keep fake_constraint + [fake_constraint, { git: git_url[:url], branch: git_url[:branch], require: false }].compact + + elsif place_or_constraint && (file_url = place_or_constraint.match(file_url_regex)) + # File source → ignore :source, keep fake_constraint or default >= 0 + [fake_constraint || '>= 0', { path: File.expand_path(file_url[:path]), require: false }] - 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 }] + # Plain version constraint → merge opts (including :source if provided) + [place_or_constraint, { require: false }.merge(opts)] + end +end + +# Print debug information if DEBUG_GEMS or VERBOSE is set +def print_gem_statement_for(gems) + puts 'DEBUG: Gem definitions that will be generated:' + gems.each do |gem_name, gem_params| + puts "DEBUG: gem #{([gem_name.inspect] + gem_params.map(&:inspect)).join(', ')}" end 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 "voxpupuli-puppet-lint-plugins", '~> 4.0', require: false - gem "facterdb", '~> 1.18', require: false - gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false - gem "puppetlabs_spec_helper", '~> 5.0', require: false - gem "rspec-puppet-facts", '~> 2.0', require: false - gem "codecov", '~> 0.2', require: false - gem "dependency_checker", '~> 0.2', require: false - gem "parallel_tests", '= 3.12.1', require: false - gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.5', require: false - gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '= 1.48.1', 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 "github_changelog_generator", '= 1.15.2', require: false + 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 if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "metadata-json-lint", '~> 4.0', require: false + gem "json-schema", '< 5.1.1', require: false + gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + 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.6', 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 "bigdecimal", '< 3.2.2', require: false, platforms: [:mswin, :mingw, :x64_mingw] +end +group :development, :release_prep do + gem "puppet-strings", '~> 4.0', require: false + gem "puppetlabs_spec_helper", '~> 8.0', require: false + gem "puppet-blacksmith", '~> 7.0', require: false end group :system_tests do - gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] - gem "serverspec", '~> 2.41', require: false + gem "puppet_litmus", '~> 2.0', require: false, platforms: [:ruby, :x64_mingw] if !ENV['PUPPET_FORGE_TOKEN'].to_s.empty? + gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] if ENV['PUPPET_FORGE_TOKEN'].to_s.empty? + gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "serverspec", '~> 2.41', require: false end -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] -hiera_version = ENV['HIERA_GEM_VERSION'] - gems = {} +puppet_version = ENV.fetch('PUPPET_GEM_VERSION', nil) +facter_version = ENV.fetch('FACTER_GEM_VERSION', nil) +hiera_version = ENV.fetch('HIERA_GEM_VERSION', nil) -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['puppet'] = location_for(puppet_version, nil, { source: gemsource_puppetcore }) +gems['facter'] = location_for(facter_version, nil, { source: gemsource_puppetcore }) +gems['hiera'] = location_for(hiera_version, nil, {}) if hiera_version +# Generate the gem definitions +print_gem_statement_for(gems) if ENV['DEBUG'] gems.each do |gem_name, gem_params| gem gem_name, *gem_params end @@ -62,12 +88,14 @@ end # Evaluate Gemfile.local and ~/.gemfile if they exist extra_gemfiles = [ "#{__FILE__}.local", - File.join(Dir.home, '.gemfile'), + File.join(Dir.home, '.gemfile') ] extra_gemfiles.each do |gemfile| - if File.file?(gemfile) && File.readable?(gemfile) - eval(File.read(gemfile), binding) - end + next unless File.file?(gemfile) && File.readable?(gemfile) + + # rubocop:disable Security/Eval + eval(File.read(gemfile), binding) + # rubocop:enable Security/Eval end # vim: syntax=ruby diff --git a/REFERENCE.md b/REFERENCE.md index 9ed34192..f8064267 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -137,7 +137,7 @@ The following parameters are available in the `java::adopt` defined type: ##### `ensure` -Data type: `Any` +Data type: `Enum['present']` Install or remove the package. @@ -145,7 +145,7 @@ Default value: `'present'` ##### `version` -Data type: `Any` +Data type: `String[1]` Version of Java to install, e.g. '8' or '9'. Default values for major and minor versions will be used. @@ -153,7 +153,7 @@ Default value: `'8'` ##### `version_major` -Data type: `Any` +Data type: `Optional[String]` Major version which should be installed, e.g. '8u101' or '9.0.4'. Must be used together with version_minor. @@ -161,15 +161,16 @@ Default value: `undef` ##### `version_minor` -Data type: `Any` +Data type: `Optional[String]` -Minor version which should be installed, e.g. 'b12' (for version = '8') or '11' (for version != '8'). Must be used together with version_major. +Minor version which should be installed, e.g. 'b12' (for version = '8') or '11' (for version != '8'). +Must be used together with version_major. Default value: `undef` ##### `java` -Data type: `Any` +Data type: `String[1]` Type of Java Standard Edition to install, jdk or jre. @@ -177,7 +178,7 @@ Default value: `'jdk'` ##### `proxy_server` -Data type: `Any` +Data type: `Optional[String]` Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive) @@ -185,7 +186,7 @@ Default value: `undef` ##### `proxy_type` -Data type: `Any` +Data type: `Optional[String]` Proxy server type (none|http|https|ftp). (passed to archive) @@ -193,7 +194,7 @@ Default value: `undef` ##### `url` -Data type: `Any` +Data type: `Optional[String]` Full URL @@ -201,7 +202,7 @@ Default value: `undef` ##### `basedir` -Data type: `Any` +Data type: `Optional[String]` Directory under which the installation will occur. If not set, defaults to /usr/lib/jvm for Debian and /usr/java for RedHat. @@ -210,16 +211,16 @@ Default value: `undef` ##### `manage_basedir` -Data type: `Any` +Data type: `Boolean` -Whether to manage the basedir directory. Defaults to false. +Whether to manage the basedir directory. Note: /usr/lib/jvm is managed for Debian by default, separate from this parameter. Default value: `true` ##### `package_type` -Data type: `Any` +Data type: `Optional[String]` Type of installation package for specified version of java_se. java_se 6 comes in a few installation package flavors and we need to account for them. @@ -229,7 +230,7 @@ Default value: `undef` ##### `manage_symlink` -Data type: `Any` +Data type: `Boolean` Whether to manage a symlink that points to the installation directory. Defaults to false. @@ -237,7 +238,7 @@ Default value: `false` ##### `symlink_name` -Data type: `Any` +Data type: `Optional[String]` The name for the optional symlink in the installation directory. @@ -266,7 +267,7 @@ The following parameters are available in the `java::adoptium` defined type: ##### `ensure` -Data type: `Any` +Data type: `Enum['present']` Install or remove the package. @@ -274,7 +275,7 @@ Default value: `'present'` ##### `version_major` -Data type: `Any` +Data type: `Optional[String]` Major version which should be installed, e.g. '16' or '17' @@ -282,7 +283,7 @@ Default value: `undef` ##### `version_minor` -Data type: `Any` +Data type: `Optional[String]` Minor version which should be installed, e.g. '0' @@ -290,7 +291,7 @@ Default value: `undef` ##### `version_patch` -Data type: `Any` +Data type: `Optional[String]` Minor version which should be installed, e.g. '2' @@ -298,7 +299,7 @@ Default value: `undef` ##### `version_build` -Data type: `Any` +Data type: `Optional[String]` Build version which should be installed, e.g. '07' @@ -306,7 +307,7 @@ Default value: `undef` ##### `proxy_server` -Data type: `Any` +Data type: `Optional[String]` Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive) @@ -314,7 +315,7 @@ Default value: `undef` ##### `proxy_type` -Data type: `Any` +Data type: `Optional[Enum['none', 'http', 'https', 'ftp']]` Proxy server type (none|http|https|ftp). (passed to archive) @@ -322,7 +323,7 @@ Default value: `undef` ##### `url` -Data type: `Any` +Data type: `Optional[String]` Full URL @@ -330,7 +331,7 @@ Default value: `undef` ##### `basedir` -Data type: `Any` +Data type: `Optional[String]` Directory under which the installation will occur. If not set, defaults to /usr/lib/jvm for Debian and /usr/java for RedHat. @@ -339,7 +340,7 @@ Default value: `undef` ##### `manage_basedir` -Data type: `Any` +Data type: `Boolean` Whether to manage the basedir directory. Defaults to false. Note: /usr/lib/jvm is managed for Debian by default, separate from this parameter. @@ -348,7 +349,7 @@ Default value: `true` ##### `manage_symlink` -Data type: `Any` +Data type: `Boolean` Whether to manage a symlink that points to the installation directory. Defaults to false. @@ -356,7 +357,7 @@ Default value: `false` ##### `symlink_name` -Data type: `Any` +Data type: `Optional[String]` The name for the optional symlink in the installation directory. @@ -388,7 +389,7 @@ The following parameters are available in the `java::download` defined type: ##### `ensure` -Data type: `Any` +Data type: `Enum['present']` Install or remove the package. @@ -396,7 +397,7 @@ Default value: `'present'` ##### `version` -Data type: `Any` +Data type: `String[1]` Version of Java to install, e.g. '7' or '8'. Default values for major and minor versions will be used. @@ -404,7 +405,7 @@ Default value: `'8'` ##### `version_major` -Data type: `Any` +Data type: `Optional[String]` Major version which should be installed, e.g. '8u101'. Must be used together with version_minor. @@ -412,7 +413,7 @@ Default value: `undef` ##### `version_minor` -Data type: `Any` +Data type: `Optional[String]` Minor version which should be installed, e.g. 'b12'. Must be used together with version_major. @@ -420,7 +421,7 @@ Default value: `undef` ##### `java_se` -Data type: `Any` +Data type: `String[1]` Type of Java Standard Edition to install, jdk or jre. @@ -428,7 +429,7 @@ Default value: `'jdk'` ##### `proxy_server` -Data type: `Any` +Data type: `Optional[String]` Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive) @@ -436,7 +437,7 @@ Default value: `undef` ##### `proxy_type` -Data type: `Any` +Data type: `Optional[Enum['none', 'http', 'https', 'ftp']]` Proxy server type (none|http|https|ftp). (passed to archive) @@ -444,7 +445,7 @@ Default value: `undef` ##### `url` -Data type: `Any` +Data type: `Optional[String]` Full URL @@ -452,7 +453,7 @@ Default value: `undef` ##### `jce` -Data type: `Any` +Data type: `Boolean` Install Oracles Java Cryptographic Extensions into the JRE or JDK @@ -460,7 +461,7 @@ Default value: `false` ##### `jce_url` -Data type: `Any` +Data type: `Optional[String]` Full URL to the jce zip file @@ -468,7 +469,7 @@ Default value: `undef` ##### `basedir` -Data type: `Any` +Data type: `Optional[String]` Directory under which the installation will occur. If not set, defaults to /usr/lib/jvm for Debian and /usr/java for RedHat. @@ -477,7 +478,7 @@ Default value: `undef` ##### `manage_basedir` -Data type: `Any` +Data type: `Boolean` Whether to manage the basedir directory. Defaults to false. Note: /usr/lib/jvm is managed for Debian by default, separate from this parameter. @@ -486,7 +487,7 @@ Default value: `false` ##### `package_type` -Data type: `Any` +Data type: `Optional[String]` Type of installation package for specified version of java_se. java_se 6 comes in a few installation package flavors and we need to account for them. @@ -496,7 +497,7 @@ Default value: `undef` ##### `manage_symlink` -Data type: `Any` +Data type: `Boolean` Whether to manage a symlink that points to the installation directory. Defaults to false. @@ -504,7 +505,7 @@ Default value: `false` ##### `symlink_name` -Data type: `Any` +Data type: `Optional[String]` The name for the optional symlink in the installation directory. @@ -531,7 +532,7 @@ The following parameters are available in the `java::sap` defined type: ##### `ensure` -Data type: `Any` +Data type: `Enum['present']` Install or remove the package. @@ -539,7 +540,7 @@ Default value: `'present'` ##### `version` -Data type: `Any` +Data type: `String[1]` Version of Java to install, e.g. '8' or '9'. Default values for full versions will be used. @@ -547,7 +548,7 @@ Default value: `'8'` ##### `version_full` -Data type: `Any` +Data type: `Optional[String]` Major version which should be installed, e.g. '8.1.063' or '11.0.7'. If used, "version" parameter is ignored. @@ -555,7 +556,7 @@ Default value: `undef` ##### `java` -Data type: `Any` +Data type: `String[1]` Type of Java Edition to install, jdk or jre. @@ -563,7 +564,7 @@ Default value: `'jdk'` ##### `proxy_server` -Data type: `Any` +Data type: `Optional[String]` Specify a proxy server, with port number if needed. ie: https://example.com:8080. (passed to archive) @@ -571,7 +572,7 @@ Default value: `undef` ##### `proxy_type` -Data type: `Any` +Data type: `Optional[Enum['none', 'http', 'https', 'ftp']]` Proxy server type (none|http|https|ftp). (passed to archive) @@ -579,7 +580,7 @@ Default value: `undef` ##### `basedir` -Data type: `Any` +Data type: `Optional[String]` Directory under which the installation will occur. If not set, defaults to /usr/lib/jvm for Debian and /usr/java for RedHat. @@ -588,16 +589,16 @@ Default value: `undef` ##### `manage_basedir` -Data type: `Any` +Data type: `Boolean` -Whether to manage the basedir directory. Defaults to false. +Whether to manage the basedir directory. Note: /usr/lib/jvm is managed for Debian by default, separate from this parameter. Default value: `true` ##### `manage_symlink` -Data type: `Any` +Data type: `Boolean` Whether to manage a symlink that points to the installation directory. Defaults to false. @@ -605,7 +606,7 @@ Default value: `false` ##### `symlink_name` -Data type: `Any` +Data type: `Optional[String]` The name for the optional symlink in the installation directory. diff --git a/Rakefile b/Rakefile index 0f8754eb..31b59305 100644 --- a/Rakefile +++ b/Rakefile @@ -1,89 +1,18 @@ # frozen_string_literal: true require 'bundler' -require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? +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_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 -end - -def changelog_project - return unless Rake.application.top_level_tasks.include? "changelog" - - returnVal = nil - returnVal ||= begin - metadata_source = JSON.load(File.read('metadata.json'))['source'] - metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) - - metadata_source_match && metadata_source_match[1] - 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 -end +require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' 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? - config.user = "#{changelog_user}" - config.project = "#{changelog_project}" - 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"], - }, - } - 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 - end -end +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_140chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_autoloader_layout') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"] diff --git a/manifests/download.pp b/manifests/download.pp index e8593820..4d451ffc 100644 --- a/manifests/download.pp +++ b/manifests/download.pp @@ -28,11 +28,23 @@ # @param url # Full URL # +# @param username +# Username for the URL +# +# @param password +# Password for the URL +# # @param jce # Install Oracles Java Cryptographic Extensions into the JRE or JDK # # @param jce_url # Full URL to the jce zip file +# +# @param jce_username +# Username for the JCE URL +# +# @param jce_password +# Password for the JCE URL # # @param basedir # Directory under which the installation will occur. If not set, defaults to @@ -62,8 +74,12 @@ Optional[String] $proxy_server = undef, Optional[Enum['none', 'http', 'https', 'ftp']] $proxy_type = undef, Optional[String] $url = undef, + Optional[String] $username = undef, + Optional[String] $password = undef, Boolean $jce = false, Optional[String] $jce_url = undef, + Optional[String] $jce_username = undef, + Optional[String] $jce_password = undef, Optional[String] $basedir = undef, Boolean $manage_basedir = false, Optional[String] $package_type = undef, @@ -258,6 +274,8 @@ archive { $destination : ensure => present, source => $source, + username => $username, + password => $password, extract_path => '/tmp', cleanup => false, creates => $creates_path, @@ -309,6 +327,8 @@ extract_path => $jce_path, extract_flags => '-oj', creates => "${jce_path}/US_export_policy.jar", + username => $jce_username, + password => $jce_password, cleanup => false, proxy_server => $proxy_server, proxy_type => $proxy_type, diff --git a/manifests/init.pp b/manifests/init.pp index 78ba209e..ce5dcb9a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -110,14 +110,17 @@ default => '--jre' } - # Enable legacy repo to install net-tools-deprecated package - # If SUSE OS major version is >= 15 and minor version is > 3 - if ($facts['os']['family'] in ['SLES', 'SUSE']) and (versioncmp($facts['os']['release']['major'], '15') >= 0 and versioncmp($facts['os']['release']['minor'], '3') == 1) { - exec { 'Enable legacy repos': - path => '/bin:/usr/bin/:/sbin:/usr/sbin', - command => 'SUSEConnect --product sle-module-legacy/15.5/x86_64', - unless => 'SUSEConnect --status-text | grep sle-module-legacy/15.5/x86_64', + # TEMPORARY FIX: If no repos are configured on SLES, add openSUSE Leap as fallback + # This workaround is needed because GCP-provisioned SLES images are unregistered BYOS + # without any package repositories configured. Remove this once proper PAYG images are used. + if ($facts['os']['family'] in ['SLES', 'SUSE']) { + exec { 'Configure zypper repo for SLES': + path => '/bin:/usr/bin:/sbin:/usr/sbin', + command => 'zypper --non-interactive --gpg-auto-import-keys ar http://download.opensuse.org/distribution/leap/15.6/repo/oss/ opensuse-leap-fallback && zypper --non-interactive --gpg-auto-import-keys refresh', + unless => "zypper lr 2>/dev/null | grep -q 'opensuse-leap-fallback\\|http'", + logoutput => true, } + -> Package['java'] } if $facts['os']['family'] == 'Debian' { diff --git a/manifests/params.pp b/manifests/params.pp index cfbaa289..fa352809 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -11,27 +11,23 @@ 'AlmaLinux', 'Rocky', 'RedHat', 'CentOS', 'OracleLinux', 'Scientific', 'OEL', 'SLC', 'CloudLinux': { # See PR#160 / c8e46b5 for why >= 6.3 < 7.1 if (versioncmp($facts['os']['release']['full'], '7.1') < 0) { - $jdk_package = 'java-1.7.0-openjdk-devel' - $jre_package = 'java-1.7.0-openjdk' - $java_home = '/usr/lib/jvm/java-1.7.0/' - } - else { - $jdk_package = 'java-1.8.0-openjdk-devel' - $jre_package = 'java-1.8.0-openjdk' - $java_home = '/usr/lib/jvm/java-1.8.0/' + $openjdk = '1.7.0' + } else { + $openjdk = '1.8.0' } + $jdk_package = "java-${openjdk}-openjdk-devel" + $jre_package = "java-${openjdk}-openjdk" + $java_home = "/usr/lib/jvm/java-${openjdk}/" } 'Fedora': { if (versioncmp($facts['os']['release']['full'], '21') < 0) { - $jdk_package = 'java-1.7.0-openjdk-devel' - $jre_package = 'java-1.7.0-openjdk' - $java_home = "/usr/lib/jvm/java-1.7.0-openjdk-${facts['os']['architecture']}/" - } - else { - $jdk_package = 'java-1.8.0-openjdk-devel' - $jre_package = 'java-1.8.0-openjdk' - $java_home = "/usr/lib/jvm/java-1.8.0-openjdk-${facts['os']['architecture']}/" + $openjdk = '1.7.0' + } else { + $openjdk = '1.8.0' } + $jdk_package = "java-${openjdk}-openjdk-devel" + $jre_package = "java-${openjdk}-openjdk" + $java_home = "/usr/lib/jvm/java-${openjdk}-openjdk-${facts['os']['architecture']}/" } 'Amazon': { $jdk_package = 'java-1.7.0-openjdk-devel' @@ -62,24 +58,31 @@ default => $facts['os']['architecture'] } case $facts['os']['release']['major'] { + '13': { + $openjdk = 21 + } + '12', '24.04': { + $openjdk = 17 + } '10', '11', '18.04', '18.10', '19.04', '19.10', '20.04', '22.04': { - $java = { - 'jdk' => { - 'package' => 'openjdk-11-jdk', - 'alternative' => "java-1.11.0-openjdk-${openjdk_architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/", - }, - 'jre' => { - 'package' => 'openjdk-11-jre-headless', - 'alternative' => "java-1.11.0-openjdk-${openjdk_architecture}", - 'alternative_path' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/bin/java", - 'java_home' => "/usr/lib/jvm/java-1.11.0-openjdk-${openjdk_architecture}/", - }, - } + $openjdk = 11 } default: { fail("unsupported release ${facts['os']['release']['major']}") } } + $java = { + 'jdk' => { + 'package' => "openjdk-${openjdk}-jdk", + 'alternative' => "java-1.${openjdk}.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.${openjdk}.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.${openjdk}.0-openjdk-${openjdk_architecture}/", + }, + 'jre' => { + 'package' => "openjdk-${openjdk}-jre-headless", + 'alternative' => "java-1.${openjdk}.0-openjdk-${openjdk_architecture}", + 'alternative_path' => "/usr/lib/jvm/java-1.${openjdk}.0-openjdk-${openjdk_architecture}/bin/java", + 'java_home' => "/usr/lib/jvm/java-1.${openjdk}.0-openjdk-${openjdk_architecture}/", + }, + } } 'OpenBSD': { $java = { diff --git a/metadata.json b/metadata.json index 16926110..e0db352c 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "puppetlabs-java", - "version": "10.1.2", + "version": "11.2.0", "author": "puppetlabs", "summary": "Installs the correct Java package on various platforms.", "license": "Apache-2.0", @@ -14,7 +14,7 @@ }, { "name": "puppet/archive", - "version_requirement": ">= 1.1.0 < 8.0.0" + "version_requirement": ">= 1.1.0 < 9.0.0" } ], "operatingsystem_support": [ @@ -30,7 +30,8 @@ "operatingsystem": "CentOS", "operatingsystemrelease": [ "7", - "8" + "8", + "9" ] }, { @@ -43,7 +44,9 @@ "operatingsystem": "Debian", "operatingsystemrelease": [ "10", - "11" + "11", + "12", + "13" ] }, { @@ -51,7 +54,8 @@ "operatingsystemrelease": [ "18.04", "20.04", - "22.04" + "22.04", + "24.04" ] }, { @@ -77,10 +81,10 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 7.0.0 < 9.0.0" + "version_requirement": ">= 8.0.0 < 9.0.0" } ], "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", - "template-ref": "heads/main-0-gc6d4446", - "pdk-version": "2.7.1" + "template-ref": "tags/3.5.1-0-g9d5b193", + "pdk-version": "3.5.0" } diff --git a/spec/classes/java_spec.rb b/spec/classes/java_spec.rb index 09906916..dd51a098 100644 --- a/spec/classes/java_spec.rb +++ b/spec/classes/java_spec.rb @@ -10,49 +10,90 @@ it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.8.0/') } end - context 'when selecting jdk for Debian Buster (10.0)' do + context 'on Debian Buster (10.0)' do let(:facts) { { os: { family: 'Debian', name: 'Debian', lsb: { distcodename: 'buster' }, release: { major: '10' }, architecture: 'amd64' } } } - let(:params) { { 'distribution' => 'jdk' } } - it { is_expected.to contain_package('java').with_name('openjdk-11-jdk') } - it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + context 'when selecting jdk' do + let(:params) { { 'distribution' => 'jdk' } } + + it { is_expected.to contain_package('java').with_name('openjdk-11-jdk') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + end + + context 'when selecting jre' do + let(:params) { { 'distribution' => 'jre' } } + + it { is_expected.to contain_package('java').with_name('openjdk-11-jre-headless') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + end end - context 'when selecting jre for Debian Buster (10.0)' do - let(:facts) { { os: { family: 'Debian', name: 'Debian', lsb: { distcodename: 'buster' }, release: { major: '10' }, architecture: 'amd64' } } } - let(:params) { { 'distribution' => 'jre' } } + context 'on Debian Bookworm (12)' do + let(:facts) { { os: { family: 'Debian', name: 'Debian', lsb: { distcodename: 'bookworm' }, release: { major: '12' }, architecture: 'amd64' } } } + + context 'when selecting jdk' do + let(:params) { { 'distribution' => 'jdk' } } - it { is_expected.to contain_package('java').with_name('openjdk-11-jre-headless') } - it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + it { is_expected.to contain_package('java').with_name('openjdk-17-jdk') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64/') } + end + + context 'when selecting jre' do + let(:params) { { 'distribution' => 'jre' } } + + it { is_expected.to contain_package('java').with_name('openjdk-17-jre-headless') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.17.0-openjdk-amd64/') } + end end - context 'when selecting jdk for Ubuntu Bionic (18.04)' do - let(:facts) { { os: { family: 'Debian', name: 'Ubuntu', lsb: { distcodename: 'bionic' }, release: { major: '18.04' }, architecture: 'amd64' } } } - let(:params) { { 'distribution' => 'jdk' } } + context 'on Debian Trixie (13)' do + let(:facts) { { os: { family: 'Debian', name: 'Debian', lsb: { distcodename: 'trixie' }, release: { major: '13' }, architecture: 'amd64' } } } + + context 'when selecting jdk' do + let(:params) { { 'distribution' => 'jdk' } } + + it { is_expected.to contain_package('java').with_name('openjdk-21-jdk') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64/') } + end + + context 'when selecting jre' do + let(:params) { { 'distribution' => 'jre' } } - it { is_expected.to contain_package('java').with_name('openjdk-11-jdk') } - it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + it { is_expected.to contain_package('java').with_name('openjdk-21-jre-headless') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.21.0-openjdk-amd64/') } + end end - context 'when selecting jre for Ubuntu Bionic (18.04)' do + context 'on Ubuntu Bionic (18.04)' do let(:facts) { { os: { family: 'Debian', name: 'Ubuntu', lsb: { distcodename: 'bionic' }, release: { major: '18.04' }, architecture: 'amd64' } } } - let(:params) { { 'distribution' => 'jre' } } - it { is_expected.to contain_package('java').with_name('openjdk-11-jre-headless') } - it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } - end + context 'when selecting jdk' do + let(:params) { { 'distribution' => 'jdk' } } - context 'when selecting openjdk for Oracle Linux' do - let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '7.0' }, architecture: 'x86_64' } } } + it { is_expected.to contain_package('java').with_name('openjdk-11-jdk') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + end + + context 'when selecting jre' do + let(:params) { { 'distribution' => 'jre' } } - it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } + it { is_expected.to contain_package('java').with_name('openjdk-11-jre-headless') } + it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib/jvm/java-1.11.0-openjdk-amd64/') } + end end - context 'when selecting passed value for Oracle Linux' do + context 'on Oracle Linux 7.0' do let(:facts) { { os: { family: 'RedHat', name: 'OracleLinux', release: { full: '7.0' }, architecture: 'x86_64' } } } - let(:params) { { 'distribution' => 'jre' } } - it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } + context 'when selecting openjdk' do + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') } + end + + context 'when selecting passed value for Oracle Linux' do + let(:params) { { 'distribution' => 'jre' } } + + it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') } + end end context 'when selecting passed value for Scientific Linux' do @@ -72,7 +113,7 @@ end context 'when selecting default for OpenSUSE 12.3' do - let(:facts) { { os: { family: 'Suse', name: 'OpenSUSE', release: { major: '12.3' }, architecture: 'x86_64' } } } + let(:facts) { { os: { family: 'Suse', name: 'OpenSUSE', release: { full: '12.3', major: '12', minor: '3' }, architecture: 'x86_64' } } } it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel') } it { is_expected.to contain_file_line('java-home-environment').with_line('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/') } diff --git a/spec/default_facts.yml b/spec/default_facts.yml index f3946607..3346c394 100644 --- a/spec/default_facts.yml +++ b/spec/default_facts.yml @@ -3,7 +3,7 @@ # Facts specified here will override the values provided by rspec-puppet-facts. --- networking: - ip: "172.16.254.254" - ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" - mac: "AA:AA:AA:AA:AA:AA" + ip: "172.16.254.254" + ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" + mac: "AA:AA:AA:AA:AA:AA" is_pe: false diff --git a/spec/defines/download_spec.rb b/spec/defines/download_spec.rb index c6b8e7a6..b7b288bd 100644 --- a/spec/defines/download_spec.rb +++ b/spec/defines/download_spec.rb @@ -15,7 +15,7 @@ version_major: '8u201', version_minor: 'b09', java_se: 'jdk', - url: url + url: } end let(:title) { 'jdk8' } @@ -50,7 +50,7 @@ basedir: '/usr/java', manage_symlink: true, symlink_name: 'java_home', - url: url + url: } end let(:title) { 'jdk6' } @@ -65,7 +65,7 @@ version: '6', java_se: 'jdk', basedir: '/usr/java', - url: url + url: } end let(:title) { 'jdk6_nosymlink' } @@ -78,7 +78,7 @@ let(:facts) { { kernel: 'Linux', os: { family: 'Debian', architecture: 'amd64', name: 'Ubuntu', release: { full: '18.04' } } } } context 'when passing URL to url parameter' do - let(:params) { { ensure: 'present', version_major: '8u201', version_minor: 'b09', java_se: 'jdk', url: url } } + let(:params) { { ensure: 'present', version_major: '8u201', version_minor: 'b09', java_se: 'jdk', url: } } let(:title) { 'jdk8' } it { is_expected.to contain_archive('/tmp/jdk-8-8u201-b09-linux-x64.tar.gz') } @@ -89,7 +89,7 @@ let(:facts) { { kernel: 'Linux', os: { family: 'Debian', architecture: 'amd64', name: 'Debian', release: { full: '10.0' } } } } context 'when passing URL to url parameter' do - let(:params) { { ensure: 'present', version_major: '8u201', version_minor: 'b09', java_se: 'jdk', url: url } } + let(:params) { { ensure: 'present', version_major: '8u201', version_minor: 'b09', java_se: 'jdk', url: } } let(:title) { 'jdk8' } it { is_expected.to contain_archive('/tmp/jdk-8-8u201-b09-linux-x64.tar.gz') } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c6e55257..ae7c1f68 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,7 +13,7 @@ default_facts = { puppetversion: Puppet.version, - facterversion: Facter.version + facterversion: Facter.version, } default_fact_files = [ @@ -25,7 +25,8 @@ next unless File.exist?(f) && File.readable?(f) && File.size?(f) begin - default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) + require 'deep_merge' + default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) rescue StandardError => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end @@ -33,7 +34,7 @@ # read default_facts and merge them over what is provided by facterdb default_facts.each do |fact, value| - add_custom_fact fact, value + add_custom_fact fact, value, merge_facts: true end RSpec.configure do |c|