diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index d59437aab0..4021da7645 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -17,7 +17,7 @@ jobs: steps: - name: "Honeycomb: Start recording" - uses: kvrhdn/gha-buildevents@v1.0.2 + uses: kvrhdn/gha-buildevents@5be4636b81803713c94d7cb7e3a4b85d759df112 # pin@v1.0.2 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} @@ -90,7 +90,7 @@ jobs: echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE - name: "Honeycomb: Start recording" - uses: kvrhdn/gha-buildevents@v1.0.2 + uses: kvrhdn/gha-buildevents@5be4636b81803713c94d7cb7e3a4b85d759df112 # pin@v1.0.2 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} @@ -155,26 +155,13 @@ jobs: sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true echo ::endgroup:: - # The provision service hands out machines as soon as they're provisioned. - # The GCP VMs might still take a while to spool up and configure themselves fully. - # This retry loop spins until all agents have been installed successfully. - name: Install agent - uses: nick-invision/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 5 - retry_wait_seconds: 60 - command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' - # The agent installer on windows does not finish in time for this to work. To - # work around this for now, retry after a minute if installing the module failed. - name: Install module - uses: nick-invision/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 2 - retry_wait_seconds: 60 - command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' - name: "Honeycomb: Record deployment times" if: ${{ always() }} @@ -220,7 +207,7 @@ jobs: runs-on: ubuntu-20.04 steps: - name: Slack Workflow Notification - uses: Gamesight/slack-workflow-status@master + uses: Gamesight/slack-workflow-status@88ee95b73b4669825883ddf22747966204663e58 # pin@master with: # Required Input repo_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index 17f5a649b3..2b5ab1f576 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -15,7 +15,7 @@ jobs: steps: - name: "Honeycomb: Start recording" - uses: kvrhdn/gha-buildevents@v1.0.2 + uses: kvrhdn/gha-buildevents@5be4636b81803713c94d7cb7e3a4b85d759df112 # pin@v1.0.2 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} @@ -88,7 +88,7 @@ jobs: echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE - name: "Honeycomb: Start recording" - uses: kvrhdn/gha-buildevents@v1.0.2 + uses: kvrhdn/gha-buildevents@5be4636b81803713c94d7cb7e3a4b85d759df112 # pin@v1.0.2 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} @@ -153,26 +153,13 @@ jobs: sed -e 's/password: .*/password: "[redacted]"/' < inventory.yaml || true echo ::endgroup:: - # The provision service hands out machines as soon as they're provisioned. - # The GCP VMs might still take a while to spool up and configure themselves fully. - # This retry loop spins until all agents have been installed successfully. - name: Install agent - uses: nick-invision/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 5 - retry_wait_seconds: 60 - command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' - # The agent installer on windows does not finish in time for this to work. To - # work around this for now, retry after a minute if installing the module failed. - name: Install module - uses: nick-invision/retry@v1 - with: - timeout_minutes: 30 - max_attempts: 2 - retry_wait_seconds: 60 - command: buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' + run: | + buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' - name: "Honeycomb: Record deployment times" if: ${{ always() }} diff --git a/.rubocop.yml b/.rubocop.yml index b7c972b286..3479f61a76 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,12 +1,12 @@ --- require: +- rubocop-performance - rubocop-rspec -- rubocop-i18n AllCops: DisplayCopNames: true - TargetRubyVersion: '2.1' + TargetRubyVersion: '2.4' Include: - - "./**/*.rb" + - "**/*.rb" Exclude: - bin/* - ".vendor/**/*" @@ -18,16 +18,10 @@ AllCops: - "**/Puppetfile" - "**/Vagrantfile" - "**/Guardfile" -Metrics/LineLength: +inherit_from: ".rubocop_todo.yml" +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. @@ -40,10 +34,6 @@ Style/BlockDelimiters: Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to be consistent then. EnforcedStyle: braces_for_chaining -Style/BracesAroundHashParameters: - Description: Braces are required by Ruby 2.7. Cop removed from RuboCop v0.80.0. - See https://github.com/rubocop-hq/rubocop/pull/7643 - Enabled: false Style/ClassAndModuleChildren: Description: Compact style reduces the required amount of indentation. EnforcedStyle: compact @@ -72,14 +62,13 @@ 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 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: @@ -88,21 +77,221 @@ Style/Documentation: - spec/**/* Style/WordArray: EnforcedStyle: brackets +Performance/AncestorsInclude: + Enabled: true +Performance/BigDecimalWithNumericArgument: + Enabled: true +Performance/BlockGivenWithExplicitBlock: + Enabled: true +Performance/Caller: + Enabled: true +Performance/CaseWhenSplat: + Enabled: true +Performance/Casecmp: + Enabled: true +Performance/CollectionLiteralInLoop: + Exclude: + - spec/**/* + Enabled: true +Performance/CompareWithBlock: + Enabled: true +Performance/ConstantRegexp: + Enabled: true +Performance/Count: + Enabled: true +Performance/Detect: + Enabled: true +Performance/DoubleStartEndWith: + Enabled: true +Performance/EndWith: + Enabled: true +Performance/FixedSize: + Enabled: true +Performance/FlatMap: + Enabled: true +Performance/MethodObjectAsBlock: + Enabled: true +Performance/RangeInclude: + Enabled: true +Performance/RedundantBlockCall: + Enabled: true +Performance/RedundantMatch: + Enabled: true +Performance/RedundantMerge: + Enabled: true +Performance/RedundantSortBlock: + Enabled: true +Performance/RedundantStringChars: + Enabled: true +Performance/RegexpMatch: + Enabled: true +Performance/ReverseEach: + Enabled: true +Performance/ReverseFirst: + Enabled: true +Performance/Size: + Enabled: true +Performance/SortReverse: + Enabled: true +Performance/Squeeze: + Enabled: true +Performance/StartWith: + Enabled: true +Performance/StringInclude: + Enabled: true +Performance/StringReplacement: + Enabled: true +Performance/Sum: + Enabled: true +Performance/TimesMap: + 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 -GetText/DecorateStringFormattingUsingInterpolation: +Layout/ClosingHeredocIndentation: Enabled: false -GetText/DecorateStringFormattingUsingPercent: +Layout/EmptyComment: + Enabled: false +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/DuplicateBranch: + Enabled: false +Lint/DuplicateElsifCondition: + Enabled: false +Lint/DuplicateRegexpCharacterClassElement: + Enabled: false +Lint/DuplicateRequire: + Enabled: false +Lint/DuplicateRescueException: + Enabled: false +Lint/EmptyBlock: + Enabled: false +Lint/EmptyClass: + 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/NoReturnInBeginEndBlocks: + 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/ToEnumArguments: + Enabled: false +Lint/ToJSON: + Enabled: false +Lint/TopLevelReturnWithArgument: + Enabled: false +Lint/TrailingCommaInAttributeDeclaration: + Enabled: false +Lint/UnexpectedBlockArity: + Enabled: false +Lint/UnmodifiedReduceAccumulator: + 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 @@ -120,19 +309,231 @@ 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 +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/ArgumentsForwarding: + Enabled: false Style/AsciiComments: Enabled: false +Style/BisectedAttrAccessor: + Enabled: false +Style/CaseLikeIf: + Enabled: false +Style/ClassEqualityComparison: + Enabled: false +Style/CollectionCompact: + Enabled: false +Style/ColonMethodDefinition: + Enabled: false +Style/CombinableLoops: + Enabled: false +Style/CommentedKeyword: + Enabled: false +Style/Dir: + Enabled: false +Style/DocumentDynamicEvalDefinition: + 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/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/NegatedIfElseCondition: + Enabled: false +Style/NegatedUnless: + Enabled: false +Style/NilLambda: + Enabled: false +Style/NumericPredicate: + Enabled: false +Style/OptionalBooleanParameter: + Enabled: false +Style/OrAssignment: + Enabled: false +Style/RandomWithOffset: + Enabled: false +Style/RedundantArgument: + 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/SwapValues: + 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 diff --git a/.sync.yml b/.sync.yml index e34552f80a..76e371572f 100644 --- a/.sync.yml +++ b/.sync.yml @@ -2,10 +2,9 @@ ".gitlab-ci.yml": delete: true ".rubocop.yml": - default_configs: - inherit_from: ".rubocop_todo.yml" + include_todos: true ".travis.yml": - global_env: + global_env: - HONEYCOMB_WRITEKEY="7f3c63a70eecc61d635917de46bea4e6",HONEYCOMB_DATASET="litmus tests" deploy_to_forge: enabled: false @@ -40,12 +39,6 @@ Gemfile: optional: ":development": - gem: github_changelog_generator - git: https://github.com/skywinder/github-changelog-generator - ref: 20ee04ba1234e9e83eb2ffb5056e23d641c7a018 - condition: Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') -Rakefile: - requires: - - puppet-lint/tasks/puppet-lint spec/spec_helper.rb: mock_with: ":rspec" coverage_report: true diff --git a/.travis.yml b/.travis.yml index c08233a4c8..52dc74b763 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,89 +27,81 @@ stages: jobs: fast_finish: true include: - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_ub_6]'" - "bundle exec rake 'litmus:install_agent[puppet6]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_ub_6_puppet6 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_ub_5]'" - "bundle exec rake 'litmus:install_agent[puppet5]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_ub_5_puppet5 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_deb]'" - "bundle exec rake 'litmus:install_agent[puppet5]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_deb_puppet5 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_el7]'" - "bundle exec rake 'litmus:install_agent[puppet5]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_el7_puppet5 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_el8]'" - "bundle exec rake 'litmus:install_agent[puppet5]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_el8_puppet5 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_deb]'" - "bundle exec rake 'litmus:install_agent[puppet6]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_deb_puppet6 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests before_script: - "bundle exec rake 'litmus:provision_list[travis_el7]'" - "bundle exec rake 'litmus:install_agent[puppet6]'" - "bundle exec rake litmus:install_module" - bundler_args: env: PLATFORMS=travis_el7_puppet6 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] services: docker stage: acceptance - - + - bundler_args: --with system_tests 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: env: PLATFORMS=travis_el8_puppet6 rvm: 2.5.7 script: ["travis_wait 45 bundle exec rake litmus:acceptance:parallel"] diff --git a/Gemfile b/Gemfile index b6b25afe48..ae2b430dc2 100644 --- a/Gemfile +++ b/Gemfile @@ -17,19 +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 "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 "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 "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2') + gem "puppet-module-posix-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] + gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "github_changelog_generator", require: false +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'] diff --git a/Rakefile b/Rakefile index 11539b96b0..0a5093b33a 100644 --- a/Rakefile +++ b/Rakefile @@ -6,7 +6,6 @@ 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? -require 'puppet-lint/tasks/puppet-lint' def changelog_user return unless Rake.application.top_level_tasks.include? "changelog" diff --git a/lib/facter/apache_version.rb b/lib/facter/apache_version.rb index ec577ca52c..bb16670dbf 100644 --- a/lib/facter/apache_version.rb +++ b/lib/facter/apache_version.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Facter.add(:apache_version) do confine kernel: ['FreeBSD', 'Linux'] setcode do diff --git a/lib/puppet/functions/apache/apache_pw_hash.rb b/lib/puppet/functions/apache/apache_pw_hash.rb index 019db01822..4606ac7312 100644 --- a/lib/puppet/functions/apache/apache_pw_hash.rb +++ b/lib/puppet/functions/apache/apache_pw_hash.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # @summary DEPRECATED. Use the function [`apache::pw_hash`](#apachepw_hash) instead. Puppet::Functions.create_function(:'apache::apache_pw_hash') do dispatch :deprecation_gen do diff --git a/lib/puppet/functions/apache/bool2httpd.rb b/lib/puppet/functions/apache/bool2httpd.rb index a8b2cb473e..1fb71c590c 100644 --- a/lib/puppet/functions/apache/bool2httpd.rb +++ b/lib/puppet/functions/apache/bool2httpd.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # @summary # Transform a supposed boolean to On or Off. Passes all other values through. # diff --git a/lib/puppet/functions/apache/pw_hash.rb b/lib/puppet/functions/apache/pw_hash.rb index 60a41c240f..c56e916b9e 100644 --- a/lib/puppet/functions/apache/pw_hash.rb +++ b/lib/puppet/functions/apache/pw_hash.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # @summary # Hashes a password in a format suitable for htpasswd files read by apache. # diff --git a/lib/puppet/functions/apache_pw_hash.rb b/lib/puppet/functions/apache_pw_hash.rb index 2fd9cf8292..7aad4400df 100644 --- a/lib/puppet/functions/apache_pw_hash.rb +++ b/lib/puppet/functions/apache_pw_hash.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # @summary DEPRECATED. Use the namespaced function [`apache::pw_hash`](#apachepw_hash) instead. Puppet::Functions.create_function(:apache_pw_hash) do dispatch :deprecation_gen do diff --git a/lib/puppet/functions/bool2httpd.rb b/lib/puppet/functions/bool2httpd.rb index af5b5c5d55..62569f7bb4 100644 --- a/lib/puppet/functions/bool2httpd.rb +++ b/lib/puppet/functions/bool2httpd.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # @summary DEPRECATED. Use the namespaced function [`apache::bool2httpd`](#apachebool2httpd) instead. Puppet::Functions.create_function(:bool2httpd) do dispatch :deprecation_gen do diff --git a/lib/puppet/provider/a2mod.rb b/lib/puppet/provider/a2mod.rb index 747da44a91..7406e01da3 100644 --- a/lib/puppet/provider/a2mod.rb +++ b/lib/puppet/provider/a2mod.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # a2mod.rb class Puppet::Provider::A2mod < Puppet::Provider # Fetches the mod provider diff --git a/lib/puppet/provider/a2mod/a2mod.rb b/lib/puppet/provider/a2mod/a2mod.rb index 8b18686f8e..3330fd5dcc 100644 --- a/lib/puppet/provider/a2mod/a2mod.rb +++ b/lib/puppet/provider/a2mod/a2mod.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet/provider/a2mod' Puppet::Type.type(:a2mod).provide(:a2mod, parent: Puppet::Provider::A2mod) do diff --git a/lib/puppet/provider/a2mod/gentoo.rb b/lib/puppet/provider/a2mod/gentoo.rb index d4c0b6d612..c53fbd5b6e 100644 --- a/lib/puppet/provider/a2mod/gentoo.rb +++ b/lib/puppet/provider/a2mod/gentoo.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet/util/filetype' Puppet::Type.type(:a2mod).provide(:gentoo, parent: Puppet::Provider) do desc 'Manage Apache 2 modules on Gentoo' diff --git a/lib/puppet/provider/a2mod/modfix.rb b/lib/puppet/provider/a2mod/modfix.rb index 59fdc9296a..755c927e45 100644 --- a/lib/puppet/provider/a2mod/modfix.rb +++ b/lib/puppet/provider/a2mod/modfix.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.type(:a2mod).provide :modfix do desc "Dummy provider for A2mod. Fake nil resources when there is no crontab binary available. Allows diff --git a/lib/puppet/provider/a2mod/redhat.rb b/lib/puppet/provider/a2mod/redhat.rb index 6b063779b7..149a7b909b 100644 --- a/lib/puppet/provider/a2mod/redhat.rb +++ b/lib/puppet/provider/a2mod/redhat.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'puppet/provider/a2mod' Puppet::Type.type(:a2mod).provide(:redhat, parent: Puppet::Provider::A2mod) do diff --git a/lib/puppet/type/a2mod.rb b/lib/puppet/type/a2mod.rb index 0251698964..da04d7f4d8 100644 --- a/lib/puppet/type/a2mod.rb +++ b/lib/puppet/type/a2mod.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Puppet::Type.newtype(:a2mod) do @doc = 'Manage Apache 2 modules' diff --git a/metadata.json b/metadata.json index 302cd902e8..2209cd261f 100644 --- a/metadata.json +++ b/metadata.json @@ -83,5 +83,5 @@ "description": "Module for Apache configuration", "pdk-version": "1.18.1", "template-url": "https://github.com/puppetlabs/pdk-templates#main", - "template-ref": "heads/main-0-g5afcd3d" + "template-ref": "heads/main-0-g4543421" } diff --git a/spec/acceptance/apache_parameters_spec.rb b/spec/acceptance/apache_parameters_spec.rb index 1d7b9c1013..cfad4f5faf 100644 --- a/spec/acceptance/apache_parameters_spec.rb +++ b/spec/acceptance/apache_parameters_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache parameters' do diff --git a/spec/acceptance/apache_ssl_spec.rb b/spec/acceptance/apache_ssl_spec.rb index c67afcd811..416b31f73b 100644 --- a/spec/acceptance/apache_ssl_spec.rb +++ b/spec/acceptance/apache_ssl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache ssl' do @@ -21,7 +23,7 @@ class { 'apache': describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do it { is_expected.to be_file } - if os[:family] =~ %r{redhat} && os[:release].to_i == 8 + if os[:family].include?('redhat') && os[:release].to_i == 8 it { is_expected.to contain 'SSLProtocol all' } else it { is_expected.to contain 'SSLProtocol all -SSLv2 -SSLv3' } diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 1a6deac80c..3a204e5fe2 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache class' do diff --git a/spec/acceptance/custom_config_spec.rb b/spec/acceptance/custom_config_spec.rb index 52b58fe136..94754240ea 100644 --- a/spec/acceptance/custom_config_spec.rb +++ b/spec/acceptance/custom_config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache::custom_config define' do diff --git a/spec/acceptance/default_mods_spec.rb b/spec/acceptance/default_mods_spec.rb index 4093ec0b1a..8653aafd59 100644 --- a/spec/acceptance/default_mods_spec.rb +++ b/spec/acceptance/default_mods_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache::default_mods class' do diff --git a/spec/acceptance/init_task_spec.rb b/spec/acceptance/init_task_spec.rb index 3405c62d4c..bfe8c34b6b 100644 --- a/spec/acceptance/init_task_spec.rb +++ b/spec/acceptance/init_task_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'apache tasks' do diff --git a/spec/acceptance/itk_spec.rb b/spec/acceptance/itk_spec.rb index 9efe7f459d..2283e00b01 100644 --- a/spec/acceptance/itk_spec.rb +++ b/spec/acceptance/itk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' case os[:family] @@ -5,7 +7,7 @@ service_name = 'apache2' variant = :prefork when 'redhat' - unless os[:release] =~ %r{^5} + unless %r{^5}.match?(os[:release]) variant = (os[:release].to_i >= 7) ? :prefork : :itk_only service_name = 'httpd' end diff --git a/spec/acceptance/mod_apreq2_spec.rb b/spec/acceptance/mod_apreq2_spec.rb index 19c14ca7e2..0708ea7068 100644 --- a/spec/acceptance/mod_apreq2_spec.rb +++ b/spec/acceptance/mod_apreq2_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' _apache_hash = apache_settings_hash diff --git a/spec/acceptance/mod_authnz_ldap_spec.rb b/spec/acceptance/mod_authnz_ldap_spec.rb index be4bbb7b8b..ef59b6a5b0 100644 --- a/spec/acceptance/mod_authnz_ldap_spec.rb +++ b/spec/acceptance/mod_authnz_ldap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash diff --git a/spec/acceptance/mod_ldap_spec.rb b/spec/acceptance/mod_ldap_spec.rb index 0fabfe6bcc..2924046a7b 100644 --- a/spec/acceptance/mod_ldap_spec.rb +++ b/spec/acceptance/mod_ldap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash diff --git a/spec/acceptance/mod_md_spec.rb b/spec/acceptance/mod_md_spec.rb index 5bf0c1dc7d..047c7c5116 100644 --- a/spec/acceptance/mod_md_spec.rb +++ b/spec/acceptance/mod_md_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'apache::mod::md', if: mod_supported_on_platform?('apache::mod::md') do diff --git a/spec/acceptance/mod_php_spec.rb b/spec/acceptance/mod_php_spec.rb index ab660f9534..b95f738542 100644 --- a/spec/acceptance/mod_php_spec.rb +++ b/spec/acceptance/mod_php_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash @@ -23,11 +25,11 @@ class { 'apache::mod::php': } end if (os[:family] == 'ubuntu' && os[:release] == '16.04') || - (os[:family] == 'debian' && os[:release] =~ %r{9}) + (os[:family] == 'debian' && os[:release] =~ %r{^9\.}) describe file("#{apache_hash['mod_dir']}/php7.0.conf") do it { is_expected.to contain 'DirectoryIndex index.php' } end - elsif os[:family] == 'debian' && os[:release] =~ %r{10} + elsif os[:family] == 'debian' && os[:release] =~ %r{^10\.} describe file("#{apache_hash['mod_dir']}/php7.3.conf") do it { is_expected.to contain 'DirectoryIndex index.php' } end @@ -39,7 +41,7 @@ class { 'apache::mod::php': } describe file("#{apache_hash['mod_dir']}/php7.4.conf") do it { is_expected.to contain 'DirectoryIndex index.php' } end - elsif os[:family] == 'redhat' && os[:release] =~ %r{^8} + elsif os[:family] == 'redhat' && os[:release] =~ %r{^8\.} describe file("#{apache_hash['mod_dir']}/php7.conf") do it { is_expected.to contain 'DirectoryIndex index.php' } end diff --git a/spec/acceptance/prefork_worker_spec.rb b/spec/acceptance/prefork_worker_spec.rb index 6b64d19c5b..d6bc2239f7 100644 --- a/spec/acceptance/prefork_worker_spec.rb +++ b/spec/acceptance/prefork_worker_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'prefork_worker_spec.rb', if: mod_supported_on_platform?('apache::mod::event') do diff --git a/spec/acceptance/service_spec.rb b/spec/acceptance/service_spec.rb index bcb204c520..d4442fe25b 100644 --- a/spec/acceptance/service_spec.rb +++ b/spec/acceptance/service_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' describe 'apache::service class' do diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 888376e0f6..1b8250c00e 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache::vhost define' do @@ -49,7 +51,7 @@ class { 'apache': } end end - context 'default vhost with ssl', unless: (os[:family] =~ %r{redhat} && os[:release].to_i == 8) do + context 'default vhost with ssl', unless: (os[:family].include?('redhat') && os[:release].to_i == 8) do pp = <<-MANIFEST file { '#{apache_hash['run_dir']}': ensure => 'directory', @@ -1081,7 +1083,7 @@ class { 'apache': } } MANIFEST it 'applies cleanly' do - pp += "\nclass { 'apache::mod::actions': }" if os[:family] =~ %r{debian|suse|ubuntu|sles} + pp += "\nclass { 'apache::mod::actions': }" if %r{debian|suse|ubuntu|sles}.match?(os[:family]) apply_manifest(pp, catch_failures: true) end diff --git a/spec/acceptance/vhosts_spec.rb b/spec/acceptance/vhosts_spec.rb index 3051700352..90dc8c99f4 100644 --- a/spec/acceptance/vhosts_spec.rb +++ b/spec/acceptance/vhosts_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper_acceptance' apache_hash = apache_settings_hash describe 'apache::vhosts class' do diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index a9a6952685..11865838f4 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache', type: :class do @@ -620,7 +622,7 @@ it 'fails' do expect { catalogue - }.to raise_error(Puppet::PreformattedError, %r{Evaluation Error: Error while evaluating a Resource Statement, Class\[Apache\]: parameter 'sendfile' expects a match for Enum\['Off', 'On', 'off', 'on'\]}) # rubocop:disable Metrics/LineLength + }.to raise_error(Puppet::PreformattedError, %r{Evaluation Error: Error while evaluating a Resource Statement, Class\[Apache\]: parameter 'sendfile' expects a match for Enum\['Off', 'On', 'off', 'on'\]}) # rubocop:disable Layout/LineLength end end describe 'sendfile On' do diff --git a/spec/classes/dev_spec.rb b/spec/classes/dev_spec.rb index 7ef4281f84..96ec70aabc 100644 --- a/spec/classes/dev_spec.rb +++ b/spec/classes/dev_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::dev' do diff --git a/spec/classes/mod/alias_spec.rb b/spec/classes/mod/alias_spec.rb index fc0a84f1cb..4974211ce0 100644 --- a/spec/classes/mod/alias_spec.rb +++ b/spec/classes/mod/alias_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::alias', type: :class do diff --git a/spec/classes/mod/auth_cas_spec.rb b/spec/classes/mod/auth_cas_spec.rb index fe64fb3edf..f9686b221a 100644 --- a/spec/classes/mod/auth_cas_spec.rb +++ b/spec/classes/mod/auth_cas_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::auth_cas', type: :class do diff --git a/spec/classes/mod/auth_gssapi_spec.rb b/spec/classes/mod/auth_gssapi_spec.rb index 96b95ba401..fbb0763a50 100644 --- a/spec/classes/mod/auth_gssapi_spec.rb +++ b/spec/classes/mod/auth_gssapi_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::auth_gssapi', type: :class do diff --git a/spec/classes/mod/auth_kerb_spec.rb b/spec/classes/mod/auth_kerb_spec.rb index 87177e866f..a4a09dc11d 100644 --- a/spec/classes/mod/auth_kerb_spec.rb +++ b/spec/classes/mod/auth_kerb_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::auth_kerb', type: :class do diff --git a/spec/classes/mod/auth_mellon_spec.rb b/spec/classes/mod/auth_mellon_spec.rb index 86dca2754f..1a915a08ed 100644 --- a/spec/classes/mod/auth_mellon_spec.rb +++ b/spec/classes/mod/auth_mellon_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::auth_mellon', type: :class do diff --git a/spec/classes/mod/auth_openidc_spec.rb b/spec/classes/mod/auth_openidc_spec.rb index 3f1d640cc8..a0309da8d1 100644 --- a/spec/classes/mod/auth_openidc_spec.rb +++ b/spec/classes/mod/auth_openidc_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::auth_openidc', type: :class do diff --git a/spec/classes/mod/authn_dbd_spec.rb b/spec/classes/mod/authn_dbd_spec.rb index a40fc50490..0f78816f96 100644 --- a/spec/classes/mod/authn_dbd_spec.rb +++ b/spec/classes/mod/authn_dbd_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::authn_dbd', type: :class do diff --git a/spec/classes/mod/authnz_ldap_spec.rb b/spec/classes/mod/authnz_ldap_spec.rb index baa76dc237..307b16d795 100644 --- a/spec/classes/mod/authnz_ldap_spec.rb +++ b/spec/classes/mod/authnz_ldap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::authnz_ldap', type: :class do diff --git a/spec/classes/mod/authnz_pam_spec.rb b/spec/classes/mod/authnz_pam_spec.rb index 2438c1c8d3..92bc157bd3 100644 --- a/spec/classes/mod/authnz_pam_spec.rb +++ b/spec/classes/mod/authnz_pam_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::authnz_pam', type: :class do diff --git a/spec/classes/mod/cluster_spec.rb b/spec/classes/mod/cluster_spec.rb index 2862b72598..998ab1d799 100644 --- a/spec/classes/mod/cluster_spec.rb +++ b/spec/classes/mod/cluster_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::cluster', type: :class do diff --git a/spec/classes/mod/data_spec.rb b/spec/classes/mod/data_spec.rb index 7efb3c2aad..226918d7e1 100644 --- a/spec/classes/mod/data_spec.rb +++ b/spec/classes/mod/data_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::data', type: :class do diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index 21d8406c5b..1d773b3b9c 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::dav_svn', type: :class do diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index b32f622675..1770cd6cc3 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # This function is called inside the OS specific contexts diff --git a/spec/classes/mod/dev_spec.rb b/spec/classes/mod/dev_spec.rb index 9304634452..9294597cf4 100644 --- a/spec/classes/mod/dev_spec.rb +++ b/spec/classes/mod/dev_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::dev', type: :class do diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb index f0774463ed..93d2246f57 100644 --- a/spec/classes/mod/dir_spec.rb +++ b/spec/classes/mod/dir_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::dir', type: :class do diff --git a/spec/classes/mod/disk_cache_spec.rb b/spec/classes/mod/disk_cache_spec.rb index 93a6b77494..31ee6cd5d4 100644 --- a/spec/classes/mod/disk_cache_spec.rb +++ b/spec/classes/mod/disk_cache_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::disk_cache', type: :class do diff --git a/spec/classes/mod/dumpio_spec.rb b/spec/classes/mod/dumpio_spec.rb index 6b84192e7c..4af592abe2 100644 --- a/spec/classes/mod/dumpio_spec.rb +++ b/spec/classes/mod/dumpio_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::dumpio', type: :class do diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 368e9561a7..da70fd440c 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::event', type: :class do diff --git a/spec/classes/mod/expires_spec.rb b/spec/classes/mod/expires_spec.rb index d79158c0be..c01ca25768 100644 --- a/spec/classes/mod/expires_spec.rb +++ b/spec/classes/mod/expires_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::expires', type: :class do diff --git a/spec/classes/mod/ext_filter_spec.rb b/spec/classes/mod/ext_filter_spec.rb index 78bc0a936a..1d7d4c6dde 100644 --- a/spec/classes/mod/ext_filter_spec.rb +++ b/spec/classes/mod/ext_filter_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::ext_filter', type: :class do diff --git a/spec/classes/mod/fastcgi_spec.rb b/spec/classes/mod/fastcgi_spec.rb index 1e054a9f86..702ed0603e 100644 --- a/spec/classes/mod/fastcgi_spec.rb +++ b/spec/classes/mod/fastcgi_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::fastcgi', type: :class do diff --git a/spec/classes/mod/fcgid_spec.rb b/spec/classes/mod/fcgid_spec.rb index da091a4195..08205ec45d 100644 --- a/spec/classes/mod/fcgid_spec.rb +++ b/spec/classes/mod/fcgid_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::fcgid', type: :class do diff --git a/spec/classes/mod/http2_spec.rb b/spec/classes/mod/http2_spec.rb index d1a9c4b51f..978eb63f0f 100644 --- a/spec/classes/mod/http2_spec.rb +++ b/spec/classes/mod/http2_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::http2', type: :class do diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index e61c0b0baf..5dc70f7139 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + require 'spec_helper' # This function is called inside the OS specific contexts -def general_info_specs_22 +def general_info_specs_apache22 it { is_expected.to contain_apache__mod('info') } context 'passing no parameters' do @@ -62,7 +64,7 @@ def general_info_specs_22 end end -def general_info_specs_24 +def general_info_specs_apache24 it { is_expected.to contain_apache__mod('info') } context 'passing no parameters' do @@ -136,7 +138,7 @@ def general_info_specs_24 end # Load the more generic tests for this context - general_info_specs_22 + general_info_specs_apache22 it { is_expected.to contain_file('info.conf').with(ensure: 'file', @@ -162,7 +164,7 @@ def general_info_specs_24 end # Load the more generic tests for this context - general_info_specs_22 + general_info_specs_apache22 it { is_expected.to contain_file('info.conf').with(ensure: 'file', @@ -184,7 +186,7 @@ def general_info_specs_24 end # Load the more generic tests for this context - general_info_specs_24 + general_info_specs_apache24 it { is_expected.to contain_file('info.conf').with(ensure: 'file', @@ -206,7 +208,7 @@ def general_info_specs_24 end # Load the more generic tests for this context - general_info_specs_24 + general_info_specs_apache24 it { is_expected.to contain_file('info.conf').with(ensure: 'file', diff --git a/spec/classes/mod/intercept_form_submit_spec.rb b/spec/classes/mod/intercept_form_submit_spec.rb index 1623814594..45045cbd09 100644 --- a/spec/classes/mod/intercept_form_submit_spec.rb +++ b/spec/classes/mod/intercept_form_submit_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::intercept_form_submit', type: :class do diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index 1c010d4bef..0e7956e5b1 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::itk', type: :class do diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index a8a4d5b9e2..84c09bc57e 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::jk', type: :class do diff --git a/spec/classes/mod/ldap_spec.rb b/spec/classes/mod/ldap_spec.rb index b9cb9dfb35..e95a33cfbc 100644 --- a/spec/classes/mod/ldap_spec.rb +++ b/spec/classes/mod/ldap_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::ldap', type: :class do diff --git a/spec/classes/mod/lookup_identity.rb b/spec/classes/mod/lookup_identity.rb index 5fae97d0e6..33c8017e3e 100644 --- a/spec/classes/mod/lookup_identity.rb +++ b/spec/classes/mod/lookup_identity.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::lookup_identity', type: :class do diff --git a/spec/classes/mod/md_spec.rb b/spec/classes/mod/md_spec.rb index 11fe1599aa..738671d04e 100644 --- a/spec/classes/mod/md_spec.rb +++ b/spec/classes/mod/md_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::md', type: :class do diff --git a/spec/classes/mod/mime_magic_spec.rb b/spec/classes/mod/mime_magic_spec.rb index 6d01ed5f8a..28fcfe03cb 100644 --- a/spec/classes/mod/mime_magic_spec.rb +++ b/spec/classes/mod/mime_magic_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # This function is called inside the OS specific contexts diff --git a/spec/classes/mod/mime_spec.rb b/spec/classes/mod/mime_spec.rb index 6fbba65a08..a2b5382439 100644 --- a/spec/classes/mod/mime_spec.rb +++ b/spec/classes/mod/mime_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # This function is called inside the OS specific conte, :compilexts diff --git a/spec/classes/mod/negotiation_spec.rb b/spec/classes/mod/negotiation_spec.rb index 4d23bf6ab9..63c24acd86 100644 --- a/spec/classes/mod/negotiation_spec.rb +++ b/spec/classes/mod/negotiation_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::negotiation', type: :class do diff --git a/spec/classes/mod/pagespeed_spec.rb b/spec/classes/mod/pagespeed_spec.rb index 171b7672f6..a6c2629087 100644 --- a/spec/classes/mod/pagespeed_spec.rb +++ b/spec/classes/mod/pagespeed_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::pagespeed', type: :class do diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 699cc9bb09..f2c7152aa9 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::passenger', type: :class do diff --git a/spec/classes/mod/perl_spec.rb b/spec/classes/mod/perl_spec.rb index 0176c16027..ddd004b687 100644 --- a/spec/classes/mod/perl_spec.rb +++ b/spec/classes/mod/perl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::perl', type: :class do diff --git a/spec/classes/mod/peruser_spec.rb b/spec/classes/mod/peruser_spec.rb index 0f6a62b335..d5f2a93a1f 100644 --- a/spec/classes/mod/peruser_spec.rb +++ b/spec/classes/mod/peruser_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::peruser', type: :class do diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index fa557f24f0..a7d6fe88c4 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::php', type: :class do diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index 8554577cbd..fdc8762a9c 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::prefork', type: :class do diff --git a/spec/classes/mod/proxy_balancer_spec.rb b/spec/classes/mod/proxy_balancer_spec.rb index 8071a696bd..e4b1a72ce8 100644 --- a/spec/classes/mod/proxy_balancer_spec.rb +++ b/spec/classes/mod/proxy_balancer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # Helper function for testing the contents of `proxy_balancer.conf` diff --git a/spec/classes/mod/proxy_connect_spec.rb b/spec/classes/mod/proxy_connect_spec.rb index 0f39a05bc0..b9fc082ea2 100644 --- a/spec/classes/mod/proxy_connect_spec.rb +++ b/spec/classes/mod/proxy_connect_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::proxy_connect', type: :class do diff --git a/spec/classes/mod/proxy_html_spec.rb b/spec/classes/mod/proxy_html_spec.rb index b8944ad0ac..c305aa31d2 100644 --- a/spec/classes/mod/proxy_html_spec.rb +++ b/spec/classes/mod/proxy_html_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::proxy_html', type: :class do diff --git a/spec/classes/mod/proxy_wstunnel.rb b/spec/classes/mod/proxy_wstunnel.rb index e332d94f80..4626d539c4 100644 --- a/spec/classes/mod/proxy_wstunnel.rb +++ b/spec/classes/mod/proxy_wstunnel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::proxy_wstunnel', type: :class do diff --git a/spec/classes/mod/python_spec.rb b/spec/classes/mod/python_spec.rb index 21e4e42727..a433deb062 100644 --- a/spec/classes/mod/python_spec.rb +++ b/spec/classes/mod/python_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::python', type: :class do diff --git a/spec/classes/mod/remoteip_spec.rb b/spec/classes/mod/remoteip_spec.rb index bb5215ab08..d9cc055eb3 100644 --- a/spec/classes/mod/remoteip_spec.rb +++ b/spec/classes/mod/remoteip_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::remoteip', type: :class do diff --git a/spec/classes/mod/reqtimeout_spec.rb b/spec/classes/mod/reqtimeout_spec.rb index d86ed20bc9..6dca3cb2d0 100644 --- a/spec/classes/mod/reqtimeout_spec.rb +++ b/spec/classes/mod/reqtimeout_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::reqtimeout', type: :class do diff --git a/spec/classes/mod/rpaf_spec.rb b/spec/classes/mod/rpaf_spec.rb index eb389baa78..a36af731e6 100644 --- a/spec/classes/mod/rpaf_spec.rb +++ b/spec/classes/mod/rpaf_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::rpaf', type: :class do diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index f9967f6d0b..50e9986aa2 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' @@ -23,21 +24,17 @@ lib: 'mod_unique_id.so', ) } + it { is_expected.to contain_package('mod_security_crs') } - if facts[:os]['release']['major'].to_i > 6 && facts[:os]['release']['major'].to_i <= 7 - it { - is_expected.to contain_file('security.conf').with( - path: '/etc/httpd/conf.modules.d/security.conf', - ) - } - end - if facts[:os]['release']['major'].to_i >= 8 + + if (facts[:os]['release']['major'].to_i > 6 && facts[:os]['release']['major'].to_i <= 7) || (facts[:os]['release']['major'].to_i >= 8) it { is_expected.to contain_file('security.conf').with( path: '/etc/httpd/conf.modules.d/security.conf', ) } end + it { is_expected.to contain_file('security.conf') .with_content(%r{^\s+SecAuditLogRelevantStatus "\^\(\?:5\|4\(\?!04\)\)"$}) diff --git a/spec/classes/mod/shib_spec.rb b/spec/classes/mod/shib_spec.rb index ec9706ca60..a6bbe46bf8 100644 --- a/spec/classes/mod/shib_spec.rb +++ b/spec/classes/mod/shib_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::shib', type: :class do diff --git a/spec/classes/mod/speling_spec.rb b/spec/classes/mod/speling_spec.rb index 1824c72444..f4a34e3fe2 100644 --- a/spec/classes/mod/speling_spec.rb +++ b/spec/classes/mod/speling_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::speling', type: :class do diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index 33b00c4f4a..48f4683fd2 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::ssl', type: :class do diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index 440804bb65..f4741a9991 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' # Helper function for testing the contents of `status.conf` @@ -16,7 +18,7 @@ def status_conf_spec(allow_from, extended_status, status_path) " # Show Proxy LoadBalancer status in mod_status\n"\ " ProxyStatus On\n"\ "\n" - it do + it('status conf') do is_expected.to contain_file('status.conf').with_content(expected) end end @@ -57,7 +59,7 @@ def status_conf_spec_require(requires, extended_status, status_path) " # Show Proxy LoadBalancer status in mod_status\n"\ " ProxyStatus On\n"\ "\n" - it do + it('status conf require') do is_expected.to contain_file('status.conf').with_content(expected) end end @@ -249,6 +251,8 @@ def status_conf_spec_require(requires, extended_status, status_path) } end + it { is_expected.to compile } + status_conf_spec(['10.10.10.10', '11.11.11.11'], 'Off', '/custom-status') end diff --git a/spec/classes/mod/suphp_spec.rb b/spec/classes/mod/suphp_spec.rb index db4bebd501..4e8a7548db 100644 --- a/spec/classes/mod/suphp_spec.rb +++ b/spec/classes/mod/suphp_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::suphp', type: :class do diff --git a/spec/classes/mod/userdir_spec.rb b/spec/classes/mod/userdir_spec.rb index 9ce731d53d..848dc72544 100644 --- a/spec/classes/mod/userdir_spec.rb +++ b/spec/classes/mod/userdir_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::userdir', type: :class do diff --git a/spec/classes/mod/watchdog_spec.rb b/spec/classes/mod/watchdog_spec.rb index 42e0c7d206..648357b879 100644 --- a/spec/classes/mod/watchdog_spec.rb +++ b/spec/classes/mod/watchdog_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::watchdog', type: :class do diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 2ebd5a9709..8ab2090051 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::worker', type: :class do diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index 902d6877b4..ba1314ebad 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod::wsgi', type: :class do diff --git a/spec/classes/params_spec.rb b/spec/classes/params_spec.rb index ad616377a1..ef0c06b5cc 100644 --- a/spec/classes/params_spec.rb +++ b/spec/classes/params_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::params', type: :class do diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 0ade8ef10e..d446f66703 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::service', type: :class do diff --git a/spec/classes/vhosts_spec.rb b/spec/classes/vhosts_spec.rb index 319e3df596..673028b8ac 100644 --- a/spec/classes/vhosts_spec.rb +++ b/spec/classes/vhosts_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::vhosts', type: :class do diff --git a/spec/defines/balancer_spec.rb b/spec/defines/balancer_spec.rb index 4b6f96ec08..7ba64a8a99 100644 --- a/spec/defines/balancer_spec.rb +++ b/spec/defines/balancer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::balancer', type: :define do diff --git a/spec/defines/balancermember_spec.rb b/spec/defines/balancermember_spec.rb index 1e57ca59cb..8458d3f3f3 100644 --- a/spec/defines/balancermember_spec.rb +++ b/spec/defines/balancermember_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::balancermember', type: :define do diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index 4b262ef688..9011fd68f3 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::custom_config', type: :define do diff --git a/spec/defines/fastcgi_server_spec.rb b/spec/defines/fastcgi_server_spec.rb index cd3e1781c6..44ba4dd8d9 100644 --- a/spec/defines/fastcgi_server_spec.rb +++ b/spec/defines/fastcgi_server_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::fastcgi::server', type: :define do @@ -26,7 +28,7 @@ path: "/etc/httpd/conf.d/fastcgi-pool-#{title}.conf", ) } - when 'Debian' + when 'Debian', 'Gentoo' it { is_expected.to contain_file("fastcgi-pool-#{title}.conf").with( ensure: 'file', @@ -40,13 +42,6 @@ path: "/usr/local/etc/apache24/Includes/fastcgi-pool-#{title}.conf", ) } - when 'Gentoo' - it { - is_expected.to contain_file("fastcgi-pool-#{title}.conf").with( - ensure: 'file', - path: "/etc/apache2/conf.d/fastcgi-pool-#{title}.conf", - ) - } end describe 'os-independent items' do diff --git a/spec/defines/mod_spec.rb b/spec/defines/mod_spec.rb index 2466161107..e4c11af57a 100644 --- a/spec/defines/mod_spec.rb +++ b/spec/defines/mod_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::mod', type: :define do diff --git a/spec/defines/modsec_link_spec.rb b/spec/defines/modsec_link_spec.rb index 3035b71b71..400ae555de 100644 --- a/spec/defines/modsec_link_spec.rb +++ b/spec/defines/modsec_link_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::security::rule_link', type: :define do diff --git a/spec/defines/vhost_custom_spec.rb b/spec/defines/vhost_custom_spec.rb index 05c9183bc5..962e12da3e 100644 --- a/spec/defines/vhost_custom_spec.rb +++ b/spec/defines/vhost_custom_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::vhost::custom', type: :define do @@ -25,6 +27,8 @@ end let(:params) { default_params } let(:facts) { default_facts } + + it { is_expected.to compile } end context 'on Debian based systems' do let :default_facts do diff --git a/spec/defines/vhost_fragment_spec.rb b/spec/defines/vhost_fragment_spec.rb index 2db780d213..886c71f03b 100644 --- a/spec/defines/vhost_fragment_spec.rb +++ b/spec/defines/vhost_fragment_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::vhost::fragment' do diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index b970f40001..a6ce2b291b 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'apache::vhost', type: :define do diff --git a/spec/functions/bool2httpd_spec.rb b/spec/functions/bool2httpd_spec.rb index fabcf2749e..e3f40af43d 100644 --- a/spec/functions/bool2httpd_spec.rb +++ b/spec/functions/bool2httpd_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' shared_examples 'apache::bool2httpd function' do diff --git a/spec/functions/pw_hash_spec.rb b/spec/functions/pw_hash_spec.rb index 9f34f7d43d..5faf7d43e9 100644 --- a/spec/functions/pw_hash_spec.rb +++ b/spec/functions/pw_hash_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' shared_examples 'apache::pw_hash function' do diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 2922671e1d..c80aa202bf 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -34,7 +34,7 @@ def print_parsing_errors end c.before :suite do # Make sure selinux is disabled so the tests work. - LitmusHelper.instance.run_shell('setenforce 0', expect_failures: true) if os[:family] =~ %r{redhat|oracle} + LitmusHelper.instance.run_shell('setenforce 0', expect_failures: true) if %r{redhat|oracle}.match?(os[:family]) LitmusHelper.instance.run_shell('puppet module install stahnma/epel') pp = <<-PUPPETCODE diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index d348d87e21..0c6b56b930 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + if ENV['COVERAGE'] == 'yes' require 'simplecov' require 'simplecov-console' diff --git a/spec/type_aliases/loglevel_spec.rb b/spec/type_aliases/loglevel_spec.rb index ecd09f9a16..265ecc8e61 100644 --- a/spec/type_aliases/loglevel_spec.rb +++ b/spec/type_aliases/loglevel_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Apache::LogLevel' do diff --git a/spec/unit/apache_version_spec.rb b/spec/unit/facter/util/fact_apache_version_spec.rb similarity index 97% rename from spec/unit/apache_version_spec.rb rename to spec/unit/facter/util/fact_apache_version_spec.rb index 02461bf261..da4d3f5ec8 100644 --- a/spec/unit/apache_version_spec.rb +++ b/spec/unit/facter/util/fact_apache_version_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe Facter::Util::Fact do diff --git a/spec/unit/provider/a2mod/gentoo_spec.rb b/spec/unit/provider/a2mod/gentoo_spec.rb index 0255897bd2..2fb48f34a1 100644 --- a/spec/unit/provider/a2mod/gentoo_spec.rb +++ b/spec/unit/provider/a2mod/gentoo_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' provider_class = Puppet::Type.type(:a2mod).provider(:gentoo) @@ -8,7 +10,7 @@ end [:conf_file, :instances, :modules, :initvars, :conf_file, :clear].each do |method| - it "should respond to the class method #{method}" do + it "responds to the class method #{method}" do expect(provider_class).to respond_to(method) end end @@ -49,127 +51,128 @@ end end describe 'when flushing' do + let(:filetype) { double } + let(:info) { double } + let(:mpm) { double } + let(:ssl) { double } + before :each do - @filetype = double - allow(@filetype).to receive(:backup) - allow(provider_class).to receive(:filetype).at_least(:once) { @filetype } + allow(filetype).to receive(:backup) + allow(provider_class).to receive(:filetype).at_least(:once) { filetype } - @info = double - allow(@info).to receive(:[]).with(:name) { 'info' } - allow(@info).to receive(:provider=) + allow(info).to receive(:[]).with(:name) { 'info' } + allow(info).to receive(:provider=) - @mpm = double - allow(@mpm).to receive(:[]).with(:name) { 'mpm' } - allow(@mpm).to receive(:provider=) + allow(mpm).to receive(:[]).with(:name) { 'mpm' } + allow(mpm).to receive(:provider=) - @ssl = double - allow(@ssl).to receive(:[]).with(:name) { 'ssl' } - allow(@ssl).to receive(:provider=) + allow(ssl).to receive(:[]).with(:name) { 'ssl' } + allow(ssl).to receive(:provider=) end it 'adds modules whose ensure is present' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } - expect(@filetype).to receive(:write).with(%(APACHE2_OPTS="-D INFO")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } + expect(filetype).to receive(:write).with(%(APACHE2_OPTS="-D INFO")) - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) provider_class.flush end it 'removes modules whose ensure is present' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-D INFO") } - expect(@filetype).to receive(:write).with(%(APACHE2_OPTS="")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-D INFO") } + expect(filetype).to receive(:write).with(%(APACHE2_OPTS="")) - allow(@info).to receive(:should).with(:ensure) { :absent } - allow(@info).to receive(:provider=) - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :absent } + allow(info).to receive(:provider=) + provider_class.prefetch('info' => info) provider_class.flush end it 'does not modify providers without resources' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-D INFO -D MPM") } - expect(@filetype).to receive(:write).with(%(APACHE2_OPTS="-D MPM -D SSL")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-D INFO -D MPM") } + expect(filetype).to receive(:write).with(%(APACHE2_OPTS="-D MPM -D SSL")) - allow(@info).to receive(:should).with(:ensure) { :absent } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :absent } + provider_class.prefetch('info' => info) - allow(@ssl).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('ssl' => @ssl) + allow(ssl).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('ssl' => ssl) provider_class.flush end it 'writes the modules in sorted order' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } - expect(@filetype).to receive(:write).with(%(APACHE2_OPTS="-D INFO -D MPM -D SSL")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } + expect(filetype).to receive(:write).with(%(APACHE2_OPTS="-D INFO -D MPM -D SSL")) - allow(@mpm).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('mpm' => @mpm) - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) - allow(@ssl).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('ssl' => @ssl) + allow(mpm).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('mpm' => mpm) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) + allow(ssl).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('ssl' => ssl) provider_class.flush end it 'writes the records back once' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } - expect(@filetype).to receive(:write).once.with(%(APACHE2_OPTS="-D INFO -D SSL")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } + expect(filetype).to receive(:write).once.with(%(APACHE2_OPTS="-D INFO -D SSL")) - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) - allow(@ssl).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('ssl' => @ssl) + allow(ssl).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('ssl' => ssl) provider_class.flush end it 'onlies modify the line containing APACHE2_OPTS' do - expect(@filetype).to receive(:read).at_least(:once) { %(# Comment\nAPACHE2_OPTS=""\n# Another comment) } - expect(@filetype).to receive(:write).once.with(%(# Comment\nAPACHE2_OPTS="-D INFO"\n# Another comment)) + expect(filetype).to receive(:read).at_least(:once) { %(# Comment\nAPACHE2_OPTS=""\n# Another comment) } + expect(filetype).to receive(:write).once.with(%(# Comment\nAPACHE2_OPTS="-D INFO"\n# Another comment)) - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) provider_class.flush end it 'restores any arbitrary arguments' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-Y -D MPM -X") } - expect(@filetype).to receive(:write).once.with(%(APACHE2_OPTS="-Y -X -D INFO -D MPM")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-Y -D MPM -X") } + expect(filetype).to receive(:write).once.with(%(APACHE2_OPTS="-Y -X -D INFO -D MPM")) - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) provider_class.flush end it 'backups the file once if changes were made' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } - expect(@filetype).to receive(:write).once.with(%(APACHE2_OPTS="-D INFO -D SSL")) + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="") } + expect(filetype).to receive(:write).once.with(%(APACHE2_OPTS="-D INFO -D SSL")) - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) - allow(@ssl).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('ssl' => @ssl) + allow(ssl).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('ssl' => ssl) - expect(@filetype).to receive(:backup) + expect(filetype).to receive(:backup) provider_class.flush end it 'does not write the file or run backups if no changes were made' do - expect(@filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-X -D INFO -D SSL -Y") } - expect(@filetype).to receive(:write).never + expect(filetype).to receive(:read).at_least(:once) { %(APACHE2_OPTS="-X -D INFO -D SSL -Y") } + expect(filetype).to receive(:write).never - allow(@info).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('info' => @info) + allow(info).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('info' => info) - allow(@ssl).to receive(:should).with(:ensure) { :present } - provider_class.prefetch('ssl' => @ssl) + allow(ssl).to receive(:should).with(:ensure) { :present } + provider_class.prefetch('ssl' => ssl) - expect(@filetype).to receive(:backup).never + expect(filetype).to receive(:backup).never provider_class.flush end end diff --git a/spec/util/_resources/test_metadata_json.rb b/spec/util/_resources/test_metadata_json.rb index b8f64ae564..bd333b73dd 100644 --- a/spec/util/_resources/test_metadata_json.rb +++ b/spec/util/_resources/test_metadata_json.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + METADATA_JSON = '{ "name": "puppetlabs-apache", "version": "5.4.0", @@ -83,4 +85,4 @@ "pdk-version": "1.17.0", "template-url": "https://github.com/puppetlabs/pdk-templates#main", "template-ref": "heads/main-0-g095317c" -}'.freeze +}' diff --git a/spec/util/apache_mod_platform_support_spec.rb b/spec/util/apache_mod_platform_compatibility_spec.rb similarity index 98% rename from spec/util/apache_mod_platform_support_spec.rb rename to spec/util/apache_mod_platform_compatibility_spec.rb index e01ae3d5a8..1025a866a4 100644 --- a/spec/util/apache_mod_platform_support_spec.rb +++ b/spec/util/apache_mod_platform_compatibility_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rspec' require 'rspec-puppet-facts' require_relative '../../util/apache_mod_platform_support' @@ -103,7 +105,7 @@ context 'after parsing the metadata.json' do expected_compatible_platform_versions.each do |os, vers| vers.each do |ver| - it "should state #{os} version #{ver} IS a compatible platform" do + it "states #{os} version #{ver} IS a compatible platform" do ampc.register_running_platform(family: os, version: ver) expect(ampc.mod_supported_on_platform?(foobar_mod)).to be(true) end diff --git a/tasks/init.rb b/tasks/init.rb index 1df27bda26..bb82d9aa7e 100755 --- a/tasks/init.rb +++ b/tasks/init.rb @@ -1,4 +1,6 @@ #!/opt/puppetlabs/puppet/bin/ruby +# frozen_string_literal: true + require 'json' require 'open3' require 'puppet' diff --git a/util/apache_mod_platform_support.rb b/util/apache_mod_platform_support.rb index 16e0b1aebf..5c608cf53d 100644 --- a/util/apache_mod_platform_support.rb +++ b/util/apache_mod_platform_support.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'json' # Helper class to facilitate exclusion of tests that use an Apache MOD on platforms it isn't supported on. # All Apache MOD classes are defined under 'manifests/mod'. The exclusion should be in the format: @@ -67,7 +69,7 @@ def print_parsing_errors end def valid_os?(os) - @compatible_platform_versions.keys.include? os + @compatible_platform_versions.key?(os) end def register_error(manifest, line_num, error_type, error_detail) @@ -75,7 +77,7 @@ def register_error(manifest, line_num, error_type, error_detail) end def register_unsupported_platforms(manifest, line_num, mod, platforms_versions) - platforms_versions.keys.each do |os| + platforms_versions.each_key do |os| unless valid_os?(os) register_error(manifest, line_num, :os_parse, os) next @@ -92,7 +94,7 @@ def extract_os_ver_pairs(line) platforms_versions = {} os_ver_groups = line.delete(' ').downcase # E.g. "debian:5,6;centos:5;sles:11sp1,12;scientific:all;ubuntu:14.04,16.04" - if %r{^((?:\w+:(?:(?:\d+(?:\.\d+|sp\d+)?|all),?)+;?)+)$}i =~ os_ver_groups + if %r{^((?:\w+:(?:(?:\d+(?:\.\d+|sp\d+)?|all),?)+;?)+)$}i.match?(os_ver_groups) os_ver_groups.split(';').each do |os_vers| os, vers = os_vers.split(':') vers.gsub!(%r{sp\d+}, '') # Remove SP ver as we cannot determine this level of granularity from values from Litmus @@ -104,7 +106,7 @@ def extract_os_ver_pairs(line) def process_line(line) data = {} - return data unless line =~ %r{@note\sUnsupported\splatforms?:\s?|class\sapache::mod}i + return data unless %r{@note\sUnsupported\splatforms?:\s?|class\sapache::mod}i.match?(line) if (match = %r{@note\sUnsupported\splatforms?:\s?(?.*)$}i.match(line)) data[:type] = :unsupported_platform_declaration data[:value] = match[:os_vers]