diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 0000000..12ed4ff --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,6 @@ +FROM puppet/pdk:latest + +# [Optional] Uncomment this section to install additional packages. +# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ +# && apt-get -y install --no-install-recommends + diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 0000000..a719361 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,38 @@ +# devcontainer + + +For format details, see https://aka.ms/devcontainer.json. + +For config options, see the README at: +https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet + +``` json +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + // Set *default* container specific settings.json values on container create. + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } + }, + + // Add the IDs of extensions you want installed when the container is created. + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ], + + // Use 'forwardPorts' to make a list of ports inside the container available locally. + "forwardPorts": [], + + // Use 'postCreateCommand' to run commands after the container is created. + "postCreateCommand": "pdk --version", +} +``` + + + diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 0000000..fe7a8b1 --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,17 @@ +{ + "name": "Puppet Development Kit (Community)", + "dockerFile": "Dockerfile", + + "settings": { + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } + }, + + "extensions": [ + "puppet.puppet-vscode", + "rebornix.Ruby" + ] +} diff --git a/.fixtures.yml b/.fixtures.yml index 3761c55..32957df 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -3,11 +3,11 @@ --- fixtures: repositories: - "concat": "git://github.com/puppetlabs/puppetlabs-concat.git" + "concat": "https://github.com/puppetlabs/puppetlabs-concat" "cron_core": "https://github.com/puppetlabs/puppetlabs-cron_core.git" "facts": "https://github.com/puppetlabs/puppetlabs-facts.git" - "inifile": "git://github.com/puppetlabs/puppetlabs-inifile.git" + "inifile": "https://github.com/puppetlabs/puppetlabs-inifile" "openssl": "https://github.com/camptocamp/puppet-openssl.git" "provision": "https://github.com/puppetlabs/provision.git" "puppet_agent": "https://github.com/puppetlabs/puppetlabs-puppet_agent.git" - "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" + "stdlib": "https://github.com/puppetlabs/puppetlabs-stdlib" diff --git a/.gitignore b/.gitignore index 2767022..988dcbb 100644 --- a/.gitignore +++ b/.gitignore @@ -25,3 +25,4 @@ .project .envrc /inventory.yaml +/spec/fixtures/litmus_inventory.yaml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4868bf7..6d5e786 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,26 +3,27 @@ stages: - syntax - unit -cache: - paths: - - vendor/bundle +default: + cache: + paths: + - vendor/bundle -before_script: - - bundle -v - - rm Gemfile.lock || true - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# Set `rubygems_version` in the .sync.yml to set a value" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v - - bundle install --without system_tests --path vendor/bundle --jobs $(nproc) + before_script: &before_script + - bundle -v + - rm Gemfile.lock || true + - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" + - "# Set `rubygems_version` in the .sync.yml to set a value" + - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" + - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' + - gem --version + - bundle -v + - bundle install --without system_tests --path vendor/bundle --jobs $(nproc) -syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.7-Puppet ~> 6: +validate lint check rubocop-Ruby 2.5.7-Puppet ~> 6: stage: syntax image: ruby:2.5.7 script: - - bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop + - bundle exec rake validate lint check rubocop variables: PUPPET_GEM_VERSION: '~> 6' @@ -34,11 +35,19 @@ parallel_spec-Ruby 2.5.7-Puppet ~> 6: variables: PUPPET_GEM_VERSION: '~> 6' -parallel_spec-Ruby 2.4.5-Puppet ~> 5: +validate lint check rubocop-Ruby 2.7.2-Puppet ~> 7: + stage: syntax + image: ruby:2.7.2 + script: + - bundle exec rake validate lint check rubocop + variables: + PUPPET_GEM_VERSION: '~> 7' + +parallel_spec-Ruby 2.7.2-Puppet ~> 7: stage: unit - image: ruby:2.4.5 + image: ruby:2.7.2 script: - bundle exec rake parallel_spec variables: - PUPPET_GEM_VERSION: '~> 5' + PUPPET_GEM_VERSION: '~> 7' diff --git a/.pdkignore b/.pdkignore index e6215cd..c538bea 100644 --- a/.pdkignore +++ b/.pdkignore @@ -25,13 +25,16 @@ .project .envrc /inventory.yaml +/spec/fixtures/litmus_inventory.yaml /appveyor.yml +/.editorconfig /.fixtures.yml /Gemfile /.gitattributes /.gitignore /.gitlab-ci.yml /.pdkignore +/.puppet-lint.rc /Rakefile /rakelib/ /.rspec @@ -40,3 +43,5 @@ /.yardopts /spec/ /.vscode/ +/.sync.yml +/.devcontainer/ diff --git a/.rubocop.yml b/.rubocop.yml index 5307849..31e8248 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,12 @@ --- require: +- rubocop-performance - rubocop-rspec -- rubocop-i18n AllCops: DisplayCopNames: true - TargetRubyVersion: '2.1' + TargetRubyVersion: '2.5' Include: - - "./**/*.rb" + - "**/*.rb" Exclude: - bin/* - ".vendor/**/*" @@ -18,16 +18,9 @@ AllCops: - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" -Metrics/LineLength: +Layout/LineLength: Description: People have wide screens, use them. Max: 200 -GetText: - Enabled: false -GetText/DecorateString: - Description: We don't want to decorate test output. - Exclude: - - spec/**/* - Enabled: false RSpec/BeforeAfterAll: Description: Beware of using after(:all) as it may cause state to leak between tests. A necessary evil in acceptance testing. @@ -36,14 +29,13 @@ RSpec/BeforeAfterAll: RSpec/HookArgument: Description: Prefer explicit :each argument, matching existing module's style EnforcedStyle: each +RSpec/DescribeSymbol: + Exclude: + - spec/unit/facter/**/*.rb Style/BlockDelimiters: Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: true Style/ClassAndModuleChildren: Description: Compact style reduces the required amount of indentation. EnforcedStyle: compact @@ -72,7 +64,7 @@ Style/TrailingCommaInArguments: Description: Prefer always trailing comma on multiline argument lists. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma -Style/TrailingCommaInLiteral: +Style/TrailingCommaInArrayLiteral: Description: Prefer always trailing comma on multiline literals. This makes diffs, and re-ordering nicer. EnforcedStyleForMultiline: comma @@ -87,26 +79,170 @@ Style/Documentation: - spec/**/* Style/WordArray: EnforcedStyle: brackets +Performance/AncestorsInclude: + Enabled: true +Performance/BigDecimalWithNumericArgument: + Enabled: true +Performance/BlockGivenWithExplicitBlock: + Enabled: true +Performance/CaseWhenSplat: + Enabled: true +Performance/ConstantRegexp: + Enabled: true +Performance/MethodObjectAsBlock: + Enabled: true +Performance/RedundantSortBlock: + Enabled: true +Performance/RedundantStringChars: + Enabled: true +Performance/ReverseFirst: + Enabled: true +Performance/SortReverse: + Enabled: true +Performance/Squeeze: + Enabled: true +Performance/StringInclude: + Enabled: true +Performance/Sum: + Enabled: true Style/CollectionMethods: Enabled: true Style/MethodCalledOnDoEndBlock: Enabled: true Style/StringMethods: Enabled: true -GetText/DecorateFunctionMessage: +Bundler/InsecureProtocolSource: + Enabled: false +Gemspec/DuplicatedAssignment: + Enabled: false +Gemspec/OrderedDependencies: + Enabled: false +Gemspec/RequiredRubyVersion: + Enabled: false +Gemspec/RubyVersionGlobalsUsage: + Enabled: false +Layout/ArgumentAlignment: + Enabled: false +Layout/BeginEndAlignment: + Enabled: false +Layout/ClosingHeredocIndentation: Enabled: false -GetText/DecorateStringFormattingUsingInterpolation: +Layout/EmptyComment: Enabled: false -GetText/DecorateStringFormattingUsingPercent: +Layout/EmptyLineAfterGuardClause: + Enabled: false +Layout/EmptyLinesAroundArguments: + Enabled: false +Layout/EmptyLinesAroundAttributeAccessor: Enabled: false Layout/EndOfLine: Enabled: false -Layout/IndentHeredoc: +Layout/FirstArgumentIndentation: + Enabled: false +Layout/HashAlignment: + Enabled: false +Layout/HeredocIndentation: + Enabled: false +Layout/LeadingEmptyLines: + Enabled: false +Layout/SpaceAroundMethodCallOperator: + Enabled: false +Layout/SpaceInsideArrayLiteralBrackets: + Enabled: false +Layout/SpaceInsideReferenceBrackets: + Enabled: false +Lint/BigDecimalNew: + Enabled: false +Lint/BooleanSymbol: + Enabled: false +Lint/ConstantDefinitionInBlock: + Enabled: false +Lint/DeprecatedOpenSSLConstant: + Enabled: false +Lint/DisjunctiveAssignmentInConstructor: + Enabled: false +Lint/DuplicateElsifCondition: + Enabled: false +Lint/DuplicateRequire: + Enabled: false +Lint/DuplicateRescueException: + Enabled: false +Lint/EmptyConditionalBody: + Enabled: false +Lint/EmptyFile: + Enabled: false +Lint/ErbNewArguments: + Enabled: false +Lint/FloatComparison: + Enabled: false +Lint/HashCompareByIdentity: + Enabled: false +Lint/IdentityComparison: + Enabled: false +Lint/InterpolationCheck: + Enabled: false +Lint/MissingCopEnableDirective: + Enabled: false +Lint/MixedRegexpCaptureTypes: + Enabled: false +Lint/NestedPercentLiteral: + Enabled: false +Lint/NonDeterministicRequireOrder: + Enabled: false +Lint/OrderedMagicComments: + Enabled: false +Lint/OutOfRangeRegexpRef: + Enabled: false +Lint/RaiseException: + Enabled: false +Lint/RedundantCopEnableDirective: + Enabled: false +Lint/RedundantRequireStatement: + Enabled: false +Lint/RedundantSafeNavigation: + Enabled: false +Lint/RedundantWithIndex: + Enabled: false +Lint/RedundantWithObject: + Enabled: false +Lint/RegexpAsCondition: + Enabled: false +Lint/ReturnInVoidContext: + Enabled: false +Lint/SafeNavigationConsistency: + Enabled: false +Lint/SafeNavigationWithEmpty: + Enabled: false +Lint/SelfAssignment: + Enabled: false +Lint/SendWithMixinArgument: + Enabled: false +Lint/ShadowedArgument: + Enabled: false +Lint/StructNewOverride: + Enabled: false +Lint/ToJSON: + Enabled: false +Lint/TopLevelReturnWithArgument: + Enabled: false +Lint/TrailingCommaInAttributeDeclaration: + Enabled: false +Lint/UnreachableLoop: + Enabled: false +Lint/UriEscapeUnescape: + Enabled: false +Lint/UriRegexp: + Enabled: false +Lint/UselessMethodDefinition: + Enabled: false +Lint/UselessTimes: Enabled: false Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false +Metrics/BlockNesting: + Enabled: false Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: @@ -119,19 +255,265 @@ Metrics/ParameterLists: Enabled: false Metrics/PerceivedComplexity: Enabled: false +Migration/DepartmentName: + Enabled: false +Naming/AccessorMethodName: + Enabled: false +Naming/BlockParameterName: + Enabled: false +Naming/HeredocDelimiterCase: + Enabled: false +Naming/HeredocDelimiterNaming: + Enabled: false +Naming/MemoizedInstanceVariableName: + Enabled: false +Naming/MethodParameterName: + Enabled: false +Naming/RescuedExceptionsVariableName: + Enabled: false +Naming/VariableNumber: + Enabled: false +Performance/BindCall: + Enabled: false +Performance/DeletePrefix: + Enabled: false +Performance/DeleteSuffix: + Enabled: false +Performance/InefficientHashSearch: + Enabled: false +Performance/UnfreezeString: + Enabled: false +Performance/UriDefaultParser: + Enabled: false +RSpec/Be: + Enabled: false +RSpec/Capybara/CurrentPathExpectation: + Enabled: false +RSpec/Capybara/FeatureMethods: + Enabled: false +RSpec/Capybara/VisibilityMatcher: + Enabled: false +RSpec/ContextMethod: + Enabled: false +RSpec/ContextWording: + Enabled: false RSpec/DescribeClass: Enabled: false +RSpec/EmptyHook: + Enabled: false +RSpec/EmptyLineAfterExample: + Enabled: false +RSpec/EmptyLineAfterExampleGroup: + Enabled: false +RSpec/EmptyLineAfterHook: + Enabled: false RSpec/ExampleLength: Enabled: false -RSpec/MessageExpectation: +RSpec/ExampleWithoutDescription: + Enabled: false +RSpec/ExpectChange: + Enabled: false +RSpec/ExpectInHook: + Enabled: false +RSpec/FactoryBot/AttributeDefinedStatically: + Enabled: false +RSpec/FactoryBot/CreateList: + Enabled: false +RSpec/FactoryBot/FactoryClassName: + Enabled: false +RSpec/HooksBeforeExamples: + Enabled: false +RSpec/ImplicitBlockExpectation: + Enabled: false +RSpec/ImplicitSubject: + Enabled: false +RSpec/LeakyConstantDeclaration: + Enabled: false +RSpec/LetBeforeExamples: + Enabled: false +RSpec/MissingExampleGroupArgument: Enabled: false RSpec/MultipleExpectations: Enabled: false +RSpec/MultipleMemoizedHelpers: + Enabled: false +RSpec/MultipleSubjects: + Enabled: false RSpec/NestedGroups: Enabled: false +RSpec/PredicateMatcher: + Enabled: false +RSpec/ReceiveCounts: + Enabled: false +RSpec/ReceiveNever: + Enabled: false +RSpec/RepeatedExampleGroupBody: + Enabled: false +RSpec/RepeatedExampleGroupDescription: + Enabled: false +RSpec/RepeatedIncludeExample: + Enabled: false +RSpec/ReturnFromStub: + Enabled: false +RSpec/SharedExamples: + Enabled: false +RSpec/StubbedMock: + Enabled: false +RSpec/UnspecifiedException: + Enabled: false +RSpec/VariableDefinition: + Enabled: false +RSpec/VoidExpect: + Enabled: false +RSpec/Yield: + Enabled: false +Security/Open: + Enabled: false +Style/AccessModifierDeclarations: + Enabled: false +Style/AccessorGrouping: + Enabled: false Style/AsciiComments: Enabled: false +Style/BisectedAttrAccessor: + Enabled: false +Style/CaseLikeIf: + Enabled: false +Style/ClassEqualityComparison: + Enabled: false +Style/ColonMethodDefinition: + Enabled: false +Style/CombinableLoops: + Enabled: false +Style/CommentedKeyword: + Enabled: false +Style/Dir: + Enabled: false +Style/DoubleCopDisableDirective: + Enabled: false +Style/EmptyBlockParameter: + Enabled: false +Style/EmptyLambdaParameter: + Enabled: false +Style/Encoding: + Enabled: false +Style/EvalWithLocation: + Enabled: false +Style/ExpandPathArguments: + Enabled: false +Style/ExplicitBlockArgument: + Enabled: false +Style/ExponentialNotation: + Enabled: false +Style/FloatDivision: + Enabled: false +Style/FrozenStringLiteralComment: + Enabled: false +Style/GlobalStdStream: + Enabled: false +Style/HashAsLastArrayItem: + Enabled: false +Style/HashLikeCase: + Enabled: false +Style/HashTransformKeys: + Enabled: false +Style/HashTransformValues: + Enabled: false Style/IfUnlessModifier: Enabled: false +Style/KeywordParametersOrder: + Enabled: false +Style/MinMax: + Enabled: false +Style/MixinUsage: + Enabled: false +Style/MultilineWhenThen: + Enabled: false +Style/NegatedUnless: + Enabled: false +Style/NumericPredicate: + Enabled: false +Style/OptionalBooleanParameter: + Enabled: false +Style/OrAssignment: + Enabled: false +Style/RandomWithOffset: + Enabled: false +Style/RedundantAssignment: + Enabled: false +Style/RedundantCondition: + Enabled: false +Style/RedundantConditional: + Enabled: false +Style/RedundantFetchBlock: + Enabled: false +Style/RedundantFileExtensionInRequire: + Enabled: false +Style/RedundantRegexpCharacterClass: + Enabled: false +Style/RedundantRegexpEscape: + Enabled: false +Style/RedundantSelfAssignment: + Enabled: false +Style/RedundantSort: + Enabled: false +Style/RescueStandardError: + Enabled: false +Style/SingleArgumentDig: + Enabled: false +Style/SlicingWithRange: + Enabled: false +Style/SoleNestedConditional: + Enabled: false +Style/StderrPuts: + Enabled: false +Style/StringConcatenation: + Enabled: false +Style/Strip: + Enabled: false Style/SymbolProc: Enabled: false +Style/TrailingBodyOnClass: + Enabled: false +Style/TrailingBodyOnMethodDefinition: + Enabled: false +Style/TrailingBodyOnModule: + Enabled: false +Style/TrailingCommaInHashLiteral: + Enabled: false +Style/TrailingMethodEndStatement: + Enabled: false +Style/UnpackFirst: + Enabled: false +Lint/DuplicateBranch: + Enabled: false +Lint/DuplicateRegexpCharacterClassElement: + Enabled: false +Lint/EmptyBlock: + Enabled: false +Lint/EmptyClass: + Enabled: false +Lint/NoReturnInBeginEndBlocks: + Enabled: false +Lint/ToEnumArguments: + Enabled: false +Lint/UnexpectedBlockArity: + Enabled: false +Lint/UnmodifiedReduceAccumulator: + Enabled: false +Performance/CollectionLiteralInLoop: + Enabled: false +Style/ArgumentsForwarding: + Enabled: false +Style/CollectionCompact: + Enabled: false +Style/DocumentDynamicEvalDefinition: + Enabled: false +Style/NegatedIfElseCondition: + Enabled: false +Style/NilLambda: + Enabled: false +Style/RedundantArgument: + Enabled: false +Style/SwapValues: + Enabled: false diff --git a/.travis.yml b/.travis.yml index 7a4fe04..444e17a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,46 +28,18 @@ jobs: fast_finish: true include: - - env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint" + env: CHECK="validate lint check rubocop" stage: static - - - env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec - rvm: 2.4.5 - stage: spec - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec rvm: 2.5.7 stage: spec - - - before_script: - - "bundle exec rake 'litmus:provision_list[travis_el8]'" - - "bundle exec rake 'litmus:install_agent[puppet6]'" - - "bundle exec rake litmus:install_module" - bundler_args: - dist: xenial - env: PLATFORMS=travis_el8_puppet6 RUN_TEST=main - rvm: 2.5.3 - script: ["bundle exec rake litmus:acceptance:parallel"] - services: docker - stage: acceptance - - - before_script: - - "bundle exec rake 'litmus:provision_list[travis_el8]'" - - "bundle exec rake 'litmus:install_agent[puppet6]'" - - "bundle exec rake litmus:install_module" - bundler_args: - dist: xenial - env: PLATFORMS=travis_el8_puppet6 RUN_TEST=replication - rvm: 2.5.3 - script: ["bundle exec rake litmus:acceptance:parallel"] - services: docker - stage: acceptance - env: DEPLOY_TO_FORGE=yes stage: deploy branches: only: - - master + - main - /^v\d/ notifications: email: false diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c6f82b..8162845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ 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/spec/v2.0.0.html). +## [2.6.0] - 2022-09-21 + +### Changed +* Update os versions and Puppet version +* Update PDK from 1.8.0 to 2.5.0 + +### Fixed +* Fix puppet-lint offenses +* Fix unit tests + ## [2.5.0] - 2021-01-20 ### Added @@ -144,7 +154,8 @@ This release adds the ability to manage the content of both `ds_389::add` and `d ## 1.0.0 - 2017-10-27 * Initial release. -[Unreleased]: https://github.com/markt-de/puppet-ds_389/compare/2.5.0...HEAD +[Unreleased]: https://github.com/markt-de/puppet-ds_389/compare/2.6.0...HEAD +[2.6.0]: https://github.com/markt-de/puppet-ds_389/compare/2.5.0...2.6.0 [2.5.0]: https://github.com/markt-de/puppet-ds_389/compare/2.4.0...2.5.0 [2.4.0]: https://github.com/markt-de/puppet-ds_389/compare/2.3.0...2.4.0 [2.3.0]: https://github.com/markt-de/puppet-ds_389/compare/2.2.0...2.3.0 diff --git a/Gemfile b/Gemfile index 8007ad0..fc28658 100644 --- a/Gemfile +++ b/Gemfile @@ -17,17 +17,18 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments minor_version = ruby_version_segments[0..1].join('.') group :development do - gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0') - gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0') - gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0') - gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9') gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-posix-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:ruby] - gem "puppet-module-win-default-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "puppet-module-win-dev-r#{minor_version}", '~> 0.4', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 2.8.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "voxpupuli-puppet-lint-plugins", '>= 3.0', require: false +end +group :system_tests do + gem "puppet-module-posix-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-win-system-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] end puppet_version = ENV['PUPPET_GEM_VERSION'] @@ -44,16 +45,6 @@ gems['puppet'] = location_for(puppet_version) gems['facter'] = location_for(facter_version) if facter_version gems['hiera'] = location_for(hiera_version) if hiera_version -if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)} - # If we're using a Puppet gem on Windows which handles its own win32-xxx gem - # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445). - gems['win32-dir'] = ['<= 0.4.9', require: false] - gems['win32-eventlog'] = ['<= 0.6.5', require: false] - gems['win32-process'] = ['<= 0.7.5', require: false] - gems['win32-security'] = ['<= 0.2.5', require: false] - gems['win32-service'] = ['0.8.8', require: false] -end - gems.each do |gem_name, gem_params| gem gem_name, *gem_params end diff --git a/Rakefile b/Rakefile index 0a5093b..0f8754e 100644 --- a/Rakefile +++ b/Rakefile @@ -1,5 +1,6 @@ # frozen_string_literal: true +require 'bundler' require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' @@ -42,6 +43,7 @@ end PuppetLint.configuration.send('disable_relative') + if Bundler.rubygems.find_name('github_changelog_generator').any? GitHubChangelogGenerator::RakeTask.new :changelog do |config| raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? diff --git a/appveyor.yml b/appveyor.yml index ec38949..a70c01e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,8 +1,9 @@ --- version: 1.1.x.{build} +skip_branch_with_pr: true branches: only: - - master + - main - release skip_commits: message: /^\(?doc\)?.*/ @@ -16,16 +17,8 @@ init: environment: matrix: - - RUBY_VERSION: 24-x64 - CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop - - - PUPPET_GEM_VERSION: ~> 5.0 - RUBY_VERSION: 24 - CHECK: parallel_spec - - - PUPPET_GEM_VERSION: ~> 5.0 - RUBY_VERSION: 24-x64 - CHECK: parallel_spec + RUBY_VERSION: 25-x64 + CHECK: validate lint check rubocop - PUPPET_GEM_VERSION: ~> 6.0 RUBY_VERSION: 25 diff --git a/manifests/backup.pp b/manifests/backup.pp index 5de320d..8b48da8 100644 --- a/manifests/backup.pp +++ b/manifests/backup.pp @@ -85,7 +85,7 @@ mode => '0640', owner => $ds_389::user, group => $ds_389::group, - content => inline_epp('<%= $pass %>',{pass => $root_dn_pass}), + content => inline_epp('<%= $pass %>',{ pass => $root_dn_pass }), show_diff => false, } @@ -98,18 +98,18 @@ # Command to perform all backup and cleanup tasks. $backup_command = join([ - # Create tasks to perform the backup. - 'dsconf', - "-D \'${root_dn}\'", - "-y \'${passfile}\'", - "${protocol}://${server_host}:${server_port}", - 'backup create', - $backup_dir, - # Create success file upon successful backup. - "&& touch ${success_file}", - # Command to remove outdated backups. No cleanup is performed if the - # backup fails. - "&& find \'${real_backup_dir}/\' -mindepth 1 -maxdepth 1 -mtime +${rotate} -print0 | xargs -0 -r rm -rf", + # Create tasks to perform the backup. + 'dsconf', + "-D \'${root_dn}\'", + "-y \'${passfile}\'", + "${protocol}://${server_host}:${server_port}", + 'backup create', + $backup_dir, + # Create success file upon successful backup. + "&& touch ${success_file}", + # Command to remove outdated backups. No cleanup is performed if the + # backup fails. + "&& find \'${real_backup_dir}/\' -mindepth 1 -maxdepth 1 -mtime +${rotate} -print0 | xargs -0 -r rm -rf", ], ' ') cron { "Backup job for ${server_id}: ${name}": diff --git a/manifests/install.pp b/manifests/install.pp index 3be337d..c2fde9e 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -23,12 +23,12 @@ # Support multiple package names by converting everything to an Array. $_packages = Array($ds_389::package_name, true) ensure_packages($_packages, - { - ensure => $ds_389::package_ensure, - require => [ - File['/etc/dirsrv'], - Exec['Create ldap cacerts directory'], - ], + { + ensure => $ds_389::package_ensure, + require => [ + File['/etc/dirsrv'], + Exec['Create ldap cacerts directory'], + ], }) package { $ds_389::nsstools_package_name: diff --git a/manifests/instance.pp b/manifests/instance.pp index 0f206e8..5355190 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -115,16 +115,16 @@ owner => $user, group => $group, content => epp("${module_name}/instance.epp",{ - create_suffix => $create_suffix, - group => $group, - root_dn => $root_dn, - root_dn_pass => $root_dn_pass, - server_host => $server_host, - server_id => $server_id, - server_port => $server_port, - server_ssl_port => $server_ssl_port, - suffix => $suffix, - user => $user, + create_suffix => $create_suffix, + group => $group, + root_dn => $root_dn, + root_dn_pass => $root_dn_pass, + server_host => $server_host, + server_id => $server_id, + server_port => $server_port, + server_ssl_port => $server_ssl_port, + suffix => $suffix, + user => $user, }), } @@ -296,7 +296,7 @@ # Fix permissions of CA private key. -> file { "Fix permissions of CA private key: ${server_id}": - ensure => 'present', + ensure => 'file', name => $ca_key, mode => '0640', owner => $user, @@ -305,11 +305,11 @@ # Create the OpenSSL config template for the CA cert. -> file { "Create CA config: ${server_id}": - ensure => 'present', + ensure => 'file', name => $ca_conf, content => epp('ds_389/openssl_ca.cnf.epp',{ - dc => $facts['networking']['fqdn'], - cn => $ca_nickname, + dc => $facts['networking']['fqdn'], + cn => $ca_nickname, }), } diff --git a/manifests/plugin.pp b/manifests/plugin.pp index cb2fd2c..85f299b 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -68,17 +68,17 @@ $plugin_done = "/etc/dirsrv/slapd-${server_id}/plugin_${name}_${ensure}.done" $plugin_command = join([ - # When changing plugin state, ensure that the flag for the opposite state - # is cleared. Otherwise it would not be possible to change the state again. - "rm -f ${plugin_clear_state};", - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "${protocol}://${server_host}:${server_port}", - 'plugin', - $name, - $plugin_action, - "&& touch ${plugin_done}", + # When changing plugin state, ensure that the flag for the opposite state + # is cleared. Otherwise it would not be possible to change the state again. + "rm -f ${plugin_clear_state};", + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "${protocol}://${server_host}:${server_port}", + 'plugin', + $name, + $plugin_action, + "&& touch ${plugin_done}", ], ' ') exec { "Set plugin ${name} state to ${ensure}: ${server_id}": @@ -96,7 +96,7 @@ owner => $ds_389::user, group => $ds_389::group, mode => '0440', - content => inline_epp('<%= $options %>', {options => $options}), + content => inline_epp('<%= $options %>', { options => $options }), } # Enable every option individually. This way conflicts can be avoided @@ -104,18 +104,18 @@ $options.each |$option| { # Command to set the specified plugin option. $plugin_option_command = join([ - # Rename the options file. This way a failed command is retried - # and if the error persists the user is encouraged to fix it. - "mv -f ${plugin_options_file} ${plugin_options_file}.error &&", - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "${protocol}://${server_host}:${server_port}", - 'plugin', - $name, - $option, - # If the plugin command succeeds, move the options file back. - "&& mv -f ${plugin_options_file}.error ${plugin_options_file}", + # Rename the options file. This way a failed command is retried + # and if the error persists the user is encouraged to fix it. + "mv -f ${plugin_options_file} ${plugin_options_file}.error &&", + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "${protocol}://${server_host}:${server_port}", + 'plugin', + $name, + $option, + # If the plugin command succeeds, move the options file back. + "&& mv -f ${plugin_options_file}.error ${plugin_options_file}", ], ' ') exec { "Set plugin ${name} options (${option}): ${server_id}": @@ -125,7 +125,6 @@ subscribe => File[$plugin_options_file], require => Exec["Set plugin ${name} state to ${ensure}: ${server_id}"], } - } } } diff --git a/manifests/replication.pp b/manifests/replication.pp index 145b685..ce1f004 100644 --- a/manifests/replication.pp +++ b/manifests/replication.pp @@ -161,61 +161,61 @@ # Command to enable replication for the specified suffix. $_repl_enable_done = "/etc/dirsrv/slapd-${name}/%s_%s_enable.done" $_repl_enable_command = join([ - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "${protocol}://${server_host}:${server_port}", - 'replication enable', - "--suffix \'${suffix}\'", - '--role=%s', - '--replica-id=%s', - "--bind-dn=\'${_bind_dn}\'", - "--bind-passwd=\'${replication_pass}\'", - '&& touch %s', + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "${protocol}://${server_host}:${server_port}", + 'replication enable', + "--suffix \'${suffix}\'", + '--role=%s', + '--replica-id=%s', + "--bind-dn=\'${_bind_dn}\'", + "--bind-passwd=\'${replication_pass}\'", + '&& touch %s', ], ' ') # Command to create a replication agreement between these hosts. $_repl_agreement_done = "/etc/dirsrv/slapd-${name}/%s_%s_agreement.done" $_repl_agreement_command = join([ - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "${protocol}://${server_host}:${server_port}", - 'repl-agmt create', - $attribute_list, - "--suffix=\'${suffix}\'", - "--host=\'%s\'", - "--port=${replica_port}", - "--conn-protocol=${replica_transport}", - "--bind-dn=\'${_bind_dn}\'", - "--bind-passwd=\'${replication_pass}\'", - '--bind-method=SIMPLE', - "\'${name} to %s agreement\'", - '&& touch %s', + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "${protocol}://${server_host}:${server_port}", + 'repl-agmt create', + $attribute_list, + "--suffix=\'${suffix}\'", + "--host=\'%s\'", + "--port=${replica_port}", + "--conn-protocol=${replica_transport}", + "--bind-dn=\'${_bind_dn}\'", + "--bind-passwd=\'${replication_pass}\'", + '--bind-method=SIMPLE', + "\'${name} to %s agreement\'", + '&& touch %s', ], ' ') # Command to update parameters of the replication agreement. # TODO: Should be refactored to allow parameters to be changed. $_repl_update_command = join([ - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "${protocol}://${server_host}:${server_port}", - 'replication set', - "--suffix=\'${suffix}\'", - "--repl-purge-delay=\'${purge_delay}\'", + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "${protocol}://${server_host}:${server_port}", + 'replication set', + "--suffix=\'${suffix}\'", + "--repl-purge-delay=\'${purge_delay}\'", ], ' ') $_repl_init_done = "/etc/dirsrv/slapd-${name}/%s_%s_init.done" $_repl_init_command = join([ - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "${protocol}://${server_host}:${server_port}", - 'repl-agmt init', - "--suffix=\'${suffix}\'", - "\'${name} to %s agreement\'", - '&& touch %s', + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "${protocol}://${server_host}:${server_port}", + 'repl-agmt init', + "--suffix=\'${suffix}\'", + "\'${name} to %s agreement\'", + '&& touch %s', ], ' ') case $role { @@ -517,9 +517,9 @@ owner => $user, group => $group, content => epp('ds_389/replication-user.epp',{ - bind_dn => $_bind_dn, - replication_pass => $replication_pass, - replication_user => $replication_user, + bind_dn => $_bind_dn, + replication_pass => $replication_pass, + replication_user => $replication_user, }), } -> exec { "Add replication user: ${name}": diff --git a/manifests/service.pp b/manifests/service.pp index 5982dd3..a0c551c 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -26,7 +26,7 @@ ensure => file, mode => '0755', content => epp('ds_389/service-init.epp',{ - name => $name, + name => $name, }), } service { "dirsrv@${name}": diff --git a/manifests/ssl.pp b/manifests/ssl.pp index 336989b..8b7ba51 100644 --- a/manifests/ssl.pp +++ b/manifests/ssl.pp @@ -60,30 +60,30 @@ $security_enable_done = "/etc/dirsrv/slapd-${name}/ssl_enable.done" $security_enable_command = join([ - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "ldap://${server_host}:${server_port}", - 'config replace', - "nsslapd-securePort=${server_ssl_port}", - 'nsslapd-security=on', - "nsslapd-minssf=${minssf}", - 'nsslapd-SSLclientAuth=off', - "&& touch ${security_enable_done}", + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "ldap://${server_host}:${server_port}", + 'config replace', + "nsslapd-securePort=${server_ssl_port}", + 'nsslapd-security=on', + "nsslapd-minssf=${minssf}", + 'nsslapd-SSLclientAuth=off', + "&& touch ${security_enable_done}", ], ' ') $security_config_done = "/etc/dirsrv/slapd-${name}/ssl_config.done" $security_config_command = join([ - 'dsconf', - "-D \'${root_dn}\'", - "-w \'${root_dn_pass}\'", - "ldap://${server_host}:${server_port}", - 'security rsa set', - '--tls-allow-rsa-certificates on', - '--nss-token "internal (software)"', - "--nss-cert-name ${cert_name}", -# "--tls-protocol-min ${ssl_version_min}", - "&& touch ${security_config_done}", + 'dsconf', + "-D \'${root_dn}\'", + "-w \'${root_dn_pass}\'", + "ldap://${server_host}:${server_port}", + 'security rsa set', + '--tls-allow-rsa-certificates on', + '--nss-token "internal (software)"', + "--nss-cert-name ${cert_name}", +# "--tls-protocol-min ${ssl_version_min}", + "&& touch ${security_config_done}", ], ' ') # NOTE: This ensures that the status is not lost when migrating from @@ -108,7 +108,7 @@ group => $group, mode => '0440', content => epp('ds_389/ssl.epp',{ - ssl_version_min => $ssl_version_min, + ssl_version_min => $ssl_version_min, }), } -> exec { "Import ssl ldif: ${name}": diff --git a/metadata.json b/metadata.json index ed58800..4b5c08b 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "fraenki-ds_389", - "version": "2.5.0", + "version": "2.6.0", "author": "markt.de", "summary": "Module for installing and managing 389 Directory Server", "license": "Apache-2.0", @@ -10,44 +10,51 @@ "dependencies": [ { "name": "puppetlabs-concat", - "version_requirement": ">=4.0.0 <7.0.0" + "version_requirement": ">=7.0.0 <8.0.0" }, { "name": "puppetlabs-inifile", - "version_requirement": ">=3.0.0 <5.0.0" + "version_requirement": ">=5.0.0 <6.0.0" }, { "name": "camptocamp-openssl", - "version_requirement": ">=1.14.0 <2.0.0" + "version_requirement": ">=1.14.0 <3.0.0" }, { "name": "puppetlabs-stdlib", - "version_requirement": ">=4.25.0 <7.0.0" + "version_requirement": ">=7.0.0 <9.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "CentOS", "operatingsystemrelease": [ - "8" + "7", + "8", + "9" ] }, { "operatingsystem": "RedHat", "operatingsystemrelease": [ - "8" + "7", + "8", + "9" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ - "10" + "10", + "11" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ - "20.04" + "18.04", + "20.04", + "22.04" ] } ], @@ -63,7 +70,7 @@ "ldaps", "port389" ], - "pdk-version": "1.18.1", - "template-url": "pdk-default#1.18.1", - "template-ref": "tags/1.18.1-0-g3d2e75c" + "pdk-version": "2.5.0", + "template-url": "pdk-default#2.5.0", + "template-ref": "tags/2.5.0-0-g369d483" } diff --git a/pdk.yaml b/pdk.yaml new file mode 100644 index 0000000..4bef4bd --- /dev/null +++ b/pdk.yaml @@ -0,0 +1,2 @@ +--- +ignore: [] diff --git a/spec/classes/ds389_spec.rb b/spec/classes/ds389_spec.rb index 0428884..f132a3f 100644 --- a/spec/classes/ds389_spec.rb +++ b/spec/classes/ds389_spec.rb @@ -44,7 +44,7 @@ it { is_expected.to contain_package('389-ds-base').with( - ensure: 'present', + ensure: 'installed', ).that_requires( [ 'File[/etc/dirsrv]', @@ -97,7 +97,7 @@ } else it { - is_expected.to contain_file_line('dirsrv ulimit').with( + is_expected.to contain_File_line('dirsrv ulimit').with( ensure: 'present', path: '/etc/default/dirsrv', line: 'ulimit -n 8192', @@ -175,7 +175,7 @@ it { is_expected.to contain_package('389-ds-custom').with( - ensure: 'present', + ensure: 'installed', ).that_requires( [ 'File[/etc/dirsrv]', @@ -245,7 +245,7 @@ it { is_expected.to contain_file('Create CA config: foo').with( - ensure: 'present', + ensure: 'file', content: openssl_ca_cnf, ) } diff --git a/spec/defines/backup_spec.rb b/spec/defines/backup_spec.rb index 0e21a06..8cb39e6 100644 --- a/spec/defines/backup_spec.rb +++ b/spec/defines/backup_spec.rb @@ -38,7 +38,7 @@ it { is_expected.to contain_cron('Backup job for specdirectory: specbackup').with( command: "dsconf -D 'cn=Directory Manager' -y '/etc/dirsrv/slapd-specdirectory/backup_passwd.specbackup' ldaps://foo.example.com:636 backup create && touch /tmp/389ds_backup_success && find '/var/lib/dirsrv/slapd-specdirectory/bak/' -mindepth 1 -maxdepth 1 -mtime +30 -print0 | xargs -0 -r rm -rf", # rubocop:disable LineLength - environment: ["PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"], + environment: ['PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin'], user: 'dirsrv', minute: '15', hour: '23', @@ -118,7 +118,7 @@ it { is_expected.to contain_cron('Backup job for specdirectory: specbackup').with( command: "dsconf -D 'cn=Directory Manager' -y '/etc/dirsrv/slapd-specdirectory/backup_passwd.specbackup' ldap://ldap.test.org:1389 backup create /path/to/ds-backups && touch /tmp/hourly_backup_success && find '/path/to/ds-backups/' -mindepth 1 -maxdepth 1 -mtime +10 -print0 | xargs -0 -r rm -rf", # rubocop:disable LineLength - environment: ["MAILTO=admin@example.com","PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin"], + environment: ['MAILTO=admin@example.com", "PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin'], user: 'dirsrv', minute: '0', hour: '*', diff --git a/spec/defines/replication_spec.rb b/spec/defines/replication_spec.rb index 4ee1a8c..e73a818 100644 --- a/spec/defines/replication_spec.rb +++ b/spec/defines/replication_spec.rb @@ -379,7 +379,7 @@ it { is_expected.to contain_exec('Update replication config for consumer consumer1: specdirectory').with( - command: "dsconf -D 'cn=Directory Manager' -w 'supersecure' ldap://foo.example.com:389 replication set --suffix='dc=example,dc=com' --repl-purge-delay='604800'", # rubocop:disable LineLength + command: "dsconf -D 'cn=Directory Manager' -w 'supersecure' ldap://foo.example.com:389 replication set --suffix='dc=example,dc=com' --repl-purge-delay='604800'", path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) @@ -478,7 +478,7 @@ it { is_expected.to contain_exec('Update replication config for consumer consumer1: specdirectory').with( - command: "dsconf -D 'cn=Directory Manager' -w 'supersecure' ldaps://ldap.test.org:1636 replication set --suffix='dc=test,dc=org' --repl-purge-delay='604800'", # rubocop:disable LineLength + command: "dsconf -D 'cn=Directory Manager' -w 'supersecure' ldaps://ldap.test.org:1636 replication set --suffix='dc=test,dc=org' --repl-purge-delay='604800'", path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) @@ -623,7 +623,7 @@ it { is_expected.to contain_exec('Update replication config for consumer consumer1: specdirectory').with( - command: "dsconf -D 'cn=Directory Manager' -w 'supersecure' ldap://foo.example.com:389 replication set --suffix='dc=example,dc=com' --repl-purge-delay='604800'", # rubocop:disable LineLength + command: "dsconf -D 'cn=Directory Manager' -w 'supersecure' ldap://foo.example.com:389 replication set --suffix='dc=example,dc=com' --repl-purge-delay='604800'", path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', refreshonly: true, ) diff --git a/spec/defines/ssl_spec.rb b/spec/defines/ssl_spec.rb index 9b863be..8e6068a 100644 --- a/spec/defines/ssl_spec.rb +++ b/spec/defines/ssl_spec.rb @@ -87,7 +87,7 @@ it { is_expected.to contain_exec('Import ssl ldif: specdirectory').with( - command: 'ldapmodify -xH ldap://foo.example.com:389 -D "cn=Directory Manager" -w supersecure -f /etc/dirsrv/slapd-specdirectory/ssl.ldif && touch /etc/dirsrv/slapd-specdirectory/ssl.done', # rubocop:disable LineLength + command: 'ldapmodify -xH ldap://foo.example.com:389 -D "cn=Directory Manager" -w supersecure -f /etc/dirsrv/slapd-specdirectory/ssl.ldif && touch /etc/dirsrv/slapd-specdirectory/ssl.done', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-specdirectory/ssl.done', ).that_requires('File[/etc/dirsrv/slapd-specdirectory/ssl.ldif]').that_notifies( @@ -199,7 +199,7 @@ it { is_expected.to contain_exec('Import ssl ldif: ldap01').with( - command: 'ldapmodify -xH ldap://ldap.test.org:1389 -D "cn=Directory Manager" -w supersecure -f /etc/dirsrv/slapd-ldap01/ssl.ldif && touch /etc/dirsrv/slapd-ldap01/ssl.done', # rubocop:disable LineLength + command: 'ldapmodify -xH ldap://ldap.test.org:1389 -D "cn=Directory Manager" -w supersecure -f /etc/dirsrv/slapd-ldap01/ssl.ldif && touch /etc/dirsrv/slapd-ldap01/ssl.done', path: '/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin', creates: '/etc/dirsrv/slapd-ldap01/ssl.done', ).that_requires('File[/etc/dirsrv/slapd-ldap01/ssl.ldif]').that_notifies( diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index d3778ca..9b1fa6f 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,5 +1,9 @@ # frozen_string_literal: true +RSpec.configure do |c| + c.mock_with :rspec +end + require 'puppetlabs_spec_helper/module_spec_helper' require 'rspec-puppet-facts' @@ -43,6 +47,18 @@ c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] c.after(:suite) do end + + # Filter backtrace noise + backtrace_exclusion_patterns = [ + %r{spec_helper}, + %r{gems}, + ] + + if c.respond_to?(:backtrace_exclusion_patterns) + c.backtrace_exclusion_patterns = backtrace_exclusion_patterns + elsif c.respond_to?(:backtrace_clean_patterns) + c.backtrace_clean_patterns = backtrace_exclusion_patterns + end end # Ensures that a module is defined diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index aabeb0b..ed7412a 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -29,7 +29,6 @@ options[:keys] = node_config.dig('ssh', 'private-key') unless node_config.dig('ssh', 'private-key').nil? options[:password] = node_config.dig('ssh', 'password') unless node_config.dig('ssh', 'password').nil? # Support both net-ssh 4 and 5. - # rubocop:disable Metrics/BlockNesting options[:verify_host_key] = if node_config.dig('ssh', 'host-key-check').nil? # Fall back to SSH behavior. This variable will only be set in net-ssh 5.3+. if @strict_host_key_checking.nil? || @strict_host_key_checking