From ac72eacb4ba21127dd305fd92488df148fd849fb Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Tue, 18 Apr 2023 16:09:48 +0100 Subject: [PATCH 01/17] (CONT-772) PDK update --- .devcontainer/devcontainer.json | 2 +- Gemfile | 46 ++++++++++++++++----------------- Rakefile | 1 - metadata.json | 4 +-- 4 files changed, 26 insertions(+), 27 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index fe7a8b12b9..cdd65d220a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -5,7 +5,7 @@ "settings": { "terminal.integrated.profiles.linux": { "bash": { - "path": "bash", + "path": "bash" } } }, diff --git a/Gemfile b/Gemfile index 1881afe150..8456bee1c3 100644 --- a/Gemfile +++ b/Gemfile @@ -14,31 +14,31 @@ def location_for(place_or_version, fake_version = nil) end group :development do - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "voxpupuli-puppet-lint-plugins", '~> 3.1', require: false - gem "facterdb", '~> 1.18', require: false - gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false - gem "puppetlabs_spec_helper", '>= 3.0.0', '< 5.0.0', require: false - gem "rspec-puppet-facts", '~> 2.0', require: false - gem "codecov", '~> 0.2', require: false - gem "dependency_checker", '~> 0.2', require: false - gem "parallel_tests", '~> 3.4', require: false - gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.5', require: false - gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '= 1.6.1', require: false - gem "rubocop-performance", '= 1.9.1', require: false - gem "rubocop-rspec", '= 2.0.1', require: false - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "github_changelog_generator", '= 1.15.2', require: false + gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) + gem "voxpupuli-puppet-lint-plugins", '~> 4.0', require: false + gem "facterdb", '~> 1.18', require: false + gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false + gem "puppetlabs_spec_helper", '~> 5.0', require: false + gem "rspec-puppet-facts", '~> 2.0', require: false + gem "codecov", '~> 0.2', require: false + gem "dependency_checker", '~> 0.2', require: false + gem "parallel_tests", '= 3.12.1', require: false + gem "pry", '~> 0.10', require: false + gem "simplecov-console", '~> 0.5', require: false + gem "puppet-debugger", '~> 1.0', require: false + gem "rubocop", '= 1.6.1', require: false + gem "rubocop-performance", '= 1.9.1', require: false + gem "rubocop-rspec", '= 2.0.1', require: false + gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "github_changelog_generator", '= 1.15.2', require: false end group :system_tests do - gem "puppet_litmus", '<= 0.34.6', require: false, platforms: [:ruby] - gem "serverspec", '~> 2.41', require: false + gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby, :x64_mingw] + gem "serverspec", '~> 2.41', require: false end puppet_version = ENV['PUPPET_GEM_VERSION'] diff --git a/Rakefile b/Rakefile index 47ff253418..3cf60463bd 100644 --- a/Rakefile +++ b/Rakefile @@ -4,7 +4,6 @@ require 'bundler' require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? diff --git a/metadata.json b/metadata.json index afd4e50622..a53eb9a96a 100644 --- a/metadata.json +++ b/metadata.json @@ -87,7 +87,7 @@ } ], "description": "Module for Apache configuration", - "pdk-version": "2.5.0", + "pdk-version": "2.7.1", "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", - "template-ref": "2.7.1-0-g9a16c87" + "template-ref": "heads/main-0-ge5b0114" } From 8faf4c180bca38322174454c7597cb46876a1b32 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Tue, 18 Apr 2023 16:18:25 +0100 Subject: [PATCH 02/17] (CONT-772) Update fixtures.yml --- .fixtures.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.fixtures.yml b/.fixtures.yml index 1fd983cde0..37bc6910f9 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -6,7 +6,7 @@ fixtures: provision: 'https://github.com/puppetlabs/provision.git' puppet_agent: repo: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' - ref: v4.12.1 + ref: v4.13.0 stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" yumrepo_core: repo: "https://github.com/puppetlabs/puppetlabs-yumrepo_core.git" From 8070478d41a8c2f3a912b05904ac77a0b08bbe04 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Tue, 18 Apr 2023 16:20:20 +0100 Subject: [PATCH 03/17] (CONT-772) Update metadata.json and Gemfile --- Gemfile | 6 +++--- metadata.json | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile b/Gemfile index 8456bee1c3..7fad5040d0 100644 --- a/Gemfile +++ b/Gemfile @@ -30,9 +30,9 @@ group :development do gem "pry", '~> 0.10', require: false gem "simplecov-console", '~> 0.5', require: false gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '= 1.6.1', require: false - gem "rubocop-performance", '= 1.9.1', require: false - gem "rubocop-rspec", '= 2.0.1', require: false + gem "rubocop", '~> 1.48.1', require: false + gem "rubocop-performance", '~> 1.16', require: false + gem "rubocop-rspec", '~> 2.19', require: false gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "github_changelog_generator", '= 1.15.2', require: false end diff --git a/metadata.json b/metadata.json index a53eb9a96a..faee22da85 100644 --- a/metadata.json +++ b/metadata.json @@ -14,7 +14,7 @@ }, { "name": "puppetlabs/concat", - "version_requirement": ">= 2.2.1 < 8.0.0" + "version_requirement": ">= 2.2.1 < 9.0.0" } ], "operatingsystem_support": [ @@ -83,7 +83,7 @@ "requirements": [ { "name": "puppet", - "version_requirement": ">= 6.24.0 < 8.0.0" + "version_requirement": ">= 7.0.0 < 9.0.0" } ], "description": "Module for Apache configuration", From 6b72635accfa6a135af0bc3f5f8ebc09b9f0ca6f Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Tue, 18 Apr 2023 16:26:10 +0100 Subject: [PATCH 04/17] (CONT-772) Configure rubocop --- .rubocop.yml | 443 +-------------------------------------------- .rubocop_todo.yml | 399 ++++++++++++++++++++++++++++++++++++++-- manifests/vhost.pp | 2 +- 3 files changed, 394 insertions(+), 450 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a886d8dbfe..0d076d68c8 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,10 @@ require: - rubocop-rspec AllCops: DisplayCopNames: true - TargetRubyVersion: '2.5' + NewCops: enable + TargetRubyVersion: '2.7' + ExtraDetails: true + DisplayStyleGuide: true Include: - "**/*.rb" Exclude: @@ -80,441 +83,5 @@ Style/Documentation: - spec/**/* Style/WordArray: EnforcedStyle: brackets -Performance/AncestorsInclude: - Enabled: true -Performance/BigDecimalWithNumericArgument: - Enabled: true -Performance/BlockGivenWithExplicitBlock: - Enabled: true -Performance/CaseWhenSplat: - Enabled: true -Performance/ConstantRegexp: - Enabled: true -Performance/MethodObjectAsBlock: - Enabled: true -Performance/RedundantSortBlock: - Enabled: true -Performance/RedundantStringChars: - Enabled: true -Performance/ReverseFirst: - Enabled: true -Performance/SortReverse: - Enabled: true -Performance/Squeeze: - Enabled: true -Performance/StringInclude: - Enabled: true -Performance/Sum: - Enabled: true -Style/CollectionMethods: - Enabled: true -Style/MethodCalledOnDoEndBlock: - Enabled: true -Style/StringMethods: - Enabled: true -Bundler/InsecureProtocolSource: - Enabled: false -Gemspec/DuplicatedAssignment: - Enabled: false -Gemspec/OrderedDependencies: - Enabled: false -Gemspec/RequiredRubyVersion: - Enabled: false -Gemspec/RubyVersionGlobalsUsage: - Enabled: false -Layout/ArgumentAlignment: - Enabled: false -Layout/BeginEndAlignment: - Enabled: false -Layout/ClosingHeredocIndentation: - Enabled: false -Layout/EmptyComment: - Enabled: false -Layout/EmptyLineAfterGuardClause: - Enabled: false -Layout/EmptyLinesAroundArguments: - Enabled: false -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: false -Layout/EndOfLine: - Enabled: false -Layout/FirstArgumentIndentation: - Enabled: false -Layout/HashAlignment: - Enabled: false -Layout/HeredocIndentation: - Enabled: false -Layout/LeadingEmptyLines: - Enabled: false -Layout/SpaceAroundMethodCallOperator: - Enabled: false -Layout/SpaceInsideArrayLiteralBrackets: - Enabled: false -Layout/SpaceInsideReferenceBrackets: - Enabled: false -Lint/BigDecimalNew: - Enabled: false -Lint/BooleanSymbol: - Enabled: false -Lint/ConstantDefinitionInBlock: - Enabled: false -Lint/DeprecatedOpenSSLConstant: - Enabled: false -Lint/DisjunctiveAssignmentInConstructor: - Enabled: false -Lint/DuplicateElsifCondition: - Enabled: false -Lint/DuplicateRequire: - Enabled: false -Lint/DuplicateRescueException: - Enabled: false -Lint/EmptyConditionalBody: - Enabled: false -Lint/EmptyFile: - Enabled: false -Lint/ErbNewArguments: - Enabled: false -Lint/FloatComparison: - Enabled: false -Lint/HashCompareByIdentity: - Enabled: false -Lint/IdentityComparison: - Enabled: false -Lint/InterpolationCheck: - Enabled: false -Lint/MissingCopEnableDirective: - Enabled: false -Lint/MixedRegexpCaptureTypes: - Enabled: false -Lint/NestedPercentLiteral: - Enabled: false -Lint/NonDeterministicRequireOrder: - Enabled: false -Lint/OrderedMagicComments: - Enabled: false -Lint/OutOfRangeRegexpRef: - Enabled: false -Lint/RaiseException: - Enabled: false -Lint/RedundantCopEnableDirective: - Enabled: false -Lint/RedundantRequireStatement: - Enabled: false -Lint/RedundantSafeNavigation: - Enabled: false -Lint/RedundantWithIndex: - Enabled: false -Lint/RedundantWithObject: - Enabled: false -Lint/RegexpAsCondition: - Enabled: false -Lint/ReturnInVoidContext: - Enabled: false -Lint/SafeNavigationConsistency: - Enabled: false -Lint/SafeNavigationWithEmpty: - Enabled: false -Lint/SelfAssignment: - Enabled: false -Lint/SendWithMixinArgument: - Enabled: false -Lint/ShadowedArgument: - Enabled: false -Lint/StructNewOverride: - Enabled: false -Lint/ToJSON: - Enabled: false -Lint/TopLevelReturnWithArgument: - Enabled: false -Lint/TrailingCommaInAttributeDeclaration: - Enabled: false -Lint/UnreachableLoop: - Enabled: false -Lint/UriEscapeUnescape: - Enabled: false -Lint/UriRegexp: - Enabled: false -Lint/UselessMethodDefinition: - Enabled: false -Lint/UselessTimes: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/BlockNesting: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Migration/DepartmentName: - Enabled: false -Naming/AccessorMethodName: - Enabled: false -Naming/BlockParameterName: - Enabled: false -Naming/HeredocDelimiterCase: - Enabled: false -Naming/HeredocDelimiterNaming: - Enabled: false -Naming/MemoizedInstanceVariableName: - Enabled: false Naming/MethodParameterName: - Enabled: false -Naming/RescuedExceptionsVariableName: - Enabled: false -Naming/VariableNumber: - Enabled: false -Performance/BindCall: - Enabled: false -Performance/DeletePrefix: - Enabled: false -Performance/DeleteSuffix: - Enabled: false -Performance/InefficientHashSearch: - Enabled: false -Performance/UnfreezeString: - Enabled: false -Performance/UriDefaultParser: - Enabled: false -RSpec/Be: - Enabled: false -RSpec/Capybara/CurrentPathExpectation: - Enabled: false -RSpec/Capybara/FeatureMethods: - Enabled: false -RSpec/Capybara/VisibilityMatcher: - Enabled: false -RSpec/ContextMethod: - Enabled: false -RSpec/ContextWording: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/EmptyHook: - Enabled: false -RSpec/EmptyLineAfterExample: - Enabled: false -RSpec/EmptyLineAfterExampleGroup: - Enabled: false -RSpec/EmptyLineAfterHook: - Enabled: false -RSpec/ExampleLength: - Enabled: false -RSpec/ExampleWithoutDescription: - Enabled: false -RSpec/ExpectChange: - Enabled: false -RSpec/ExpectInHook: - Enabled: false -RSpec/FactoryBot/AttributeDefinedStatically: - Enabled: false -RSpec/FactoryBot/CreateList: - Enabled: false -RSpec/FactoryBot/FactoryClassName: - Enabled: false -RSpec/HooksBeforeExamples: - Enabled: false -RSpec/ImplicitBlockExpectation: - Enabled: false -RSpec/ImplicitSubject: - Enabled: false -RSpec/LeakyConstantDeclaration: - Enabled: false -RSpec/LetBeforeExamples: - Enabled: false -RSpec/MissingExampleGroupArgument: - Enabled: false -RSpec/MultipleExpectations: - Enabled: false -RSpec/MultipleMemoizedHelpers: - Enabled: false -RSpec/MultipleSubjects: - Enabled: false -RSpec/NestedGroups: - Enabled: false -RSpec/PredicateMatcher: - Enabled: false -RSpec/ReceiveCounts: - Enabled: false -RSpec/ReceiveNever: - Enabled: false -RSpec/RepeatedExampleGroupBody: - Enabled: false -RSpec/RepeatedExampleGroupDescription: - Enabled: false -RSpec/RepeatedIncludeExample: - Enabled: false -RSpec/ReturnFromStub: - Enabled: false -RSpec/SharedExamples: - Enabled: false -RSpec/StubbedMock: - Enabled: false -RSpec/UnspecifiedException: - Enabled: false -RSpec/VariableDefinition: - Enabled: false -RSpec/VoidExpect: - Enabled: false -RSpec/Yield: - Enabled: false -Security/Open: - Enabled: false -Style/AccessModifierDeclarations: - Enabled: false -Style/AccessorGrouping: - Enabled: false -Style/AsciiComments: - Enabled: false -Style/BisectedAttrAccessor: - Enabled: false -Style/CaseLikeIf: - Enabled: false -Style/ClassEqualityComparison: - Enabled: false -Style/ColonMethodDefinition: - Enabled: false -Style/CombinableLoops: - Enabled: false -Style/CommentedKeyword: - Enabled: false -Style/Dir: - Enabled: false -Style/DoubleCopDisableDirective: - Enabled: false -Style/EmptyBlockParameter: - Enabled: false -Style/EmptyLambdaParameter: - Enabled: false -Style/Encoding: - Enabled: false -Style/EvalWithLocation: - Enabled: false -Style/ExpandPathArguments: - Enabled: false -Style/ExplicitBlockArgument: - Enabled: false -Style/ExponentialNotation: - Enabled: false -Style/FloatDivision: - Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false -Style/GlobalStdStream: - Enabled: false -Style/HashAsLastArrayItem: - Enabled: false -Style/HashLikeCase: - Enabled: false -Style/HashTransformKeys: - Enabled: false -Style/HashTransformValues: - Enabled: false -Style/IfUnlessModifier: - Enabled: false -Style/KeywordParametersOrder: - Enabled: false -Style/MinMax: - Enabled: false -Style/MixinUsage: - Enabled: false -Style/MultilineWhenThen: - Enabled: false -Style/NegatedUnless: - Enabled: false -Style/NumericPredicate: - Enabled: false -Style/OptionalBooleanParameter: - Enabled: false -Style/OrAssignment: - Enabled: false -Style/RandomWithOffset: - Enabled: false -Style/RedundantAssignment: - Enabled: false -Style/RedundantCondition: - Enabled: false -Style/RedundantConditional: - Enabled: false -Style/RedundantFetchBlock: - Enabled: false -Style/RedundantFileExtensionInRequire: - Enabled: false -Style/RedundantRegexpCharacterClass: - Enabled: false -Style/RedundantRegexpEscape: - Enabled: false -Style/RedundantSelfAssignment: - Enabled: false -Style/RedundantSort: - Enabled: false -Style/RescueStandardError: - Enabled: false -Style/SingleArgumentDig: - Enabled: false -Style/SlicingWithRange: - Enabled: false -Style/SoleNestedConditional: - Enabled: false -Style/StderrPuts: - Enabled: false -Style/StringConcatenation: - Enabled: false -Style/Strip: - Enabled: false -Style/SymbolProc: - Enabled: false -Style/TrailingBodyOnClass: - Enabled: false -Style/TrailingBodyOnMethodDefinition: - Enabled: false -Style/TrailingBodyOnModule: - Enabled: false -Style/TrailingCommaInHashLiteral: - Enabled: false -Style/TrailingMethodEndStatement: - Enabled: false -Style/UnpackFirst: - Enabled: false -Lint/DuplicateBranch: - Enabled: false -Lint/DuplicateRegexpCharacterClassElement: - Enabled: false -Lint/EmptyBlock: - Enabled: false -Lint/EmptyClass: - Enabled: false -Lint/NoReturnInBeginEndBlocks: - Enabled: false -Lint/ToEnumArguments: - Enabled: false -Lint/UnexpectedBlockArity: - Enabled: false -Lint/UnmodifiedReduceAccumulator: - Enabled: false -Performance/CollectionLiteralInLoop: - Enabled: false -Style/ArgumentsForwarding: - Enabled: false -Style/CollectionCompact: - Enabled: false -Style/DocumentDynamicEvalDefinition: - Enabled: false -Style/NegatedIfElseCondition: - Enabled: false -Style/NilLambda: - Enabled: false -Style/RedundantArgument: - Enabled: false -Style/SwapValues: - Enabled: false + AllowedNames: 'is' diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 9e99e20040..7f466f647b 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,18 +1,395 @@ -Style/GlobalVars: +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2023-04-18 15:25:08 UTC using RuboCop version 1.48.1. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 12 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: with_first_argument, with_fixed_indentation +Layout/ArgumentAlignment: + Exclude: + - 'spec/classes/mod/event_spec.rb' + - 'spec/classes/mod/itk_spec.rb' + - 'spec/classes/mod/lbmethod_bybusyness.rb' + - 'spec/classes/mod/lbmethod_byrequests.rb' + - 'spec/classes/mod/lbmethod_bytraffic.rb' + - 'spec/classes/mod/lbmethod_heartbeat.rb' + - 'spec/classes/mod/prefork_spec.rb' + - 'spec/classes/mod/worker_spec.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Layout/ClosingHeredocIndentation: + Exclude: + - 'spec/acceptance/itk_spec.rb' + - 'spec/acceptance/mod_authnz_ldap_spec.rb' + - 'spec/acceptance/vhost_spec.rb' + +# Offense count: 8 +# This cop supports safe autocorrection (--autocorrect). +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'lib/puppet/functions/apache/bool2httpd.rb' + - 'spec/classes/mod/authnz_ldap_spec.rb' + - 'spec/spec_helper_acceptance_local.rb' + - 'tasks/init.rb' + - 'util/apache_mod_platform_support.rb' + +# Offense count: 590 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. +# SupportedHashRocketStyles: key, separator, table +# SupportedColonStyles: key, separator, table +# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit +Layout/HashAlignment: + Exclude: + - 'spec/classes/apache_spec.rb' + - 'spec/classes/mod/event_spec.rb' + - 'spec/classes/mod/itk_spec.rb' + - 'spec/classes/mod/jk_spec.rb' + - 'spec/classes/mod/lbmethod_bybusyness.rb' + - 'spec/classes/mod/lbmethod_byrequests.rb' + - 'spec/classes/mod/lbmethod_bytraffic.rb' + - 'spec/classes/mod/lbmethod_heartbeat.rb' + - 'spec/classes/mod/prefork_spec.rb' + - 'spec/classes/mod/worker_spec.rb' + - 'spec/classes/service_spec.rb' + - 'spec/defines/custom_config_spec.rb' + - 'spec/defines/vhost_spec.rb' + - 'util/apache_mod_platform_support.rb' + +# Offense count: 2 +# This cop supports safe autocorrection (--autocorrect). +Layout/HeredocIndentation: + Exclude: + - 'spec/classes/mod/http2_spec.rb' + +# Offense count: 15 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: leading, trailing +Layout/LineContinuationLeadingSpace: + Exclude: + - 'spec/classes/mod/info_spec.rb' + - 'spec/classes/mod/jk_spec.rb' + - 'spec/classes/mod/proxy_balancer_spec.rb' + - 'spec/classes/mod/status_spec.rb' + - 'spec/util/apache_mod_platform_compatibility_spec.rb' + +# Offense count: 52 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AutoCorrect, EnforcedStyle. +# SupportedStyles: space, no_space +Layout/LineContinuationSpacing: + Exclude: + - 'spec/classes/mod/deflate_spec.rb' + - 'spec/classes/mod/info_spec.rb' + - 'spec/classes/mod/jk_spec.rb' + - 'spec/classes/mod/ldap_spec.rb' + - 'spec/classes/mod/proxy_balancer_spec.rb' + - 'spec/classes/mod/status_spec.rb' + +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, IndentationWidth. +# SupportedStyles: aligned, indented +Layout/LineEndStringConcatenationIndentation: + Exclude: + - 'spec/classes/mod/deflate_spec.rb' + - 'spec/classes/mod/info_spec.rb' + +# Offense count: 3 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'spec/acceptance/mod_php_spec.rb' + - 'spec/spec_helper_acceptance_local.rb' + +# Offense count: 5 +# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 126 + +# Offense count: 3 +# Configuration parameters: AllowedMethods, AllowedPatterns. +Metrics/CyclomaticComplexity: + Max: 13 + +# Offense count: 7 +# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns. +Metrics/MethodLength: + Max: 101 + +# Offense count: 3 +# Configuration parameters: AllowedMethods, AllowedPatterns. +Metrics/PerceivedComplexity: + Max: 13 + +# Offense count: 2 +# Configuration parameters: ForbiddenDelimiters. +# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$)) +Naming/HeredocDelimiterNaming: + Exclude: + - 'spec/classes/mod/http2_spec.rb' + +# Offense count: 3 +# Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames. +# AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to +Naming/MethodParameterName: + Exclude: + - 'spec/spec_helper_acceptance_local.rb' + - 'util/apache_mod_platform_support.rb' + +# Offense count: 2 +# Configuration parameters: MinSize. +Performance/CollectionLiteralInLoop: + Exclude: + - 'spec/classes/mod/passenger_spec.rb' + - 'spec/defines/vhost_spec.rb' + +# Offense count: 2 +# This cop supports unsafe autocorrection (--autocorrect-all). +RSpec/BeEq: + Exclude: + - 'spec/functions/bool2httpd_spec.rb' + - 'spec/functions/pw_hash_spec.rb' + +# Offense count: 393 +# Configuration parameters: Prefixes, AllowedPatterns. +# Prefixes: when, with, without +RSpec/ContextWording: Enabled: false -RSpec/InstanceVariable: + +# Offense count: 95 +# Configuration parameters: IgnoredMetadata. +RSpec/DescribeClass: Enabled: false -RSpec/RepeatedExample: - Enabled: false -RSpec/ExpectInHook: + +# Offense count: 239 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterExample: Enabled: false -RSpec/NamedSubject: + +# Offense count: 270 +# This cop supports safe autocorrection (--autocorrect). +RSpec/EmptyLineAfterExampleGroup: Enabled: false -RSpec/VoidExpect: + +# Offense count: 25 +# Configuration parameters: CountAsOne. +RSpec/ExampleLength: + Max: 107 + +# Offense count: 6 +# This cop supports safe autocorrection (--autocorrect). +RSpec/ExcessiveDocstringSpacing: + Exclude: + - 'spec/classes/dev_spec.rb' + - 'spec/classes/mod/passenger_spec.rb' + - 'spec/classes/mod/php_spec.rb' + - 'spec/classes/mod/security_spec.rb' + - 'spec/defines/modsec_link_spec.rb' + - 'spec/defines/vhost_spec.rb' + +# Offense count: 6 +# Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. +# Include: **/*_spec*rb*, **/spec/**/* +RSpec/FilePath: + Exclude: + - 'spec/classes/mod/lbmethod_bybusyness.rb' + - 'spec/classes/mod/lbmethod_byrequests.rb' + - 'spec/classes/mod/lbmethod_bytraffic.rb' + - 'spec/classes/mod/lbmethod_heartbeat.rb' + - 'spec/classes/mod/lookup_identity.rb' + - 'spec/classes/mod/proxy_wstunnel.rb' + +# Offense count: 292 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit +RSpec/ImplicitSubject: Enabled: false -RSpec/AnyInstance: + +# Offense count: 16 +# This cop supports safe autocorrection (--autocorrect). +RSpec/LetBeforeExamples: + Exclude: + - 'spec/classes/mod/auth_kerb_spec.rb' + - 'spec/classes/mod/auth_openidc_spec.rb' + - 'spec/classes/mod/cluster_spec.rb' + - 'spec/classes/mod/disk_cache_spec.rb' + - 'spec/classes/mod/jk_spec.rb' + - 'spec/classes/mod/proxy_balancer_spec.rb' + - 'spec/classes/mod/ssl_spec.rb' + - 'spec/classes/mod/wsgi_spec.rb' + - 'spec/classes/service_spec.rb' + +# Offense count: 17 +RSpec/MultipleExpectations: + Max: 8 + +# Offense count: 69 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 6 + +# Offense count: 123 +# Configuration parameters: AllowedGroups. +RSpec/NestedGroups: + Max: 6 + +# Offense count: 101 +# Configuration parameters: AllowedPatterns. +# AllowedPatterns: ^expect_, ^assert_ +RSpec/NoExpectationExample: Enabled: false -RSpec/FilePath: + +# Offense count: 8 +RSpec/RepeatedExample: + Exclude: + - 'spec/classes/apache_spec.rb' + +# Offense count: 19 +RSpec/RepeatedExampleGroupBody: + Exclude: + - 'spec/acceptance/apache_parameters_spec.rb' + - 'spec/acceptance/apache_ssl_spec.rb' + - 'spec/acceptance/vhost_spec.rb' + - 'spec/classes/mod/remoteip_spec.rb' + - 'spec/functions/pw_hash_spec.rb' + +# Offense count: 18 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/acceptance/apache_parameters_spec.rb' + - 'spec/acceptance/vhost_spec.rb' + - 'spec/classes/apache_spec.rb' + - 'spec/classes/mod/security_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +RSpec/SharedExamples: + Exclude: + - 'spec/spec_helper_local.rb' + +# Offense count: 4 +RSpec/StubbedMock: + Exclude: + - 'spec/util/apache_mod_platform_compatibility_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: MinBranchesCount. +Style/CaseLikeIf: + Exclude: + - 'spec/classes/mod/status_spec.rb' + +# Offense count: 12 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/CommentedKeyword: + Exclude: + - 'spec/classes/mod/authnz_ldap_spec.rb' + - 'spec/classes/mod/authnz_pam_spec.rb' + - 'spec/classes/mod/intercept_form_submit_spec.rb' + - 'spec/classes/mod/ldap_spec.rb' + - 'spec/classes/mod/lookup_identity.rb' + - 'spec/defines/vhost_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Exclude: + - 'spec/type_aliases/modproxy_spec.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +Style/GlobalStdStream: + Exclude: + - 'tasks/init.rb' + +# Offense count: 5 +# This cop supports safe autocorrection (--autocorrect). +Style/IfUnlessModifier: + Exclude: + - 'lib/puppet/provider/a2mod.rb' + - 'spec/classes/dev_spec.rb' + - 'spec/spec_helper_acceptance_local.rb' + +# Offense count: 1 +Style/MixinUsage: + Exclude: + - 'spec/spec_helper.rb' + +# Offense count: 3 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Methods. +Style/RedundantArgument: + Exclude: + - 'spec/classes/mod/status_spec.rb' + +# Offense count: 247 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantRegexpEscape: + Exclude: + - 'spec/classes/apache_spec.rb' + - 'spec/classes/mod/alias_spec.rb' + - 'spec/classes/mod/auth_mellon_spec.rb' + - 'spec/classes/mod/disk_cache_spec.rb' + - 'spec/classes/mod/passenger_spec.rb' + - 'spec/classes/mod/security_spec.rb' + - 'spec/classes/mod/ssl_spec.rb' + - 'spec/classes/mod/userdir_spec.rb' + - 'spec/classes/mod/wsgi_spec.rb' + - 'spec/defines/vhost_spec.rb' + +# Offense count: 22 +# This cop supports safe autocorrection (--autocorrect). +Style/RedundantStringEscape: + Exclude: + - 'spec/acceptance/apache_parameters_spec.rb' + - 'spec/acceptance/vhost_spec.rb' + - 'spec/classes/mod/auth_mellon_spec.rb' + - 'spec/defines/vhost_spec.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'spec/spec_helper.rb' + +# Offense count: 3 +# This cop supports safe autocorrection (--autocorrect). +Style/StderrPuts: + Exclude: + - 'util/apache_mod_platform_support.rb' + +# Offense count: 1 +# This cop supports unsafe autocorrection (--autocorrect-all). +# Configuration parameters: Mode. +Style/StringConcatenation: + Exclude: + - 'lib/puppet/functions/apache/pw_hash.rb' + +# Offense count: 1 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyle, AllowSafeAssignment. +# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex +Style/TernaryParentheses: + Exclude: + - 'spec/defines/vhost_spec.rb' + +# Offense count: 259 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInHashLiteral: Enabled: false -RSpec/EmptyExampleGroup: - Enabled: false diff --git a/manifests/vhost.pp b/manifests/vhost.pp index ae99f4545e..f598fb3ffd 100644 --- a/manifests/vhost.pp +++ b/manifests/vhost.pp @@ -2145,7 +2145,7 @@ allow_override => $override, directoryindex => $directoryindex, require => 'all granted', - } + }, ] } else { $_directories = undef From 367b3186f28f83e0be63ee0eb4e8bf2734c9412e Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Tue, 18 Apr 2023 17:07:52 +0100 Subject: [PATCH 05/17] (CONT-772) Addressing legacy fact --- spec/acceptance/vhost_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index fd412d9fff..fb0b975bdb 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -10,11 +10,11 @@ class { 'apache': default_ssl_vhost => false, service_ensure => stopped, } - if ($::osfamily == 'Suse' and $::operatingsystemrelease < '15') { + if ($facts['os']['family'] == 'Suse' and $facts['os']['release']['major'] < '15') { exec { '/usr/bin/gensslcert': require => Class['apache'], } - } elsif ($::osfamily == 'Suse' and $::operatingsystemrelease >= '15') { + } elsif ($facts['os']['family'] == 'Suse' and $facts['os']['release']['major'] >= '15') { # In SLES 15, if not given a name, gensslcert defaults the name to be the hostname exec { '/usr/bin/gensslcert -n default': require => Class['apache'], From b8bdb964f9c42d065bbcde68217247fafec64e5d Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 19 Apr 2023 00:20:02 +0100 Subject: [PATCH 06/17] (CONT-772) Removing deprecated test --- spec/acceptance/vhost_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index fb0b975bdb..3d21aef1e3 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -1135,7 +1135,6 @@ class { 'apache::mod::wsgi': } docroot => '/tmp', wsgi_application_group => '%{GLOBAL}', wsgi_daemon_process => { 'wsgi' => { 'python-home' => '/usr' }, 'foo' => {} }, - wsgi_daemon_process_options => {processes => 2}, wsgi_import_script => '/test1', wsgi_import_script_options => { application-group => '%{GLOBAL}', process-group => 'wsgi' }, wsgi_process_group => 'nobody', From 78ef5ef5d9b891b8dc3ac0f3ad3ff21702eba8e0 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 19 Apr 2023 18:10:37 +0100 Subject: [PATCH 07/17] (CONT-772) Correct Layout/HashAlignment --- .rubocop_todo.yml | 47 +- spec/classes/apache_spec.rb | 24 +- spec/classes/mod/event_spec.rb | 2 +- spec/classes/mod/itk_spec.rb | 2 +- spec/classes/mod/jk_spec.rb | 4 +- spec/classes/mod/lbmethod_bybusyness.rb | 4 +- spec/classes/mod/lbmethod_byrequests.rb | 4 +- spec/classes/mod/lbmethod_bytraffic.rb | 4 +- spec/classes/mod/lbmethod_heartbeat.rb | 4 +- spec/classes/mod/prefork_spec.rb | 2 +- spec/classes/mod/worker_spec.rb | 2 +- spec/classes/service_spec.rb | 40 +- spec/defines/custom_config_spec.rb | 10 +- spec/defines/vhost_spec.rb | 1078 +++++++++++------------ util/apache_mod_platform_support.rb | 4 +- 15 files changed, 600 insertions(+), 631 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7f466f647b..6eb72d69e8 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,26 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-18 15:25:08 UTC using RuboCop version 1.48.1. +# on 2023-04-19 16:57:14 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 12 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: with_first_argument, with_fixed_indentation -Layout/ArgumentAlignment: - Exclude: - - 'spec/classes/mod/event_spec.rb' - - 'spec/classes/mod/itk_spec.rb' - - 'spec/classes/mod/lbmethod_bybusyness.rb' - - 'spec/classes/mod/lbmethod_byrequests.rb' - - 'spec/classes/mod/lbmethod_bytraffic.rb' - - 'spec/classes/mod/lbmethod_heartbeat.rb' - - 'spec/classes/mod/prefork_spec.rb' - - 'spec/classes/mod/worker_spec.rb' - # Offense count: 5 # This cop supports safe autocorrection (--autocorrect). Layout/ClosingHeredocIndentation: @@ -39,29 +24,6 @@ Layout/EmptyLineAfterGuardClause: - 'tasks/init.rb' - 'util/apache_mod_platform_support.rb' -# Offense count: 590 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle. -# SupportedHashRocketStyles: key, separator, table -# SupportedColonStyles: key, separator, table -# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit -Layout/HashAlignment: - Exclude: - - 'spec/classes/apache_spec.rb' - - 'spec/classes/mod/event_spec.rb' - - 'spec/classes/mod/itk_spec.rb' - - 'spec/classes/mod/jk_spec.rb' - - 'spec/classes/mod/lbmethod_bybusyness.rb' - - 'spec/classes/mod/lbmethod_byrequests.rb' - - 'spec/classes/mod/lbmethod_bytraffic.rb' - - 'spec/classes/mod/lbmethod_heartbeat.rb' - - 'spec/classes/mod/prefork_spec.rb' - - 'spec/classes/mod/worker_spec.rb' - - 'spec/classes/service_spec.rb' - - 'spec/defines/custom_config_spec.rb' - - 'spec/defines/vhost_spec.rb' - - 'util/apache_mod_platform_support.rb' - # Offense count: 2 # This cop supports safe autocorrection (--autocorrect). Layout/HeredocIndentation: @@ -102,6 +64,13 @@ Layout/LineEndStringConcatenationIndentation: - 'spec/classes/mod/deflate_spec.rb' - 'spec/classes/mod/info_spec.rb' +# Offense count: 4 +# This cop supports safe autocorrection (--autocorrect). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 202 + # Offense count: 3 # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. Lint/DuplicateBranch: diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index 0d5cda12ae..595df44056 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -50,13 +50,13 @@ ['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { is_expected.to contain_file("#{modname}.load").with( - 'path' => "/etc/apache2/mods-available/#{modname}.load", + 'path' => "/etc/apache2/mods-available/#{modname}.load", 'ensure' => 'file', ) } it { is_expected.to contain_file("#{modname}.load symlink").with( - 'path' => "/etc/apache2/mods-enabled/#{modname}.load", + 'path' => "/etc/apache2/mods-enabled/#{modname}.load", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.load", ) @@ -121,26 +121,26 @@ ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname| it { is_expected.to contain_file("#{modname}.load").with( - 'path' => "/etc/apache2/mods-available/#{modname}.load", + 'path' => "/etc/apache2/mods-available/#{modname}.load", 'ensure' => 'file', ) } it { is_expected.to contain_file("#{modname}.load symlink").with( - 'path' => "/etc/apache2/mods-enabled/#{modname}.load", + 'path' => "/etc/apache2/mods-enabled/#{modname}.load", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.load", ) } it { is_expected.to contain_file("#{modname}.conf").with( - 'path' => "/etc/apache2/mods-available/#{modname}.conf", + 'path' => "/etc/apache2/mods-available/#{modname}.conf", 'ensure' => 'file', ) } it { is_expected.to contain_file("#{modname}.conf symlink").with( - 'path' => "/etc/apache2/mods-enabled/#{modname}.conf", + 'path' => "/etc/apache2/mods-enabled/#{modname}.conf", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.conf", ) @@ -167,7 +167,7 @@ describe 'Add extra LogFormats When parameter log_formats is a hash' do let :params do { log_formats: { - 'vhost_common' => '%v %h %l %u %t "%r" %>s %b', + 'vhost_common' => '%v %h %l %u %t "%r" %>s %b', 'vhost_combined' => '%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"', } } end @@ -179,7 +179,7 @@ describe 'Override existing LogFormats When parameter log_formats is a hash' do let :params do { log_formats: { - 'common' => '%v %h %l %u %t "%r" %>s %b', + 'common' => '%v %h %l %u %t "%r" %>s %b', 'combined' => '%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"', } } end @@ -548,7 +548,7 @@ ['auth_basic', 'authn_core', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { is_expected.to contain_file("#{modname}.load").with( - 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load", + 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load", 'ensure' => 'file', ) } @@ -559,13 +559,13 @@ ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname| it { is_expected.to contain_file("#{modname}.load").with( - 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load", + 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load", 'ensure' => 'file', ) } it { is_expected.to contain_file("#{modname}.conf").with( - 'path' => "/usr/local/etc/apache24/Modules/#{modname}.conf", + 'path' => "/usr/local/etc/apache24/Modules/#{modname}.conf", 'ensure' => 'file', ) } @@ -615,7 +615,7 @@ it { is_expected.to contain_package('httpd').with( 'ensure' => 'installed', - 'name' => 'httpd24-httpd', + 'name' => 'httpd24-httpd', ).that_notifies('Class[Apache::Service]') } end diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 2099bd5530..f5f3d4621c 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -124,7 +124,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/event.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_event_module modules/mod_mpm_event.so\n") + 'content' => "LoadModule mpm_event_module modules/mod_mpm_event.so\n") } end end diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index 3348a4e094..c9ad07e5b4 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -50,7 +50,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/itk.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n") + 'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n") } end context 'with enablecapabilities set' do diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index 05e92e02a9..158ee18c1a 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -26,12 +26,12 @@ 'worker_a' => { 'type' => 'ajp13', 'socket_keepalive' => 'true', - 'comment' => 'This is worker A', + 'comment' => 'This is worker A', }, 'worker_b' => { 'type' => 'ajp13', 'socket_keepalive' => 'true', - 'comment' => 'This is worker B', + 'comment' => 'This is worker B', }, 'worker_maintain' => 40, 'worker_lists' => ['worker_a,worker_b'], diff --git a/spec/classes/mod/lbmethod_bybusyness.rb b/spec/classes/mod/lbmethod_bybusyness.rb index 94c24ad495..22eb0a8bc5 100644 --- a/spec/classes/mod/lbmethod_bybusyness.rb +++ b/spec/classes/mod/lbmethod_bybusyness.rb @@ -15,7 +15,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -31,7 +31,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") } end end diff --git a/spec/classes/mod/lbmethod_byrequests.rb b/spec/classes/mod/lbmethod_byrequests.rb index 94c24ad495..22eb0a8bc5 100644 --- a/spec/classes/mod/lbmethod_byrequests.rb +++ b/spec/classes/mod/lbmethod_byrequests.rb @@ -15,7 +15,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -31,7 +31,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") } end end diff --git a/spec/classes/mod/lbmethod_bytraffic.rb b/spec/classes/mod/lbmethod_bytraffic.rb index 94c24ad495..22eb0a8bc5 100644 --- a/spec/classes/mod/lbmethod_bytraffic.rb +++ b/spec/classes/mod/lbmethod_bytraffic.rb @@ -15,7 +15,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -31,7 +31,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") } end end diff --git a/spec/classes/mod/lbmethod_heartbeat.rb b/spec/classes/mod/lbmethod_heartbeat.rb index 94c24ad495..22eb0a8bc5 100644 --- a/spec/classes/mod/lbmethod_heartbeat.rb +++ b/spec/classes/mod/lbmethod_heartbeat.rb @@ -15,7 +15,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -31,7 +31,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") } end end diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index fa3739239c..7cd52100d1 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -29,7 +29,7 @@ it { is_expected.not_to contain_apache__mod('event') } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/prefork.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n") + 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n") } end context 'on a FreeBSD OS' do diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 5f01385fd8..25f1ee8b30 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -26,7 +26,7 @@ it { is_expected.not_to contain_apache__mod('event') } it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n") + 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n") } end context 'on a FreeBSD OS' do diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 5e9aba39f8..1b6b2e4590 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -12,9 +12,9 @@ it { is_expected.to contain_service('httpd').with( - 'name' => 'apache2', - 'ensure' => 'running', - 'enable' => 'true', + 'name' => 'apache2', + 'ensure' => 'running', + 'enable' => 'true', ) } @@ -33,9 +33,9 @@ it { is_expected.to contain_service('httpd').with( - 'name' => 'apache2', - 'ensure' => 'running', - 'enable' => 'true', + 'name' => 'apache2', + 'ensure' => 'running', + 'enable' => 'true', ) } end @@ -45,9 +45,9 @@ it { is_expected.to contain_service('httpd').with( - 'name' => 'apache2', - 'ensure' => 'running', - 'enable' => 'false', + 'name' => 'apache2', + 'ensure' => 'running', + 'enable' => 'false', ) } end @@ -57,8 +57,8 @@ it { is_expected.to contain_service('httpd').with( - 'ensure' => 'running', - 'enable' => 'true', + 'ensure' => 'running', + 'enable' => 'true', ) } end @@ -68,8 +68,8 @@ it { is_expected.to contain_service('httpd').with( - 'ensure' => 'stopped', - 'enable' => 'true', + 'ensure' => 'stopped', + 'enable' => 'true', ) } end @@ -100,7 +100,7 @@ let(:params) do { 'service_ensure' => 'running', - 'service_name' => 'httpd', + 'service_name' => 'httpd', 'service_manage' => false, } end @@ -113,9 +113,9 @@ it { is_expected.to contain_service('httpd').with( - 'name' => 'apache24', - 'ensure' => 'running', - 'enable' => 'true', + 'name' => 'apache24', + 'ensure' => 'running', + 'enable' => 'true', ) } end @@ -125,9 +125,9 @@ it { is_expected.to contain_service('httpd').with( - 'name' => 'apache2', - 'ensure' => 'running', - 'enable' => 'true', + 'name' => 'apache2', + 'ensure' => 'running', + 'enable' => 'true', ) } end diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index 9963d6bd2c..85f03f90c8 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -40,9 +40,9 @@ context 'set everything with source' do let :params do { - 'confdir' => '/dne', - 'priority' => 30, - 'source' => 'puppet:///modules/apache/test', + 'confdir' => '/dne', + 'priority' => 30, + 'source' => 'puppet:///modules/apache/test', 'verify_command' => ['/bin/true'], } end @@ -65,7 +65,7 @@ context 'verify_config => false' do let :params do { - 'content' => '# test', + 'content' => '# test', 'verify_config' => false, } end @@ -90,7 +90,7 @@ let :params do { 'content' => 'foo', - 'source' => 'bar', + 'source' => 'bar', } end diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index b99f7b61b3..2de952ccb0 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -37,298 +37,298 @@ context 'set everything!' do let :params do { - 'docroot' => '/var/www/foo', - 'manage_docroot' => false, - 'virtual_docroot' => true, + 'docroot' => '/var/www/foo', + 'manage_docroot' => false, + 'virtual_docroot' => true, 'virtual_use_default_docroot' => false, - 'port' => 8080, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'add_listen' => false, - 'docroot_owner' => 'user', - 'docroot_group' => 'wheel', - 'docroot_mode' => '0664', - 'serveradmin' => 'foo@localhost', - 'ssl' => true, - 'ssl_cert' => '/ssl/cert', - 'ssl_key' => '/ssl/key', - 'ssl_chain' => '/ssl/chain', - 'ssl_crl_path' => '/ssl/crl', - 'ssl_crl' => '/ssl/foo.crl', - 'ssl_certs_dir' => '/ssl/certs', - 'ssl_protocol' => 'SSLv2', - 'ssl_cipher' => 'HIGH', - 'ssl_honorcipherorder' => 'Off', - 'ssl_verify_client' => 'optional', - 'ssl_verify_depth' => 3, - 'ssl_options' => '+ExportCertData', - 'ssl_openssl_conf_cmd' => 'DHParameters "foo.pem"', - 'ssl_proxy_verify' => 'require', - 'ssl_proxy_check_peer_cn' => 'on', - 'ssl_proxy_check_peer_name' => 'on', + 'port' => 8080, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'add_listen' => false, + 'docroot_owner' => 'user', + 'docroot_group' => 'wheel', + 'docroot_mode' => '0664', + 'serveradmin' => 'foo@localhost', + 'ssl' => true, + 'ssl_cert' => '/ssl/cert', + 'ssl_key' => '/ssl/key', + 'ssl_chain' => '/ssl/chain', + 'ssl_crl_path' => '/ssl/crl', + 'ssl_crl' => '/ssl/foo.crl', + 'ssl_certs_dir' => '/ssl/certs', + 'ssl_protocol' => 'SSLv2', + 'ssl_cipher' => 'HIGH', + 'ssl_honorcipherorder' => 'Off', + 'ssl_verify_client' => 'optional', + 'ssl_verify_depth' => 3, + 'ssl_options' => '+ExportCertData', + 'ssl_openssl_conf_cmd' => 'DHParameters "foo.pem"', + 'ssl_proxy_verify' => 'require', + 'ssl_proxy_check_peer_cn' => 'on', + 'ssl_proxy_check_peer_name' => 'on', 'ssl_proxy_check_peer_expire' => 'on', - 'ssl_proxyengine' => true, - 'ssl_proxy_cipher_suite' => 'HIGH', - 'ssl_proxy_protocol' => 'TLSv1.2', - 'ssl_user_name' => 'SSL_CLIENT_S_DN_CN', - 'ssl_reload_on_change' => true, - 'priority' => 30, - 'default_vhost' => true, - 'servername' => 'example.com', - 'serveraliases' => ['test-example.com'], - 'options' => ['MultiView'], - 'override' => ['All'], - 'directoryindex' => 'index.html', - 'vhost_name' => 'test', - 'logroot' => '/var/www/logs', - 'logroot_ensure' => 'directory', - 'logroot_mode' => '0600', - 'logroot_owner' => 'root', - 'logroot_group' => 'root', - 'log_level' => 'crit', - 'aliases' => [ + 'ssl_proxyengine' => true, + 'ssl_proxy_cipher_suite' => 'HIGH', + 'ssl_proxy_protocol' => 'TLSv1.2', + 'ssl_user_name' => 'SSL_CLIENT_S_DN_CN', + 'ssl_reload_on_change' => true, + 'priority' => 30, + 'default_vhost' => true, + 'servername' => 'example.com', + 'serveraliases' => ['test-example.com'], + 'options' => ['MultiView'], + 'override' => ['All'], + 'directoryindex' => 'index.html', + 'vhost_name' => 'test', + 'logroot' => '/var/www/logs', + 'logroot_ensure' => 'directory', + 'logroot_mode' => '0600', + 'logroot_owner' => 'root', + 'logroot_group' => 'root', + 'log_level' => 'crit', + 'aliases' => [ { 'alias' => '/image', - 'path' => '/rspec/image', + 'path' => '/rspec/image', }, ], - 'access_log' => false, - 'access_log_file' => 'httpd_access_log', - 'access_log_syslog' => true, - 'access_log_format' => '%h %l %u %t \"%r\" %>s %b', - 'access_log_env_var' => '', - 'directories' => [ + 'access_log' => false, + 'access_log_file' => 'httpd_access_log', + 'access_log_syslog' => true, + 'access_log_format' => '%h %l %u %t \"%r\" %>s %b', + 'access_log_env_var' => '', + 'directories' => [ { - 'path' => '/var/www/files', + 'path' => '/var/www/files', 'provider' => 'files', - 'require' => ['valid-user', 'all denied'], + 'require' => ['valid-user', 'all denied'], }, { - 'path' => '/var/www/files', + 'path' => '/var/www/files', 'provider' => 'files', 'additional_includes' => ['/custom/path/includes', '/custom/path/another_includes'], }, { - 'path' => '/var/www/files', + 'path' => '/var/www/files', 'provider' => 'files', - 'require' => 'all granted', + 'require' => 'all granted', }, { - 'path' => '/var/www/files', + 'path' => '/var/www/files', 'provider' => 'files', - 'require' => + 'require' => { - 'enforce' => 'all', + 'enforce' => 'all', 'requires' => ['all-valid1', 'all-valid2'], }, }, { - 'path' => '/var/www/files', + 'path' => '/var/www/files', 'provider' => 'files', - 'require' => + 'require' => { - 'enforce' => 'none', + 'enforce' => 'none', 'requires' => ['none-valid1', 'none-valid2'], }, }, { - 'path' => '/var/www/files', + 'path' => '/var/www/files', 'provider' => 'files', - 'require' => + 'require' => { - 'enforce' => 'any', + 'enforce' => 'any', 'requires' => ['any-valid1', 'any-valid2'], }, }, { - 'path' => '*', + 'path' => '*', 'provider' => 'proxy', }, - { 'path' => '/var/www/files/indexed_directory', - 'directoryindex' => 'disabled', - 'options' => ['Indexes', 'FollowSymLinks', 'MultiViews'], - 'index_options' => ['FancyIndexing'], + { 'path' => '/var/www/files/indexed_directory', + 'directoryindex' => 'disabled', + 'options' => ['Indexes', 'FollowSymLinks', 'MultiViews'], + 'index_options' => ['FancyIndexing'], 'index_style_sheet' => '/styles/style.css' }, - { 'path' => '/var/www/files/output_filtered', + { 'path' => '/var/www/files/output_filtered', 'set_output_filter' => 'output_filter' }, - { 'path' => '/var/www/files/input_filtered', + { 'path' => '/var/www/files/input_filtered', 'set_input_filter' => 'input_filter' }, - { 'path' => '/var/www/files', + { 'path' => '/var/www/files', 'provider' => 'location', - 'limit' => [ + 'limit' => [ { 'methods' => 'GET HEAD', 'require' => ['valid-user'] }, ] }, - { 'path' => '/var/www/files', - 'provider' => 'location', + { 'path' => '/var/www/files', + 'provider' => 'location', 'limit_except' => [ { 'methods' => 'GET HEAD', 'require' => ['valid-user'] }, ] }, - { 'path' => '/var/www/dav', - 'dav' => 'filesystem', + { 'path' => '/var/www/dav', + 'dav' => 'filesystem', 'dav_depth_infinity' => true, - 'dav_min_timeout' => 600 }, + 'dav_min_timeout' => 600 }, { - 'path' => '/var/www/http2', - 'h2_copy_files' => true, + 'path' => '/var/www/http2', + 'h2_copy_files' => true, 'h2_push_resource' => [ '/foo.css', '/foo.js', ], }, { - 'path' => '/', - 'provider' => 'location', + 'path' => '/', + 'provider' => 'location', 'auth_ldap_referrals' => 'off', - 'auth_basic_fake' => 'demo demopass', - 'auth_user_file' => '/path/to/authz_user_file', - 'auth_group_file' => '/path/to/authz_group_file', - 'setenv' => ['SPECIAL_PATH /foo/bin'], + 'auth_basic_fake' => 'demo demopass', + 'auth_user_file' => '/path/to/authz_user_file', + 'auth_group_file' => '/path/to/authz_group_file', + 'setenv' => ['SPECIAL_PATH /foo/bin'], }, { - 'path' => '/proxy', - 'provider' => 'location', + 'path' => '/proxy', + 'provider' => 'location', 'proxy_pass' => [ { - 'url' => 'http://backend-b/', - 'keywords' => ['noquery', 'interpolate'], + 'url' => 'http://backend-b/', + 'keywords' => ['noquery', 'interpolate'], 'params' => { - 'retry' => 0, + 'retry' => 0, 'timeout' => 5, }, }, ], }, { - 'path' => '^/proxy', - 'provider' => 'locationmatch', + 'path' => '^/proxy', + 'provider' => 'locationmatch', 'proxy_pass_match' => [ { - 'url' => 'http://backend-b/', - 'keywords' => ['noquery', 'interpolate'], + 'url' => 'http://backend-b/', + 'keywords' => ['noquery', 'interpolate'], 'params' => { - 'retry' => 0, + 'retry' => 0, 'timeout' => 5, }, }, ], }, { - 'path' => '/var/www/node-app/public', - 'passenger_enabled' => true, - 'passenger_base_uri' => '/app', - 'passenger_ruby' => '/path/to/ruby', - 'passenger_python' => '/path/to/python', - 'passenger_nodejs' => '/path/to/nodejs', - 'passenger_meteor_app_settings' => '/path/to/file.json', - 'passenger_app_env' => 'demo', - 'passenger_app_root' => '/var/www/node-app', - 'passenger_app_group_name' => 'foo_bar', - 'passenger_app_start_command' => 'start-command', - 'passenger_app_type' => 'node', - 'passenger_startup_file' => 'start.js', - 'passenger_restart_dir' => 'temp', - 'passenger_load_shell_envvars' => false, - 'passenger_preload_bundler' => false, - 'passenger_rolling_restarts' => false, - 'passenger_resist_deployment_errors' => false, - 'passenger_user' => 'nodeuser', - 'passenger_group' => 'nodegroup', - 'passenger_friendly_error_pages' => true, - 'passenger_min_instances' => 7, - 'passenger_max_instances' => 9, + 'path' => '/var/www/node-app/public', + 'passenger_enabled' => true, + 'passenger_base_uri' => '/app', + 'passenger_ruby' => '/path/to/ruby', + 'passenger_python' => '/path/to/python', + 'passenger_nodejs' => '/path/to/nodejs', + 'passenger_meteor_app_settings' => '/path/to/file.json', + 'passenger_app_env' => 'demo', + 'passenger_app_root' => '/var/www/node-app', + 'passenger_app_group_name' => 'foo_bar', + 'passenger_app_start_command' => 'start-command', + 'passenger_app_type' => 'node', + 'passenger_startup_file' => 'start.js', + 'passenger_restart_dir' => 'temp', + 'passenger_load_shell_envvars' => false, + 'passenger_preload_bundler' => false, + 'passenger_rolling_restarts' => false, + 'passenger_resist_deployment_errors' => false, + 'passenger_user' => 'nodeuser', + 'passenger_group' => 'nodegroup', + 'passenger_friendly_error_pages' => true, + 'passenger_min_instances' => 7, + 'passenger_max_instances' => 9, 'passenger_force_max_concurrent_requests_per_process' => 12, - 'passenger_start_timeout' => 10, - 'passenger_concurrency_model' => 'thread', - 'passenger_thread_count' => 20, - 'passenger_max_requests' => 2000, - 'passenger_max_request_time' => 1, - 'passenger_memory_limit' => 32, - 'passenger_high_performance' => false, - 'passenger_buffer_upload' => false, - 'passenger_buffer_response' => false, - 'passenger_error_override' => false, - 'passenger_max_request_queue_size' => 120, - 'passenger_max_request_queue_time' => 5, - 'passenger_sticky_sessions' => true, - 'passenger_sticky_sessions_cookie_name' => '_delicious_cookie', - 'passenger_sticky_sessions_cookie_attributes' => 'SameSite=Lax; Secure;', - 'passenger_allow_encoded_slashes' => false, - 'passenger_app_log_file' => '/tmp/app.log', - 'passenger_debugger' => false, - 'gssapi' => { - 'acceptor_name' => '{HOSTNAME}', - 'allowed_mech' => ['krb5', 'iakerb', 'ntlmssp'], - 'authname' => 'Kerberos 5', - 'authtype' => 'GSSAPI', - 'basic_auth' => true, - 'basic_auth_mech' => ['krb5', 'iakerb', 'ntlmssp'], - 'basic_ticket_timeout' => 300, - 'connection_bound' => true, - 'cred_store' => { - 'ccache' => ['/path/to/directory'], + 'passenger_start_timeout' => 10, + 'passenger_concurrency_model' => 'thread', + 'passenger_thread_count' => 20, + 'passenger_max_requests' => 2000, + 'passenger_max_request_time' => 1, + 'passenger_memory_limit' => 32, + 'passenger_high_performance' => false, + 'passenger_buffer_upload' => false, + 'passenger_buffer_response' => false, + 'passenger_error_override' => false, + 'passenger_max_request_queue_size' => 120, + 'passenger_max_request_queue_time' => 5, + 'passenger_sticky_sessions' => true, + 'passenger_sticky_sessions_cookie_name' => '_delicious_cookie', + 'passenger_sticky_sessions_cookie_attributes' => 'SameSite=Lax; Secure;', + 'passenger_allow_encoded_slashes' => false, + 'passenger_app_log_file' => '/tmp/app.log', + 'passenger_debugger' => false, + 'gssapi' => { + 'acceptor_name' => '{HOSTNAME}', + 'allowed_mech' => ['krb5', 'iakerb', 'ntlmssp'], + 'authname' => 'Kerberos 5', + 'authtype' => 'GSSAPI', + 'basic_auth' => true, + 'basic_auth_mech' => ['krb5', 'iakerb', 'ntlmssp'], + 'basic_ticket_timeout' => 300, + 'connection_bound' => true, + 'cred_store' => { + 'ccache' => ['/path/to/directory'], 'client_keytab' => ['/path/to/example.keytab'], - 'keytab' => ['/path/to/example.keytab'], + 'keytab' => ['/path/to/example.keytab'], }, - 'deleg_ccache_dir' => '/path/to/directory', - 'deleg_ccache_env_var' => 'KRB5CCNAME', - 'deleg_ccache_perms' => { + 'deleg_ccache_dir' => '/path/to/directory', + 'deleg_ccache_env_var' => 'KRB5CCNAME', + 'deleg_ccache_perms' => { 'mode' => '0600', - 'uid' => 'example-user', - 'gid' => 'example-group', + 'uid' => 'example-user', + 'gid' => 'example-group', }, - 'deleg_ccache_unique' => true, - 'impersonate' => true, - 'local_name' => true, - 'name_attributes' => 'json', - 'negotiate_once' => true, - 'publish_errors' => true, - 'publish_mech' => true, + 'deleg_ccache_unique' => true, + 'impersonate' => true, + 'local_name' => true, + 'name_attributes' => 'json', + 'negotiate_once' => true, + 'publish_errors' => true, + 'publish_mech' => true, 'required_name_attributes' => 'auth-indicators=high', - 'session_key' => 'file:/path/to/example.key', - 'signal_persistent_auth' => true, - 'ssl_only' => true, - 'use_s4u2_proxy' => true, - 'use_sessions' => true, + 'session_key' => 'file:/path/to/example.key', + 'signal_persistent_auth' => true, + 'ssl_only' => true, + 'use_s4u2_proxy' => true, + 'use_sessions' => true, }, }, { - 'path' => '/private_1', - 'provider' => 'location', - 'ssl_options' => ['+ExportCertData', '+StdEnvVars'], + 'path' => '/private_1', + 'provider' => 'location', + 'ssl_options' => ['+ExportCertData', '+StdEnvVars'], 'ssl_verify_client' => 'optional', - 'ssl_verify_depth' => 10, + 'ssl_verify_depth' => 10, }, ], - 'error_log' => false, - 'error_log_file' => 'httpd_error_log', - 'error_log_syslog' => true, - 'error_log_format' => ['[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i'], - 'error_documents' => 'true', - 'fallbackresource' => '/index.php', - 'scriptalias' => '/usr/lib/cgi-bin', - 'scriptaliases' => [ + 'error_log' => false, + 'error_log_file' => 'httpd_error_log', + 'error_log_syslog' => true, + 'error_log_format' => ['[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i'], + 'error_documents' => 'true', + 'fallbackresource' => '/index.php', + 'scriptalias' => '/usr/lib/cgi-bin', + 'scriptaliases' => [ { 'alias' => '/myscript', - 'path' => '/usr/share/myscript', + 'path' => '/usr/share/myscript', }, { 'aliasmatch' => '^/foo(.*)', - 'path' => '/usr/share/fooscripts$1', + 'path' => '/usr/share/fooscripts$1', }, ], - 'limitreqfieldsize' => 8190, - 'limitreqfields' => 100, - 'limitreqline' => 8190, - 'limitreqbody' => 0, - 'proxy_dest' => '/', - 'proxy_pass' => [ + 'limitreqfieldsize' => 8190, + 'limitreqfields' => 100, + 'limitreqline' => 8190, + 'limitreqbody' => 0, + 'proxy_dest' => '/', + 'proxy_pass' => [ { - 'path' => '/a', - 'url' => 'http://backend-a/', - 'keywords' => ['noquery', 'interpolate'], - 'no_proxy_uris' => ['/a/foo', '/a/bar'], + 'path' => '/a', + 'url' => 'http://backend-a/', + 'keywords' => ['noquery', 'interpolate'], + 'no_proxy_uris' => ['/a/foo', '/a/bar'], 'no_proxy_uris_match' => ['/a/foomatch'], 'reverse_cookies' => [ { @@ -337,47 +337,47 @@ }, { 'domain' => 'foo', - 'url' => 'http://foo', + 'url' => 'http://foo', }, ], 'params' => { - 'retry' => 0, + 'retry' => 0, 'timeout' => 5, }, - 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'], + 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'], }, ], 'proxy_pass_match' => [ { - 'path' => '/a', - 'url' => 'http://backend-a/', + 'path' => '/a', + 'url' => 'http://backend-a/', 'keywords' => ['noquery', 'interpolate'], - 'no_proxy_uris' => ['/a/foo', '/a/bar'], + 'no_proxy_uris' => ['/a/foo', '/a/bar'], 'no_proxy_uris_match' => ['/a/foomatch'], 'params' => { - 'retry' => 0, + 'retry' => 0, 'timeout' => 5, }, 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'], }, ], - 'proxy_requests' => false, - 'php_admin_flags' => ['foo', 'bar'], - 'php_admin_values' => ['true', 'false'], - 'no_proxy_uris' => '/foo', - 'no_proxy_uris_match' => '/foomatch', - 'proxy_preserve_host' => true, - 'proxy_add_headers' => true, - 'proxy_error_override' => true, - 'redirect_source' => '/bar', - 'redirect_dest' => '/', - 'redirect_status' => 'temp', - 'redirectmatch_status' => ['404'], - 'redirectmatch_regexp' => ['\.git$'], - 'redirectmatch_dest' => ['http://www.example.com'], - 'headers' => ['Set X-Robots-Tag "noindex, noarchive, nosnippet"'], - 'request_headers' => ['append MirrorID "mirror 12"'], - 'rewrites' => [ + 'proxy_requests' => false, + 'php_admin_flags' => ['foo', 'bar'], + 'php_admin_values' => ['true', 'false'], + 'no_proxy_uris' => '/foo', + 'no_proxy_uris_match' => '/foomatch', + 'proxy_preserve_host' => true, + 'proxy_add_headers' => true, + 'proxy_error_override' => true, + 'redirect_source' => '/bar', + 'redirect_dest' => '/', + 'redirect_status' => 'temp', + 'redirectmatch_status' => ['404'], + 'redirectmatch_regexp' => ['\.git$'], + 'redirectmatch_dest' => ['http://www.example.com'], + 'headers' => ['Set X-Robots-Tag "noindex, noarchive, nosnippet"'], + 'request_headers' => ['append MirrorID "mirror 12"'], + 'rewrites' => [ { 'rewrite_rule' => ['^index.html$ rewrites.html'], }, @@ -391,142 +391,142 @@ 'FilterChain COMPRESS', 'FilterProtocol COMPRESS DEFLATE change=yes;byteranges=no', ], - 'rewrite_base' => '/', - 'rewrite_rule' => '^index.html$ welcome.html', - 'rewrite_cond' => ['%{HTTP_USER_AGENT} ^MSIE'], - 'rewrite_inherit' => true, - 'setenv' => ['FOO=/bin/true'], - 'setenvif' => 'Request_URI "\.gif$" object_is_image=gif', - 'setenvifnocase' => 'REMOTE_ADDR ^127.0.0.1 localhost=true', - 'block' => 'scm', - 'wsgi_application_group' => '%{GLOBAL}', - 'wsgi_daemon_process' => { 'foo' => { 'python-home' => '/usr' }, 'bar' => {} }, + 'rewrite_base' => '/', + 'rewrite_rule' => '^index.html$ welcome.html', + 'rewrite_cond' => ['%{HTTP_USER_AGENT} ^MSIE'], + 'rewrite_inherit' => true, + 'setenv' => ['FOO=/bin/true'], + 'setenvif' => 'Request_URI "\.gif$" object_is_image=gif', + 'setenvifnocase' => 'REMOTE_ADDR ^127.0.0.1 localhost=true', + 'block' => 'scm', + 'wsgi_application_group' => '%{GLOBAL}', + 'wsgi_daemon_process' => { 'foo' => { 'python-home' => '/usr' }, 'bar' => {} }, 'wsgi_daemon_process_options' => { - 'processes' => 2, - 'threads' => 15, + 'processes' => 2, + 'threads' => 15, 'display-name' => '%{GROUP}', }, - 'wsgi_import_script' => '/var/www/demo.wsgi', - 'wsgi_import_script_options' => { - 'process-group' => 'wsgi', + 'wsgi_import_script' => '/var/www/demo.wsgi', + 'wsgi_import_script_options' => { + 'process-group' => 'wsgi', 'application-group' => '%{GLOBAL}', }, - 'wsgi_process_group' => 'wsgi', - 'wsgi_script_aliases' => { + 'wsgi_process_group' => 'wsgi', + 'wsgi_script_aliases' => { '/' => '/var/www/demo.wsgi', }, 'wsgi_script_aliases_match' => { '^/test/(^[/*)' => '/var/www/demo.wsgi', }, - 'wsgi_pass_authorization' => 'On', - 'custom_fragment' => '#custom string', - 'itk' => { - 'user' => 'someuser', + 'wsgi_pass_authorization' => 'On', + 'custom_fragment' => '#custom string', + 'itk' => { + 'user' => 'someuser', 'group' => 'somegroup', }, - 'wsgi_chunked_request' => 'On', - 'action' => 'foo', - 'additional_includes' => '/custom/path/includes', - 'use_optional_includes' => true, - 'suexec_user_group' => 'root root', - 'allow_encoded_slashes' => 'nodecode', - 'use_canonical_name' => 'dns', - - 'h2_copy_files' => false, - 'h2_direct' => true, - 'h2_early_hints' => false, - 'h2_max_session_streams' => 100, - 'h2_modern_tls_only' => true, - 'h2_push' => true, - 'h2_push_diary_size' => 256, - 'h2_push_priority' => [ + 'wsgi_chunked_request' => 'On', + 'action' => 'foo', + 'additional_includes' => '/custom/path/includes', + 'use_optional_includes' => true, + 'suexec_user_group' => 'root root', + 'allow_encoded_slashes' => 'nodecode', + 'use_canonical_name' => 'dns', + + 'h2_copy_files' => false, + 'h2_direct' => true, + 'h2_early_hints' => false, + 'h2_max_session_streams' => 100, + 'h2_modern_tls_only' => true, + 'h2_push' => true, + 'h2_push_diary_size' => 256, + 'h2_push_priority' => [ 'application/json 32', ], 'h2_push_resource' => [ '/css/main.css', '/js/main.js', ], - 'h2_serialize_headers' => false, - 'h2_stream_max_mem_size' => 65_536, - 'h2_tls_cool_down_secs' => 1, - 'h2_tls_warm_up_size' => 1_048_576, - 'h2_upgrade' => true, - 'h2_window_size' => 65_535, - - 'passenger_enabled' => false, - 'passenger_base_uri' => '/app', - 'passenger_ruby' => '/usr/bin/ruby1.9.1', - 'passenger_python' => '/usr/local/bin/python', - 'passenger_nodejs' => '/usr/bin/node', - 'passenger_meteor_app_settings' => '/path/to/some/file.json', - 'passenger_app_env' => 'test', - 'passenger_app_root' => '/usr/share/myapp', - 'passenger_app_group_name' => 'app_customer', - 'passenger_app_start_command' => 'start-my-app', - 'passenger_app_type' => 'rack', - 'passenger_startup_file' => 'bin/www', - 'passenger_restart_dir' => 'tmp', - 'passenger_spawn_method' => 'direct', - 'passenger_load_shell_envvars' => false, - 'passenger_preload_bundler' => false, - 'passenger_rolling_restarts' => false, - 'passenger_resist_deployment_errors' => true, - 'passenger_user' => 'sandbox', - 'passenger_group' => 'sandbox', - 'passenger_friendly_error_pages' => false, - 'passenger_min_instances' => 1, - 'passenger_max_instances' => 30, - 'passenger_max_preloader_idle_time' => 600, + 'h2_serialize_headers' => false, + 'h2_stream_max_mem_size' => 65_536, + 'h2_tls_cool_down_secs' => 1, + 'h2_tls_warm_up_size' => 1_048_576, + 'h2_upgrade' => true, + 'h2_window_size' => 65_535, + + 'passenger_enabled' => false, + 'passenger_base_uri' => '/app', + 'passenger_ruby' => '/usr/bin/ruby1.9.1', + 'passenger_python' => '/usr/local/bin/python', + 'passenger_nodejs' => '/usr/bin/node', + 'passenger_meteor_app_settings' => '/path/to/some/file.json', + 'passenger_app_env' => 'test', + 'passenger_app_root' => '/usr/share/myapp', + 'passenger_app_group_name' => 'app_customer', + 'passenger_app_start_command' => 'start-my-app', + 'passenger_app_type' => 'rack', + 'passenger_startup_file' => 'bin/www', + 'passenger_restart_dir' => 'tmp', + 'passenger_spawn_method' => 'direct', + 'passenger_load_shell_envvars' => false, + 'passenger_preload_bundler' => false, + 'passenger_rolling_restarts' => false, + 'passenger_resist_deployment_errors' => true, + 'passenger_user' => 'sandbox', + 'passenger_group' => 'sandbox', + 'passenger_friendly_error_pages' => false, + 'passenger_min_instances' => 1, + 'passenger_max_instances' => 30, + 'passenger_max_preloader_idle_time' => 600, 'passenger_force_max_concurrent_requests_per_process' => 10, - 'passenger_start_timeout' => 600, - 'passenger_concurrency_model' => 'thread', - 'passenger_thread_count' => 5, - 'passenger_max_requests' => 1000, - 'passenger_max_request_time' => 2, - 'passenger_memory_limit' => 64, - 'passenger_stat_throttle_rate' => 5, - 'passenger_pre_start' => 'http://localhost/myapp', - 'passenger_high_performance' => true, - 'passenger_buffer_upload' => false, - 'passenger_buffer_response' => false, - 'passenger_error_override' => true, - 'passenger_max_request_queue_size' => 10, - 'passenger_max_request_queue_time' => 2, - 'passenger_sticky_sessions' => true, + 'passenger_start_timeout' => 600, + 'passenger_concurrency_model' => 'thread', + 'passenger_thread_count' => 5, + 'passenger_max_requests' => 1000, + 'passenger_max_request_time' => 2, + 'passenger_memory_limit' => 64, + 'passenger_stat_throttle_rate' => 5, + 'passenger_pre_start' => 'http://localhost/myapp', + 'passenger_high_performance' => true, + 'passenger_buffer_upload' => false, + 'passenger_buffer_response' => false, + 'passenger_error_override' => true, + 'passenger_max_request_queue_size' => 10, + 'passenger_max_request_queue_time' => 2, + 'passenger_sticky_sessions' => true, 'passenger_sticky_sessions_cookie_name' => '_nom_nom_nom', 'passenger_sticky_sessions_cookie_attributes' => 'Nom=nom; Secure;', - 'passenger_allow_encoded_slashes' => true, - 'passenger_app_log_file' => '/app/log/file', - 'passenger_debugger' => true, - 'passenger_lve_min_uid' => 500, - 'add_default_charset' => 'UTF-8', - 'jk_mounts' => [ + 'passenger_allow_encoded_slashes' => true, + 'passenger_app_log_file' => '/app/log/file', + 'passenger_debugger' => true, + 'passenger_lve_min_uid' => 500, + 'add_default_charset' => 'UTF-8', + 'jk_mounts' => [ { 'mount' => '/*', 'worker' => 'tcnode1' }, { 'unmount' => '/*.jpg', 'worker' => 'tcnode1' }, ], - 'auth_kerb' => true, - 'krb_method_negotiate' => 'off', - 'krb_method_k5passwd' => 'off', - 'krb_authoritative' => 'off', - 'krb_auth_realms' => ['EXAMPLE.ORG', 'EXAMPLE.NET'], - 'krb_5keytab' => '/tmp/keytab5', - 'krb_local_user_mapping' => 'off', + 'auth_kerb' => true, + 'krb_method_negotiate' => 'off', + 'krb_method_k5passwd' => 'off', + 'krb_authoritative' => 'off', + 'krb_auth_realms' => ['EXAMPLE.ORG', 'EXAMPLE.NET'], + 'krb_5keytab' => '/tmp/keytab5', + 'krb_local_user_mapping' => 'off', 'http_protocol_options' => 'Strict LenientMethods Allow0.9', - 'keepalive' => 'on', - 'keepalive_timeout' => 100, - 'max_keepalive_requests' => 1000, - 'protocols' => ['h2', 'http/1.1'], - 'protocols_honor_order' => true, - 'auth_oidc' => true, - 'oidc_settings' => { 'ProviderMetadataURL' => 'https://login.example.com/.well-known/openid-configuration', - 'ClientID' => 'test', - 'RedirectURI' => 'https://login.example.com/redirect_uri', - 'ProviderTokenEndpointAuth' => 'client_secret_basic', - 'RemoteUserClaim' => 'sub', - 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', - 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, - 'mdomain' => 'example.com example.net auto', - 'userdir' => 'disabled', + 'keepalive' => 'on', + 'keepalive_timeout' => 100, + 'max_keepalive_requests' => 1000, + 'protocols' => ['h2', 'http/1.1'], + 'protocols_honor_order' => true, + 'auth_oidc' => true, + 'oidc_settings' => { 'ProviderMetadataURL' => 'https://login.example.com/.well-known/openid-configuration', + 'ClientID' => 'test', + 'RedirectURI' => 'https://login.example.com/redirect_uri', + 'ProviderTokenEndpointAuth' => 'client_secret_basic', + 'RemoteUserClaim' => 'sub', + 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', + 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, + 'mdomain' => 'example.com example.net auto', + 'userdir' => 'disabled', } end @@ -575,9 +575,9 @@ it { is_expected.to contain_class('apache::mod::wsgi') } it { is_expected.to contain_concat('30-rspec.example.com.conf').with('owner' => 'root', - 'mode' => '0644', + 'mode' => '0644', 'require' => 'Package[httpd]', - 'notify' => 'Class[Apache::Service]') + 'notify' => 'Class[Apache::Service]') } if os_facts[:os]['release']['major'].to_i >= 18 && os_facts[:os]['name'] == 'Ubuntu' it { @@ -907,24 +907,24 @@ context 'vhost with proxy_add_headers true' do let :params do { - 'docroot' => '/var/www/foo', - 'manage_docroot' => false, - 'virtual_docroot' => true, + 'docroot' => '/var/www/foo', + 'manage_docroot' => false, + 'virtual_docroot' => true, 'virtual_use_default_docroot' => false, - 'port' => 8080, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'add_listen' => false, - 'serveradmin' => 'foo@localhost', - 'priority' => 30, - 'default_vhost' => true, - 'servername' => 'example.com', - 'serveraliases' => ['test-example.com'], - 'options' => ['MultiView'], - 'override' => ['All'], - 'directoryindex' => 'index.html', - 'vhost_name' => 'test', - 'proxy_add_headers' => true, + 'port' => 8080, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'add_listen' => false, + 'serveradmin' => 'foo@localhost', + 'priority' => 30, + 'default_vhost' => true, + 'servername' => 'example.com', + 'serveraliases' => ['test-example.com'], + 'options' => ['MultiView'], + 'override' => ['All'], + 'directoryindex' => 'index.html', + 'vhost_name' => 'test', + 'proxy_add_headers' => true, } end @@ -934,24 +934,24 @@ context 'vhost with proxy_add_headers false' do let :params do { - 'docroot' => '/var/www/foo', - 'manage_docroot' => false, - 'virtual_docroot' => true, + 'docroot' => '/var/www/foo', + 'manage_docroot' => false, + 'virtual_docroot' => true, 'virtual_use_default_docroot' => false, - 'port' => 8080, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'add_listen' => false, - 'serveradmin' => 'foo@localhost', - 'priority' => 30, - 'default_vhost' => true, - 'servername' => 'example.com', - 'serveraliases' => ['test-example.com'], - 'options' => ['MultiView'], - 'override' => ['All'], - 'directoryindex' => 'index.html', - 'vhost_name' => 'test', - 'proxy_add_headers' => false, + 'port' => 8080, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'add_listen' => false, + 'serveradmin' => 'foo@localhost', + 'priority' => 30, + 'default_vhost' => true, + 'servername' => 'example.com', + 'serveraliases' => ['test-example.com'], + 'options' => ['MultiView'], + 'override' => ['All'], + 'directoryindex' => 'index.html', + 'vhost_name' => 'test', + 'proxy_add_headers' => false, } end @@ -961,23 +961,23 @@ context 'vhost without proxy' do let :params do { - 'docroot' => '/var/www/foo', - 'manage_docroot' => false, - 'virtual_docroot' => true, + 'docroot' => '/var/www/foo', + 'manage_docroot' => false, + 'virtual_docroot' => true, 'virtual_use_default_docroot' => false, - 'port' => 8080, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'add_listen' => false, - 'serveradmin' => 'foo@localhost', - 'priority' => 30, - 'default_vhost' => true, - 'servername' => 'example.com', - 'serveraliases' => ['test-example.com'], - 'options' => ['MultiView'], - 'override' => ['All'], - 'directoryindex' => 'index.html', - 'vhost_name' => 'test', + 'port' => 8080, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'add_listen' => false, + 'serveradmin' => 'foo@localhost', + 'priority' => 30, + 'default_vhost' => true, + 'servername' => 'example.com', + 'serveraliases' => ['test-example.com'], + 'options' => ['MultiView'], + 'override' => ['All'], + 'directoryindex' => 'index.html', + 'vhost_name' => 'test', } end @@ -987,24 +987,24 @@ context 'vhost without proxy_add_headers' do let :params do { - 'docroot' => '/var/www/foo', - 'manage_docroot' => false, - 'virtual_docroot' => true, + 'docroot' => '/var/www/foo', + 'manage_docroot' => false, + 'virtual_docroot' => true, 'virtual_use_default_docroot' => false, - 'port' => 8080, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'add_listen' => false, - 'serveradmin' => 'foo@localhost', - 'priority' => 30, - 'default_vhost' => true, - 'servername' => 'example.com', - 'serveraliases' => ['test-example.com'], - 'options' => ['MultiView'], - 'override' => ['All'], - 'directoryindex' => 'index.html', - 'vhost_name' => 'test', - 'proxy_preserve_host' => true, + 'port' => 8080, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'add_listen' => false, + 'serveradmin' => 'foo@localhost', + 'priority' => 30, + 'default_vhost' => true, + 'servername' => 'example.com', + 'serveraliases' => ['test-example.com'], + 'options' => ['MultiView'], + 'override' => ['All'], + 'directoryindex' => 'index.html', + 'vhost_name' => 'test', + 'proxy_preserve_host' => true, } end @@ -1014,14 +1014,14 @@ context 'vhost with scheme and port in servername and use_servername_for_filenames' do let :params do { - 'port' => 80, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'servername' => 'https://www.example.com:443', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', - 'use_servername_for_filenames' => true + 'port' => 80, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'servername' => 'https://www.example.com:443', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', + 'use_servername_for_filenames' => true } end @@ -1038,14 +1038,14 @@ context 'vhost with scheme in servername and use_servername_for_filenames' do let :params do { - 'port' => 80, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'servername' => 'https://www.example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', - 'use_servername_for_filenames' => true + 'port' => 80, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'servername' => 'https://www.example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', + 'use_servername_for_filenames' => true } end @@ -1062,14 +1062,14 @@ context 'vhost with port in servername and use_servername_for_filenames' do let :params do { - 'port' => 80, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'servername' => 'www.example.com:443', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', - 'use_servername_for_filenames' => true + 'port' => 80, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'servername' => 'www.example.com:443', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', + 'use_servername_for_filenames' => true } end @@ -1086,14 +1086,14 @@ context 'vhost with servername and use_servername_for_filenames' do let :params do { - 'port' => 80, - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'servername' => 'www.example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', - 'use_servername_for_filenames' => true + 'port' => 80, + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'servername' => 'www.example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', + 'use_servername_for_filenames' => true } end @@ -1110,13 +1110,13 @@ context 'vhost with multiple ip addresses' do let :params do { - 'port' => 80, - 'ip' => ['127.0.0.1', '::1'], - 'ip_based' => true, - 'servername' => 'example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', + 'port' => 80, + 'ip' => ['127.0.0.1', '::1'], + 'ip_based' => true, + 'servername' => 'example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', } end @@ -1135,13 +1135,13 @@ context 'vhost with multiple ports' do let :params do { - 'port' => [80, 8080], - 'ip' => '127.0.0.1', - 'ip_based' => true, - 'servername' => 'example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', + 'port' => [80, 8080], + 'ip' => '127.0.0.1', + 'ip_based' => true, + 'servername' => 'example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', } end @@ -1160,13 +1160,13 @@ context 'vhost with multiple ip addresses, multiple ports' do let :params do { - 'port' => [80, 8080], - 'ip' => ['127.0.0.1', '::1'], - 'ip_based' => true, - 'servername' => 'example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', + 'port' => [80, 8080], + 'ip' => ['127.0.0.1', '::1'], + 'ip_based' => true, + 'servername' => 'example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', } end @@ -1189,13 +1189,13 @@ context 'vhost with ipv6 address' do let :params do { - 'port' => 80, - 'ip' => '::1', - 'ip_based' => true, - 'servername' => 'example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', + 'port' => 80, + 'ip' => '::1', + 'ip_based' => true, + 'servername' => 'example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', } end @@ -1212,13 +1212,13 @@ context 'vhost with wildcard ip address' do let :params do { - 'port' => 80, - 'ip' => '*', - 'ip_based' => true, - 'servername' => 'example.com', - 'docroot' => '/var/www/html', - 'add_listen' => true, - 'ensure' => 'present', + 'port' => 80, + 'ip' => '*', + 'ip_based' => true, + 'servername' => 'example.com', + 'docroot' => '/var/www/html', + 'add_listen' => true, + 'ensure' => 'present', } end @@ -1235,7 +1235,7 @@ context 'vhost with backwards compatible virtual_docroot' do let :params do { - 'docroot' => '/var/www/html', + 'docroot' => '/var/www/html', 'virtual_docroot' => '/var/www/sites/%0', } end @@ -1255,9 +1255,9 @@ context 'vhost with virtual_docroot and docroot' do let :params do { - 'docroot' => '/var/www/html', + 'docroot' => '/var/www/html', 'virtual_use_default_docroot' => true, - 'virtual_docroot' => '/var/www/sites/%0', + 'virtual_docroot' => '/var/www/sites/%0', } end @@ -1277,7 +1277,7 @@ context 'modsec_audit_log' do let :params do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'modsec_audit_log' => true, } end @@ -1292,7 +1292,7 @@ context 'modsec_audit_log_file' do let :params do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'modsec_audit_log_file' => 'foo.log', } end @@ -1308,8 +1308,8 @@ context 'modsec_anomaly_threshold' do let :params do { - 'docroot' => '/rspec/docroot', - 'modsec_inbound_anomaly_threshold' => 10_000, + 'docroot' => '/rspec/docroot', + 'modsec_inbound_anomaly_threshold' => 10_000, 'modsec_outbound_anomaly_threshold' => 10_000, } end @@ -1334,7 +1334,7 @@ context 'modsec_allowed_methods' do let :params do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'modsec_allowed_methods' => 'GET HEAD POST OPTIONS', } end @@ -1361,7 +1361,7 @@ 'aliases' => [ { 'alias' => '/alias', - 'path' => '/rspec/docroot', + 'path' => '/rspec/docroot', }, ], } @@ -1375,9 +1375,9 @@ 'docroot' => '/rspec/docroot', 'proxy_pass_match' => [ { - 'path' => '.*', - 'url' => 'http://backend-a/', - 'params' => { 'timeout' => 300 }, + 'path' => '.*', + 'url' => 'http://backend-a/', + 'params' => { 'timeout' => 300 }, }, ], } @@ -1393,7 +1393,7 @@ context 'proxy_dest_match and no proxy_dest_reverse_match' do let :params do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'proxy_dest_match' => '/', } end @@ -1406,8 +1406,8 @@ context 'proxy_dest_match and proxy_dest_reverse_match' do let :params do { - 'docroot' => '/rspec/docroot', - 'proxy_dest_match' => '/', + 'docroot' => '/rspec/docroot', + 'proxy_dest_match' => '/', 'proxy_dest_reverse_match' => 'http://localhost:8180', } end @@ -1421,12 +1421,12 @@ let :params do { 'access_log_pipe' => '/dev/null', - 'error_log_pipe' => '/dev/null', - 'docroot' => '/var/www/foo', - 'ensure' => 'absent', - 'manage_docroot' => true, - 'logroot' => '/tmp/logroot', - 'logroot_ensure' => 'absent', + 'error_log_pipe' => '/dev/null', + 'docroot' => '/var/www/foo', + 'ensure' => 'absent', + 'manage_docroot' => true, + 'logroot' => '/tmp/logroot', + 'logroot_ensure' => 'absent', } end @@ -1487,8 +1487,8 @@ context 'wsgi_application_group should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_application_group' => '%{GLOBAL}', + 'docroot' => '/rspec/docroot', + 'wsgi_application_group' => '%{GLOBAL}', } end @@ -1497,7 +1497,7 @@ context 'wsgi_daemon_process should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'wsgi_daemon_process' => { 'foo' => { 'python-home' => '/usr' }, 'bar' => {} }, } end @@ -1507,8 +1507,8 @@ context 'wsgi_import_script on its own should not set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_import_script' => '/var/www/demo.wsgi', + 'docroot' => '/rspec/docroot', + 'wsgi_import_script' => '/var/www/demo.wsgi', } end @@ -1519,8 +1519,8 @@ { 'docroot' => '/rspec/docroot', 'wsgi_import_script_options' => { - 'process-group' => 'wsgi', - 'application-group' => '%{GLOBAL}', + 'process-group' => 'wsgi', + 'application-group' => '%{GLOBAL}', }, } end @@ -1530,11 +1530,11 @@ context 'wsgi_import_script and wsgi_import_script_options should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_import_script' => '/var/www/demo.wsgi', - 'wsgi_import_script_options' => { - 'process-group' => 'wsgi', - 'application-group' => '%{GLOBAL}', + 'docroot' => '/rspec/docroot', + 'wsgi_import_script' => '/var/www/demo.wsgi', + 'wsgi_import_script_options' => { + 'process-group' => 'wsgi', + 'application-group' => '%{GLOBAL}', }, } end @@ -1544,8 +1544,8 @@ context 'wsgi_process_group should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_daemon_process' => 'wsgi', + 'docroot' => '/rspec/docroot', + 'wsgi_daemon_process' => 'wsgi', } end @@ -1554,8 +1554,8 @@ context 'wsgi_script_aliases with non-empty aliases should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_script_aliases' => { + 'docroot' => '/rspec/docroot', + 'wsgi_script_aliases' => { '/' => '/var/www/demo.wsgi', }, } @@ -1566,8 +1566,8 @@ context 'wsgi_script_aliases with empty aliases should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_script_aliases' => {}, + 'docroot' => '/rspec/docroot', + 'wsgi_script_aliases' => {}, } end @@ -1576,8 +1576,8 @@ context 'wsgi_pass_authorization should set apache::mod::wsgi' do let :params do { - 'docroot' => '/rspec/docroot', - 'wsgi_pass_authorization' => 'On', + 'docroot' => '/rspec/docroot', + 'wsgi_pass_authorization' => 'On', } end @@ -1586,8 +1586,8 @@ context 'when not setting nor managing the docroot' do let :params do { - 'docroot' => false, - 'manage_docroot' => false, + 'docroot' => false, + 'manage_docroot' => false, } end @@ -1597,8 +1597,8 @@ context 'ssl_proxyengine without ssl' do let :params do { - 'docroot' => '/rspec/docroot', - 'ssl' => false, + 'docroot' => '/rspec/docroot', + 'ssl' => false, 'ssl_proxyengine' => true, } end @@ -1610,9 +1610,9 @@ context 'ssl_proxy_protocol without ssl_proxyengine' do let :params do { - 'docroot' => '/rspec/docroot', - 'ssl' => true, - 'ssl_proxyengine' => false, + 'docroot' => '/rspec/docroot', + 'ssl' => true, + 'ssl_proxyengine' => false, 'ssl_proxy_protocol' => 'TLSv1.2', } end @@ -1624,8 +1624,8 @@ context 'ssl_honorcipherorder' do let :params do { - 'docroot' => '/rspec/docroot', - 'ssl' => true, + 'docroot' => '/rspec/docroot', + 'ssl' => true, } end @@ -1671,7 +1671,7 @@ context 'single log file' do let(:params) do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'access_log_file' => 'my_log_file', } end @@ -1685,8 +1685,8 @@ context 'single log file with environment' do let(:params) do { - 'docroot' => '/rspec/docroot', - 'access_log_file' => 'my_log_file', + 'docroot' => '/rspec/docroot', + 'access_log_file' => 'my_log_file', 'access_log_env_var' => 'prod', } end @@ -1700,7 +1700,7 @@ context 'multiple log files' do let(:params) do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'access_logs' => [ { 'file' => '/tmp/log1', 'env' => 'dev' }, { 'file' => 'log2' }, @@ -1730,7 +1730,7 @@ context 'single log format directive as a string' do let(:params) do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'error_log_format' => ['[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i'], } end @@ -1745,7 +1745,7 @@ context 'multiple log format directives' do let(:params) do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot', 'error_log_format' => [ '[%{uc}t] [%-m:%-l] [R:%L] [C:%{C}L] %7F: %E: %M', { '[%{uc}t] [R:%L] Request %k on C:%{c}L pid:%P tid:%T' => 'request' }, @@ -1880,10 +1880,10 @@ context 'default of require all granted' do let :params do { - 'docroot' => '/var/www/foo', - 'directories' => [ + 'docroot' => '/var/www/foo', + 'directories' => [ { - 'path' => '/var/www/foo/files', + 'path' => '/var/www/foo/files', 'provider' => 'files', }, ], @@ -1908,11 +1908,11 @@ context 'require unmanaged' do let :params do { - 'docroot' => '/var/www/foo', - 'directories' => [ + 'docroot' => '/var/www/foo', + 'directories' => [ { - 'path' => '/var/www/foo', - 'require' => 'unmanaged', + 'path' => '/var/www/foo', + 'require' => 'unmanaged', }, ], @@ -1948,12 +1948,12 @@ default_params.merge( 'auth_oidc' => true, 'oidc_settings' => { 'ProviderMetadataURL' => 'https://login.example.com/.well-known/openid-configuration', - 'ClientID' => 'test', - 'RedirectURI' => '/some/valid/relative/uri', + 'ClientID' => 'test', + 'RedirectURI' => '/some/valid/relative/uri', 'ProviderTokenEndpointAuth' => 'client_secret_basic', - 'RemoteUserClaim' => 'sub', - 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', - 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, + 'RemoteUserClaim' => 'sub', + 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', + 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, ) end @@ -1970,12 +1970,12 @@ default_params.merge( 'auth_oidc' => true, 'oidc_settings' => { 'ProviderMetadataURL' => 'https://login.example.com/.well-known/openid-configuration', - 'ClientID' => 'test', - 'RedirectURI' => 'invalid_uri', + 'ClientID' => 'test', + 'RedirectURI' => 'invalid_uri', 'ProviderTokenEndpointAuth' => 'client_secret_basic', - 'RemoteUserClaim' => 'sub', - 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', - 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, + 'RemoteUserClaim' => 'sub', + 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', + 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, ) end diff --git a/util/apache_mod_platform_support.rb b/util/apache_mod_platform_support.rb index 5c608cf53d..e61196e018 100644 --- a/util/apache_mod_platform_support.rb +++ b/util/apache_mod_platform_support.rb @@ -22,8 +22,8 @@ # ... class ApacheModPlatformCompatibility ERROR_MSG = { - tag_parse: 'OS and version information in incorrect format:', - os_parse: 'OS name is not present in metadata.json:', + tag_parse: 'OS and version information in incorrect format:', + os_parse: 'OS name is not present in metadata.json:', }.freeze def initialize From 599a9e6125901bb39b8137e5b9ac3731e58c3cd4 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Wed, 19 Apr 2023 18:42:15 +0100 Subject: [PATCH 08/17] (CONT-772) Correct cop group 1 --- .rubocop_todo.yml | 51 +--------------- lib/puppet/functions/apache/bool2httpd.rb | 1 + spec/acceptance/itk_spec.rb | 4 +- spec/acceptance/mod_authnz_ldap_spec.rb | 4 +- spec/acceptance/vhost_spec.rb | 2 +- spec/classes/mod/authnz_ldap_spec.rb | 1 + spec/classes/mod/deflate_spec.rb | 14 ++--- spec/classes/mod/http2_spec.rb | 58 +++++++++---------- spec/classes/mod/info_spec.rb | 20 +++---- spec/classes/mod/jk_spec.rb | 38 ++++++------ spec/classes/mod/lbmethod_bybusyness.rb | 2 + spec/classes/mod/lbmethod_byrequests.rb | 2 + spec/classes/mod/lbmethod_bytraffic.rb | 2 + spec/classes/mod/lbmethod_heartbeat.rb | 2 + spec/classes/mod/ldap_spec.rb | 6 +- spec/classes/mod/proxy_balancer_spec.rb | 6 +- spec/classes/mod/status_spec.rb | 20 +++---- spec/spec_helper_acceptance_local.rb | 1 + .../apache_mod_platform_compatibility_spec.rb | 6 +- tasks/init.rb | 1 + util/apache_mod_platform_support.rb | 4 ++ 21 files changed, 106 insertions(+), 139 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 6eb72d69e8..ac13bf6a83 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,60 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-19 16:57:14 UTC using RuboCop version 1.48.1. +# on 2023-04-19 17:41:01 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -Layout/ClosingHeredocIndentation: - Exclude: - - 'spec/acceptance/itk_spec.rb' - - 'spec/acceptance/mod_authnz_ldap_spec.rb' - - 'spec/acceptance/vhost_spec.rb' - -# Offense count: 8 -# This cop supports safe autocorrection (--autocorrect). -Layout/EmptyLineAfterGuardClause: - Exclude: - - 'lib/puppet/functions/apache/bool2httpd.rb' - - 'spec/classes/mod/authnz_ldap_spec.rb' - - 'spec/spec_helper_acceptance_local.rb' - - 'tasks/init.rb' - - 'util/apache_mod_platform_support.rb' - -# Offense count: 2 -# This cop supports safe autocorrection (--autocorrect). -Layout/HeredocIndentation: - Exclude: - - 'spec/classes/mod/http2_spec.rb' - -# Offense count: 15 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: leading, trailing -Layout/LineContinuationLeadingSpace: - Exclude: - - 'spec/classes/mod/info_spec.rb' - - 'spec/classes/mod/jk_spec.rb' - - 'spec/classes/mod/proxy_balancer_spec.rb' - - 'spec/classes/mod/status_spec.rb' - - 'spec/util/apache_mod_platform_compatibility_spec.rb' - -# Offense count: 52 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AutoCorrect, EnforcedStyle. -# SupportedStyles: space, no_space -Layout/LineContinuationSpacing: - Exclude: - - 'spec/classes/mod/deflate_spec.rb' - - 'spec/classes/mod/info_spec.rb' - - 'spec/classes/mod/jk_spec.rb' - - 'spec/classes/mod/ldap_spec.rb' - - 'spec/classes/mod/proxy_balancer_spec.rb' - - 'spec/classes/mod/status_spec.rb' - # Offense count: 4 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: EnforcedStyle, IndentationWidth. diff --git a/lib/puppet/functions/apache/bool2httpd.rb b/lib/puppet/functions/apache/bool2httpd.rb index 1fb71c590c..b864c8675f 100644 --- a/lib/puppet/functions/apache/bool2httpd.rb +++ b/lib/puppet/functions/apache/bool2httpd.rb @@ -21,6 +21,7 @@ def bool2httpd(arg) return 'Off' if arg.nil? || arg == false || matches_string?(arg, %r{false}i) || arg == :undef return 'On' if arg == true || matches_string?(arg, %r{true}i) + arg.to_s end diff --git a/spec/acceptance/itk_spec.rb b/spec/acceptance/itk_spec.rb index c5ef34b9c4..914cc7aeb5 100644 --- a/spec/acceptance/itk_spec.rb +++ b/spec/acceptance/itk_spec.rb @@ -28,13 +28,13 @@ class { 'apache': mpm_module => 'prefork', } class { 'apache::mod::itk': } - MANIFEST + MANIFEST when :itk_only <<-MANIFEST class { 'apache': mpm_module => 'itk', } - MANIFEST + MANIFEST end end diff --git a/spec/acceptance/mod_authnz_ldap_spec.rb b/spec/acceptance/mod_authnz_ldap_spec.rb index 82615ab624..aa92bcf51b 100644 --- a/spec/acceptance/mod_authnz_ldap_spec.rb +++ b/spec/acceptance/mod_authnz_ldap_spec.rb @@ -18,12 +18,12 @@ } class { 'apache': } class { 'apache::mod::authnz_ldap': } - MANIFEST + MANIFEST else <<-MANIFEST class { 'apache': } class { 'apache::mod::authnz_ldap': } - MANIFEST + MANIFEST end it 'succeeds in installing the mod_authnz_ldap module' do diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 3d21aef1e3..e10d22dbb2 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -299,7 +299,7 @@ class { 'apache': } content => "Hello World\\n", } host { 'files.example.net': ip => '127.0.0.1', } - MANIFEST + MANIFEST end describe 'readme example, adapted' do diff --git a/spec/classes/mod/authnz_ldap_spec.rb b/spec/classes/mod/authnz_ldap_spec.rb index 27f75d66bd..e9b4feeca1 100644 --- a/spec/classes/mod/authnz_ldap_spec.rb +++ b/spec/classes/mod/authnz_ldap_spec.rb @@ -34,6 +34,7 @@ context 'default configuration with parameters on a RedHat OS' do on_supported_os.each do |os, os_facts| next unless os.start_with?('redhat') + context "On #{os}" do let :facts do os_facts diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index 96ecaa0f82..a3cafcff6c 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -6,13 +6,13 @@ def general_deflate_specs it { is_expected.to contain_apache__mod('deflate') } - expected = "AddOutputFilterByType DEFLATE application/rss+xml\n"\ - "AddOutputFilterByType DEFLATE application/x-javascript\n"\ - "AddOutputFilterByType DEFLATE text/css\n"\ - "AddOutputFilterByType DEFLATE text/html\n"\ - "\n"\ - "DeflateFilterNote Input instream\n"\ - "DeflateFilterNote Output outstream\n"\ + expected = "AddOutputFilterByType DEFLATE application/rss+xml\n" \ + "AddOutputFilterByType DEFLATE application/x-javascript\n" \ + "AddOutputFilterByType DEFLATE text/css\n" \ + "AddOutputFilterByType DEFLATE text/html\n" \ + "\n" \ + "DeflateFilterNote Input instream\n" \ + "DeflateFilterNote Output outstream\n" \ "DeflateFilterNote Ratio ratio\n" it do diff --git a/spec/classes/mod/http2_spec.rb b/spec/classes/mod/http2_spec.rb index 530ef32c35..3c57e15cc1 100644 --- a/spec/classes/mod/http2_spec.rb +++ b/spec/classes/mod/http2_spec.rb @@ -11,11 +11,11 @@ it { is_expected.to contain_class('apache::mod::http2') } context 'with default values' do let(:expected_content) do - <\n" it { is_expected.to contain_file('info.conf').with_content(expected) } end @@ -21,8 +21,8 @@ def general_info_specs_apache24 it { is_expected.to contain_file('info.conf').with_content( - "\n"\ - " SetHandler server-info\n"\ + "\n " \ + "SetHandler server-info\n" \ "\n", ) } @@ -32,9 +32,9 @@ def general_info_specs_apache24 { allow_from: ['10.10.1.2', '192.168.1.2', '127.0.0.1'] } end - expected = "\n"\ - " SetHandler server-info\n"\ - " Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n"\ + expected = "\n " \ + "SetHandler server-info\n " \ + "Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n" \ "\n" it { is_expected.to contain_file('info.conf').with_content(expected) @@ -50,8 +50,8 @@ def general_info_specs_apache24 it { is_expected.to contain_file('info.conf').with_content( - "\n"\ - " SetHandler server-info\n"\ + "\n " \ + "SetHandler server-info\n" \ "\n", ) } diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index 158ee18c1a..5830a525dd 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -41,19 +41,19 @@ it { is_expected.to compile } it { is_expected.to compile.with_all_deps } - expected_content = "# This file is generated automatically by Puppet - DO NOT EDIT\n"\ - "# Any manual changes will be overwritten\n"\ - "\n"\ - "worker.list = worker_a,worker_b\n"\ - "\n"\ - "worker.maintain = 40\n"\ - "\n"\ - "# This is worker A\n"\ - "worker.worker_a.socket_keepalive=true\n"\ - "worker.worker_a.type=ajp13\n"\ - "\n"\ - "# This is worker B\n"\ - "worker.worker_b.socket_keepalive=true\n"\ + expected_content = "# This file is generated automatically by Puppet - DO NOT EDIT\n" \ + "# Any manual changes will be overwritten\n" \ + "\n" \ + "worker.list = worker_a,worker_b\n" \ + "\n" \ + "worker.maintain = 40\n" \ + "\n" \ + "# This is worker A\n" \ + "worker.worker_a.socket_keepalive=true\n" \ + "worker.worker_a.type=ajp13\n" \ + "\n" \ + "# This is worker B\n" \ + "worker.worker_b.socket_keepalive=true\n" \ "worker.worker_b.type=ajp13\n" it { is_expected.to contain_file("#{mod_dir}/workers.properties").with_content(expected_content) } end @@ -169,12 +169,12 @@ ) end - expected = "# This file is generated automatically by Puppet - DO NOT EDIT\n"\ - "# Any manual changes will be overwritten\n"\ - "\n"\ - "\n"\ - " JkShmFile #{paths[:shm_path]}\n"\ - " JkLogFile #{paths[:log_path]}\n"\ + expected = "# This file is generated automatically by Puppet - DO NOT EDIT\n" \ + "# Any manual changes will be overwritten\n" \ + "\n" \ + "\n " \ + "JkShmFile #{paths[:shm_path]}\n " \ + "JkLogFile #{paths[:log_path]}\n" \ "\n" it { is_expected.to contain_file('jk.conf').with_content(expected) } end diff --git a/spec/classes/mod/lbmethod_bybusyness.rb b/spec/classes/mod/lbmethod_bybusyness.rb index 22eb0a8bc5..49510076de 100644 --- a/spec/classes/mod/lbmethod_bybusyness.rb +++ b/spec/classes/mod/lbmethod_bybusyness.rb @@ -14,6 +14,7 @@ end it { + # rubocop:disable Layout/LineLength is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } @@ -32,6 +33,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + # rubocop:enable Layout/LineLength } end end diff --git a/spec/classes/mod/lbmethod_byrequests.rb b/spec/classes/mod/lbmethod_byrequests.rb index 22eb0a8bc5..49510076de 100644 --- a/spec/classes/mod/lbmethod_byrequests.rb +++ b/spec/classes/mod/lbmethod_byrequests.rb @@ -14,6 +14,7 @@ end it { + # rubocop:disable Layout/LineLength is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } @@ -32,6 +33,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + # rubocop:enable Layout/LineLength } end end diff --git a/spec/classes/mod/lbmethod_bytraffic.rb b/spec/classes/mod/lbmethod_bytraffic.rb index 22eb0a8bc5..49510076de 100644 --- a/spec/classes/mod/lbmethod_bytraffic.rb +++ b/spec/classes/mod/lbmethod_bytraffic.rb @@ -14,6 +14,7 @@ end it { + # rubocop:disable Layout/LineLength is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } @@ -32,6 +33,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + # rubocop:enable Layout/LineLength } end end diff --git a/spec/classes/mod/lbmethod_heartbeat.rb b/spec/classes/mod/lbmethod_heartbeat.rb index 22eb0a8bc5..49510076de 100644 --- a/spec/classes/mod/lbmethod_heartbeat.rb +++ b/spec/classes/mod/lbmethod_heartbeat.rb @@ -14,6 +14,7 @@ end it { + # rubocop:disable Layout/LineLength is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } @@ -32,6 +33,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + # rubocop:enable Layout/LineLength } end end diff --git a/spec/classes/mod/ldap_spec.rb b/spec/classes/mod/ldap_spec.rb index 9fb165fdd4..3038683586 100644 --- a/spec/classes/mod/ldap_spec.rb +++ b/spec/classes/mod/ldap_spec.rb @@ -46,9 +46,9 @@ it { is_expected.to contain_file('ldap.conf').with_content(%r{^LDAPOpCacheTTL 600$}) } expected_ldap_path_re = - "\n"\ - "\s*SetHandler ldap-status\n"\ - ".*\n"\ + "\n" \ + "\s*SetHandler ldap-status\n" \ + ".*\n" \ "\n" it { is_expected.to contain_file('ldap.conf').with_content(%r{#{expected_ldap_path_re}}m) } end diff --git a/spec/classes/mod/proxy_balancer_spec.rb b/spec/classes/mod/proxy_balancer_spec.rb index 0b28526926..e5735cafdd 100644 --- a/spec/classes/mod/proxy_balancer_spec.rb +++ b/spec/classes/mod/proxy_balancer_spec.rb @@ -4,9 +4,9 @@ # Helper function for testing the contents of `proxy_balancer.conf` def balancer_manager_conf_spec(allow_from, manager_path) - expected = "\n"\ - " SetHandler balancer-manager\n"\ - " Require ip #{Array(allow_from).join(' ')}\n"\ + expected = "\n " \ + "SetHandler balancer-manager\n " \ + "Require ip #{Array(allow_from).join(' ')}\n" \ "\n" it do is_expected.to contain_file('proxy_balancer.conf').with_content(expected) diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index eebe8746c2..39111ab6df 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -15,7 +15,7 @@ def require_directives(requires) requires.map { |req| " Require #{req}\n" }.join('') elsif requires.is_a?(Hash) if requires.key?(:enforce) - \ + \ " \n" + \ requires[:requires].map { |req| " Require #{req}\n" }.join('') + \ " \n" @@ -27,15 +27,15 @@ def require_directives(requires) shared_examples 'status_conf_spec_require' do |requires, extended_status, status_path| expected = - "\n"\ - " SetHandler server-status\n"\ - "#{require_directives(requires)}"\ - "\n"\ - "ExtendedStatus #{extended_status}\n"\ - "\n"\ - "\n"\ - " # Show Proxy LoadBalancer status in mod_status\n"\ - " ProxyStatus On\n"\ + "\n " \ + "SetHandler server-status\n" \ + "#{require_directives(requires)}" \ + "\n" \ + "ExtendedStatus #{extended_status}\n" \ + "\n" \ + "\n " \ + "# Show Proxy LoadBalancer status in mod_status\n " \ + "ProxyStatus On\n" \ "\n" it('status conf require') do is_expected.to contain_file('status.conf').with_content(expected) diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index f5eb0e59d9..2cea15fa25 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -151,5 +151,6 @@ def apache_settings_hash def mod_supported_on_platform?(mod) return false if ENV['DISABLE_MOD_TEST_EXCLUSION'] + ApacheModTestFilterHelper.instance.mod_supported_on_platform?(mod) end diff --git a/spec/util/apache_mod_platform_compatibility_spec.rb b/spec/util/apache_mod_platform_compatibility_spec.rb index 3ca5bb7481..356f4a55aa 100644 --- a/spec/util/apache_mod_platform_compatibility_spec.rb +++ b/spec/util/apache_mod_platform_compatibility_spec.rb @@ -162,9 +162,9 @@ tag_format_help_msg_txt = ['succint', 'warning'] - expected_stderr_msg = "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n" \ - " * #{abc_pp} (line #{abc_pp_error_line}): #{abc_pp_error_type_msg} #{abc_pp_error_detail}\n" \ - " * #{def_pp} (line #{def_pp_error_line}): #{def_pp_error_type_msg} #{def_pp_error_detail}\n" \ + expected_stderr_msg = "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n " \ + "* #{abc_pp} (line #{abc_pp_error_line}): #{abc_pp_error_type_msg} #{abc_pp_error_detail}\n " \ + "* #{def_pp} (line #{def_pp_error_line}): #{def_pp_error_type_msg} #{def_pp_error_detail}\n" \ "#{tag_format_help_msg_txt[0]}\n" \ "#{tag_format_help_msg_txt[1]}\n" diff --git a/tasks/init.rb b/tasks/init.rb index bb82d9aa7e..50f96ce610 100755 --- a/tasks/init.rb +++ b/tasks/init.rb @@ -19,6 +19,7 @@ def service(action, service_name) end _stdout, stderr, status = Open3.capture3('service', service_name, action) raise Puppet::Error, stderr if status != 0 + { status: "#{action} successful" } end diff --git a/util/apache_mod_platform_support.rb b/util/apache_mod_platform_support.rb index e61196e018..04d29bbe9d 100644 --- a/util/apache_mod_platform_support.rb +++ b/util/apache_mod_platform_support.rb @@ -59,6 +59,7 @@ def initialize(manifest, line_num, error_type, error_detail) def print_parsing_errors return if @manifest_errors.empty? + $stderr.puts "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n" @manifest_errors.each do |manifest_error| $stderr.puts " * #{manifest_error.manifest} (line #{manifest_error.line_num}): #{ERROR_MSG[manifest_error.error_type]} #{manifest_error.error_detail}" @@ -107,6 +108,7 @@ def extract_os_ver_pairs(line) def process_line(line) data = {} 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] @@ -125,6 +127,7 @@ def generate_mod_platform_exclusions line_num += 1 data = process_line(line) next if data.empty? + if data[:type] == :unsupported_platform_declaration platforms_versions = extract_os_ver_pairs(data[:value]) register_error(manifest, line_num, :tag_parse, line) if platforms_versions.empty? @@ -144,6 +147,7 @@ def mod_supported_on_platform?(mod) return true unless @mod_platform_compatibility_mapping.key? mod return true unless @mod_platform_compatibility_mapping[mod].key? @os[:family] return false if @mod_platform_compatibility_mapping[mod][@os[:family]] == [0] + !@mod_platform_compatibility_mapping[mod][@os[:family]].include? @os[:release] end end From 195dd9dfc5a99a48e149908d583aabe943f3cc27 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 00:25:35 +0100 Subject: [PATCH 09/17] (CONT-772) Correct cop group 2 --- .rubocop_todo.yml | 43 +--------------------------- lib/puppet/provider/a2mod.rb | 8 ++---- spec/classes/dev_spec.rb | 6 ++-- spec/classes/mod/deflate_spec.rb | 4 +-- spec/classes/mod/info_spec.rb | 6 ++-- spec/classes/mod/passenger_spec.rb | 2 +- spec/classes/mod/php_spec.rb | 2 +- spec/classes/mod/security_spec.rb | 2 +- spec/defines/modsec_link_spec.rb | 2 +- spec/defines/vhost_spec.rb | 2 +- spec/spec_helper_acceptance_local.rb | 8 ++---- spec/spec_helper_local.rb | 2 +- 12 files changed, 18 insertions(+), 69 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index ac13bf6a83..f50c370917 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,27 +1,11 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-19 17:41:01 UTC using RuboCop version 1.48.1. +# on 2023-04-19 23:25:24 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new # versions of RuboCop, may require this file to be generated again. -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, IndentationWidth. -# SupportedStyles: aligned, indented -Layout/LineEndStringConcatenationIndentation: - Exclude: - - 'spec/classes/mod/deflate_spec.rb' - - 'spec/classes/mod/info_spec.rb' - -# Offense count: 4 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns. -# URISchemes: http, https -Layout/LineLength: - Max: 202 - # Offense count: 3 # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. Lint/DuplicateBranch: @@ -105,17 +89,6 @@ RSpec/EmptyLineAfterExampleGroup: RSpec/ExampleLength: Max: 107 -# Offense count: 6 -# This cop supports safe autocorrection (--autocorrect). -RSpec/ExcessiveDocstringSpacing: - Exclude: - - 'spec/classes/dev_spec.rb' - - 'spec/classes/mod/passenger_spec.rb' - - 'spec/classes/mod/php_spec.rb' - - 'spec/classes/mod/security_spec.rb' - - 'spec/defines/modsec_link_spec.rb' - - 'spec/defines/vhost_spec.rb' - # Offense count: 6 # Configuration parameters: Include, CustomTransform, IgnoreMethods, SpecSuffixOnly. # Include: **/*_spec*rb*, **/spec/**/* @@ -191,12 +164,6 @@ RSpec/RepeatedExampleGroupDescription: - 'spec/classes/apache_spec.rb' - 'spec/classes/mod/security_spec.rb' -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -RSpec/SharedExamples: - Exclude: - - 'spec/spec_helper_local.rb' - # Offense count: 4 RSpec/StubbedMock: Exclude: @@ -234,14 +201,6 @@ Style/GlobalStdStream: Exclude: - 'tasks/init.rb' -# Offense count: 5 -# This cop supports safe autocorrection (--autocorrect). -Style/IfUnlessModifier: - Exclude: - - 'lib/puppet/provider/a2mod.rb' - - 'spec/classes/dev_spec.rb' - - 'spec/spec_helper_acceptance_local.rb' - # Offense count: 1 Style/MixinUsage: Exclude: diff --git a/lib/puppet/provider/a2mod.rb b/lib/puppet/provider/a2mod.rb index 7406e01da3..bc0899e2d5 100644 --- a/lib/puppet/provider/a2mod.rb +++ b/lib/puppet/provider/a2mod.rb @@ -6,9 +6,7 @@ class Puppet::Provider::A2mod < Puppet::Provider def self.prefetch(mods) instances.each do |prov| mod = mods[prov.name] - if mod - mod.provider = prov - end + mod.provider = prov if mod end end @@ -29,9 +27,7 @@ def properties # Returns the properties of the given mod if it exists. def query self.class.instances.each do |mod| - if mod.name == name || mod.name.downcase == name - return mod.properties - end + return mod.properties if mod.name == name || mod.name.downcase == name end nil end diff --git a/spec/classes/dev_spec.rb b/spec/classes/dev_spec.rb index 96ec70aabc..6fbfa6fab1 100644 --- a/spec/classes/dev_spec.rb +++ b/spec/classes/dev_spec.rb @@ -4,7 +4,7 @@ describe 'apache::dev' do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end @@ -22,9 +22,7 @@ when 'Debian' it { is_expected.to contain_package('libaprutil1-dev') } it { is_expected.to contain_package('libapr1-dev') } - if facts[:os]['release']['major'].to_i < 8 - it { is_expected.to contain_package('apache2-prefork-dev') } - end + it { is_expected.to contain_package('apache2-prefork-dev') } if facts[:os]['release']['major'].to_i < 8 when 'Ubuntu' it { is_expected.to contain_package('apache2-dev') } when 'RedHat' diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index a3cafcff6c..9779610c88 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -7,8 +7,8 @@ def general_deflate_specs it { is_expected.to contain_apache__mod('deflate') } expected = "AddOutputFilterByType DEFLATE application/rss+xml\n" \ - "AddOutputFilterByType DEFLATE application/x-javascript\n" \ - "AddOutputFilterByType DEFLATE text/css\n" \ + "AddOutputFilterByType DEFLATE application/x-javascript\n" \ + "AddOutputFilterByType DEFLATE text/css\n" \ "AddOutputFilterByType DEFLATE text/html\n" \ "\n" \ "DeflateFilterNote Input instream\n" \ diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index b623d4a8d5..1bf8138ab2 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -33,9 +33,9 @@ def general_info_specs_apache24 end expected = "\n " \ - "SetHandler server-info\n " \ - "Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n" \ - "\n" + "SetHandler server-info\n " \ + "Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n" \ + "\n" it { is_expected.to contain_file('info.conf').with_content(expected) } diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 80e56ca08c..34cb7124d6 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -4,7 +4,7 @@ describe 'apache::mod::passenger', type: :class do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index 0a8a6b3b9c..0684e2f642 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -4,7 +4,7 @@ describe 'apache::mod::php', type: :class do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index 143208c42e..1118cf72dc 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -4,7 +4,7 @@ describe 'apache::mod::security', type: :class do on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end diff --git a/spec/defines/modsec_link_spec.rb b/spec/defines/modsec_link_spec.rb index 400ae555de..806be9f3d0 100644 --- a/spec/defines/modsec_link_spec.rb +++ b/spec/defines/modsec_link_spec.rb @@ -14,7 +14,7 @@ class { "apache::mod::security": activated_rules => [] } end on_supported_os.each do |os, facts| - context "on #{os} " do + context "on #{os}" do let :facts do facts end diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 2de952ccb0..a52289283d 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -22,7 +22,7 @@ } end - context "on #{os} " do + context "on #{os}" do let :facts do os_facts end diff --git a/spec/spec_helper_acceptance_local.rb b/spec/spec_helper_acceptance_local.rb index 2cea15fa25..974921d9c6 100644 --- a/spec/spec_helper_acceptance_local.rb +++ b/spec/spec_helper_acceptance_local.rb @@ -29,13 +29,9 @@ def print_parsing_errors RSpec.configure do |c| # IPv6 is not enabled by default in the new travis-ci Trusty environment (see https://github.com/travis-ci/travis-ci/issues/8891 ) - if ENV['CI'] == 'true' - c.filter_run_excluding ipv6: true - end + c.filter_run_excluding ipv6: true if ENV['CI'] == 'true' c.before :suite do - if %r{redhat|oracle}.match?(os[:family]) - LitmusHelper.instance.run_shell('puppet module install puppet/epel') - end + LitmusHelper.instance.run_shell('puppet module install puppet/epel') if %r{redhat|oracle}.match?(os[:family]) LitmusHelper.instance.apply_manifest(File.read(File.join(__dir__, 'setup_acceptance_node.pp'))) end diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index a7211b68bb..410c73818e 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -29,7 +29,7 @@ end end -shared_examples :compile, compile: true do +shared_examples 'compile', compile: true do it { is_expected.to compile.with_all_deps } end From aace5a83d45e7065237d5b69fa3751c0140c163e Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 09:18:59 +0100 Subject: [PATCH 10/17] (CONT-772) Correct Style/TrailingCommaInHashLiteral --- .rubocop_todo.yml | 7 - spec/classes/apache_spec.rb | 28 +-- spec/classes/mod/alias_spec.rb | 6 +- spec/classes/mod/auth_cas_spec.rb | 4 +- spec/classes/mod/authn_dbd_spec.rb | 4 +- spec/classes/mod/cluster_spec.rb | 4 +- spec/classes/mod/dav_svn_spec.rb | 8 +- spec/classes/mod/disk_cache_spec.rb | 6 +- spec/classes/mod/dumpio_spec.rb | 4 +- spec/classes/mod/event_spec.rb | 6 +- spec/classes/mod/expires_spec.rb | 4 +- spec/classes/mod/http2_spec.rb | 2 +- spec/classes/mod/info_spec.rb | 4 +- spec/classes/mod/itk_spec.rb | 4 +- spec/classes/mod/jk_spec.rb | 22 +-- spec/classes/mod/lbmethod_bybusyness.rb | 4 +- spec/classes/mod/lbmethod_byrequests.rb | 4 +- spec/classes/mod/lbmethod_bytraffic.rb | 4 +- spec/classes/mod/lbmethod_heartbeat.rb | 4 +- spec/classes/mod/ldap_spec.rb | 4 +- spec/classes/mod/md_spec.rb | 2 +- spec/classes/mod/passenger_spec.rb | 10 +- spec/classes/mod/php_spec.rb | 8 +- spec/classes/mod/proxy_balancer_spec.rb | 2 +- spec/classes/mod/security_spec.rb | 24 +-- spec/classes/mod/ssl_spec.rb | 42 ++--- spec/classes/mod/status_spec.rb | 10 +- spec/classes/mod/userdir_spec.rb | 12 +- spec/classes/mod/watchdog_spec.rb | 2 +- spec/classes/mod/worker_spec.rb | 2 +- spec/classes/mod/wsgi_spec.rb | 8 +- spec/classes/service_spec.rb | 2 +- spec/classes/vhosts_spec.rb | 8 +- spec/defines/balancer_spec.rb | 8 +- spec/defines/balancermember_spec.rb | 4 +- spec/defines/custom_config_spec.rb | 10 +- spec/defines/vhost_custom_spec.rb | 2 +- spec/defines/vhost_fragment_spec.rb | 4 +- spec/defines/vhost_proxy_spec.rb | 4 +- spec/defines/vhost_spec.rb | 176 +++++++++--------- spec/spec_helper.rb | 2 +- spec/spec_helper_local.rb | 46 ++--- .../apache_mod_platform_compatibility_spec.rb | 2 +- util/apache_mod_platform_support.rb | 2 +- 44 files changed, 259 insertions(+), 266 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index f50c370917..772e71473d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -265,10 +265,3 @@ Style/StringConcatenation: Style/TernaryParentheses: Exclude: - 'spec/defines/vhost_spec.rb' - -# Offense count: 259 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyleForMultiline. -# SupportedStylesForMultiline: comma, consistent_comma, no_comma -Style/TrailingCommaInHashLiteral: - Enabled: false diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index 595df44056..3fff25d6f0 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -68,7 +68,7 @@ context 'with use_optional_includes' do let :params do { - use_optional_includes: true, + use_optional_includes: true } end @@ -78,7 +78,7 @@ context 'with serveradmin' do let(:params) do { - serveradmin: 'admin@example.com', + serveradmin: 'admin@example.com' } end @@ -168,7 +168,7 @@ let :params do { log_formats: { 'vhost_common' => '%v %h %l %u %t "%r" %>s %b', - 'vhost_combined' => '%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"', + 'vhost_combined' => '%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"' } } end @@ -180,7 +180,7 @@ let :params do { log_formats: { 'common' => '%v %h %l %u %t "%r" %>s %b', - 'combined' => '%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"', + 'combined' => '%v %h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-agent}i"' } } end @@ -260,7 +260,7 @@ { vhost_dir: '/etc/httpd/site.d', confd_dir: '/etc/httpd/conf.d', - mod_dir: '/etc/httpd/mod.d', + mod_dir: '/etc/httpd/mod.d' } end @@ -311,7 +311,7 @@ vhost_dir: '/etc/httpd/site.d', confd_dir: '/etc/httpd/conf.d', mod_dir: '/etc/httpd/mod.d', - use_optional_includes: true, + use_optional_includes: true } end @@ -323,7 +323,7 @@ vhost_dir: '/etc/httpd/site.d', confd_dir: '/etc/httpd/conf.d', mod_dir: '/etc/httpd/mod.d', - allow_encoded_slashes: 'nodecode', + allow_encoded_slashes: 'nodecode' } end @@ -336,7 +336,7 @@ vhost_dir: '/etc/httpd/site.d', confd_dir: '/etc/httpd/conf.d', mod_dir: '/etc/httpd/mod.d', - default_charset: 'none', + default_charset: 'none' } end @@ -608,7 +608,7 @@ context 'with a custom apache_name parameter' do let :params do { - apache_name: 'httpd24-httpd', + apache_name: 'httpd24-httpd' } end @@ -622,7 +622,7 @@ context 'with a custom file_mode parameter' do let :params do { - file_mode: '0640', + file_mode: '0640' } end @@ -635,7 +635,7 @@ context 'with a custom root_directory_options parameter' do let :params do { - root_directory_options: ['-Indexes', '-FollowSymLinks'], + root_directory_options: ['-Indexes', '-FollowSymLinks'] } end @@ -644,7 +644,7 @@ context 'with a custom root_directory_secured parameter' do let :params do { - root_directory_secured: true, + root_directory_secured: true } end @@ -658,7 +658,7 @@ context 'without default non-ssl vhost' do let :params do { - default_vhost: false, + default_vhost: false } end @@ -668,7 +668,7 @@ context 'with default ssl vhost' do let :params do { - default_ssl_vhost: true, + default_ssl_vhost: true } end diff --git a/spec/classes/mod/alias_spec.rb b/spec/classes/mod/alias_spec.rb index 38d4207739..f350f19507 100644 --- a/spec/classes/mod/alias_spec.rb +++ b/spec/classes/mod/alias_spec.rb @@ -30,7 +30,7 @@ end let :params do { - 'icons_options' => 'foo', + 'icons_options' => 'foo' } end @@ -45,7 +45,7 @@ end let :params do { - 'icons_prefix' => 'apache-icons', + 'icons_prefix' => 'apache-icons' } end @@ -60,7 +60,7 @@ end let :params do { - 'icons_path' => false, + 'icons_path' => false } end diff --git a/spec/classes/mod/auth_cas_spec.rb b/spec/classes/mod/auth_cas_spec.rb index 9d615e5a10..d42a3cfec5 100644 --- a/spec/classes/mod/auth_cas_spec.rb +++ b/spec/classes/mod/auth_cas_spec.rb @@ -8,7 +8,7 @@ { cas_login_url: 'https://cas.example.com/login', cas_validate_url: 'https://cas.example.com/validate', - cas_cookie_path: '/var/cache/apache2/mod_auth_cas/', + cas_cookie_path: '/var/cache/apache2/mod_auth_cas/' } end @@ -21,7 +21,7 @@ cas_login_url: 'https://cas.example.com/login', cas_validate_url: 'https://cas.example.com/validate', cas_timeout: 1234, - cas_idle_timeout: 4321, + cas_idle_timeout: 4321 } end diff --git a/spec/classes/mod/authn_dbd_spec.rb b/spec/classes/mod/authn_dbd_spec.rb index 4dca262247..e59e96f235 100644 --- a/spec/classes/mod/authn_dbd_spec.rb +++ b/spec/classes/mod/authn_dbd_spec.rb @@ -6,7 +6,7 @@ context 'default params' do let :params do { - authn_dbd_params: 'host=db_host port=3306 user=apache password=###### dbname=apache_auth', + authn_dbd_params: 'host=db_host port=3306 user=apache password=###### dbname=apache_auth' } end @@ -18,7 +18,7 @@ { authn_dbd_params: 'host=db_host port=3306 user=apache password=###### dbname=apache_auth', authn_dbd_alias: 'db_authn', - authn_dbd_query: 'SELECT password FROM authn WHERE username = %s', + authn_dbd_query: 'SELECT password FROM authn WHERE username = %s' } end diff --git a/spec/classes/mod/cluster_spec.rb b/spec/classes/mod/cluster_spec.rb index 88783d5fb4..0a93fad648 100644 --- a/spec/classes/mod/cluster_spec.rb +++ b/spec/classes/mod/cluster_spec.rb @@ -11,7 +11,7 @@ allowed_network: '172.17.0', balancer_name: 'mycluster', ip: '172.17.0.1', - version: '1.3.0', + version: '1.3.0' } end @@ -34,7 +34,7 @@ allowed_network: '172.17.0', balancer_name: 'mycluster', ip: '172.17.0.1', - version: '1.3.1', + version: '1.3.1' } end diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index 273c603d05..ab64e4e251 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -16,7 +16,7 @@ describe 'with parameters' do let :params do { - 'authz_svn_enabled' => true, + 'authz_svn_enabled' => true } end @@ -37,7 +37,7 @@ describe 'with parameters' do let :params do { - 'authz_svn_enabled' => true, + 'authz_svn_enabled' => true } end @@ -59,7 +59,7 @@ describe 'with parameters' do let :params do { - 'authz_svn_enabled' => true, + 'authz_svn_enabled' => true } end @@ -81,7 +81,7 @@ describe 'with parameters' do let :params do { - 'authz_svn_enabled' => true, + 'authz_svn_enabled' => true } end diff --git a/spec/classes/mod/disk_cache_spec.rb b/spec/classes/mod/disk_cache_spec.rb index d7dd466829..1185420ff5 100644 --- a/spec/classes/mod/disk_cache_spec.rb +++ b/spec/classes/mod/disk_cache_spec.rb @@ -8,7 +8,7 @@ let(:params) do { - cache_ignore_headers: 'Set-Cookie', + cache_ignore_headers: 'Set-Cookie' } end @@ -63,7 +63,7 @@ let(:params) do { - cache_ignore_headers: 'Set-Cookie', + cache_ignore_headers: 'Set-Cookie' } end @@ -115,7 +115,7 @@ let(:params) do { - cache_ignore_headers: 'Set-Cookie', + cache_ignore_headers: 'Set-Cookie' } end diff --git a/spec/classes/mod/dumpio_spec.rb b/spec/classes/mod/dumpio_spec.rb index 884200836c..64e01ed9c5 100644 --- a/spec/classes/mod/dumpio_spec.rb +++ b/spec/classes/mod/dumpio_spec.rb @@ -23,7 +23,7 @@ context 'with dumpio_input set to On' do let :params do { - dump_io_input: 'On', + dump_io_input: 'On' } end @@ -33,7 +33,7 @@ context 'with dumpio_ouput set to On' do let :params do { - dump_io_output: 'On', + dump_io_output: 'On' } end diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index f5f3d4621c..99523e770d 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -40,7 +40,7 @@ threadlimit: 7, listenbacklog: 8, maxrequestworkers: 9, - maxconnectionsperchild: 10, + maxconnectionsperchild: 10 } end @@ -66,7 +66,7 @@ threadlimit: 7, listenbacklog: 8, maxrequestworkers: :undef, - maxconnectionsperchild: :undef, + maxconnectionsperchild: :undef } end @@ -92,7 +92,7 @@ threadlimit: false, listenbacklog: false, maxrequestworkers: false, - maxconnectionsperchild: false, + maxconnectionsperchild: false } end diff --git a/spec/classes/mod/expires_spec.rb b/spec/classes/mod/expires_spec.rb index 759c46ad25..d9dea92e6f 100644 --- a/spec/classes/mod/expires_spec.rb +++ b/spec/classes/mod/expires_spec.rb @@ -17,7 +17,7 @@ end let :params do { - 'expires_default' => 'access plus 1 month', + 'expires_default' => 'access plus 1 month' } end @@ -40,7 +40,7 @@ 'expires_by_type' => [ { 'text/json' => 'mod plus 1 day' }, { 'text/html' => 'access plus 1 year' }, - ], + ] } end diff --git a/spec/classes/mod/http2_spec.rb b/spec/classes/mod/http2_spec.rb index 3c57e15cc1..3870e3e45e 100644 --- a/spec/classes/mod/http2_spec.rb +++ b/spec/classes/mod/http2_spec.rb @@ -48,7 +48,7 @@ h2_tls_cool_down_secs: 0, h2_tls_warm_up_size: 0, h2_upgrade: false, - h2_window_size: 128_000, + h2_window_size: 128_000 } end diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index 1bf8138ab2..661ec0f3b6 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -15,7 +15,7 @@ def general_info_specs_apache24 context 'passing restrict_access => false' do let :params do { - restrict_access: false, + restrict_access: false } end @@ -44,7 +44,7 @@ def general_info_specs_apache24 let :params do { restrict_access: false, - allow_from: ['10.10.1.2', '192.168.1.2', '127.0.0.1'], + allow_from: ['10.10.1.2', '192.168.1.2', '127.0.0.1'] } end diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index c9ad07e5b4..0197ddc469 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -60,7 +60,7 @@ let :params do { - enablecapabilities: false, + enablecapabilities: false } end @@ -83,7 +83,7 @@ context 'with enablecapabilities set' do let :params do { - enablecapabilities: true, + enablecapabilities: true } end diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index 5830a525dd..6b3f7ff4b6 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -26,16 +26,16 @@ 'worker_a' => { 'type' => 'ajp13', 'socket_keepalive' => 'true', - 'comment' => 'This is worker A', + 'comment' => 'This is worker A' }, 'worker_b' => { 'type' => 'ajp13', 'socket_keepalive' => 'true', - 'comment' => 'This is worker B', + 'comment' => 'This is worker B' }, 'worker_maintain' => 40, - 'worker_lists' => ['worker_a,worker_b'], - }, + 'worker_lists' => ['worker_a,worker_b'] + } } end @@ -73,7 +73,7 @@ end let(:params) do { - logroot: '/var/log/apache2', + logroot: '/var/log/apache2' } end let(:mod_dir) { mod_dir } @@ -97,7 +97,7 @@ end let(:params) do { - logroot: '/var/log/httpd', + logroot: '/var/log/httpd' } end @@ -140,26 +140,26 @@ shm_file: :undef, log_file: :undef, shm_path: '/var/log/httpd/jk-runtime-status', - log_path: '/var/log/httpd/mod_jk.log', + log_path: '/var/log/httpd/mod_jk.log' }, relative: { shm_file: 'shm_file', log_file: 'log_file', shm_path: '/var/log/httpd/shm_file', - log_path: '/var/log/httpd/log_file', + log_path: '/var/log/httpd/log_file' }, absolute: { shm_file: '/run/shm_file', log_file: '/tmp/log_file', shm_path: '/run/shm_file', - log_path: '/tmp/log_file', + log_path: '/tmp/log_file' }, pipe: { shm_file: :undef, log_file: '"|rotatelogs /var/log/httpd/mod_jk.log.%Y%m%d 86400 -180"', shm_path: '/var/log/httpd/jk-runtime-status', - log_path: '"|rotatelogs /var/log/httpd/mod_jk.log.%Y%m%d 86400 -180"', - }, + log_path: '"|rotatelogs /var/log/httpd/mod_jk.log.%Y%m%d 86400 -180"' + } }.each do |option, paths| context "#{option} shm_file and log_file paths" do let(:params) do diff --git a/spec/classes/mod/lbmethod_bybusyness.rb b/spec/classes/mod/lbmethod_bybusyness.rb index 49510076de..d55629bcad 100644 --- a/spec/classes/mod/lbmethod_bybusyness.rb +++ b/spec/classes/mod/lbmethod_bybusyness.rb @@ -9,7 +9,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end @@ -26,7 +26,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end diff --git a/spec/classes/mod/lbmethod_byrequests.rb b/spec/classes/mod/lbmethod_byrequests.rb index 49510076de..d55629bcad 100644 --- a/spec/classes/mod/lbmethod_byrequests.rb +++ b/spec/classes/mod/lbmethod_byrequests.rb @@ -9,7 +9,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end @@ -26,7 +26,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end diff --git a/spec/classes/mod/lbmethod_bytraffic.rb b/spec/classes/mod/lbmethod_bytraffic.rb index 49510076de..d55629bcad 100644 --- a/spec/classes/mod/lbmethod_bytraffic.rb +++ b/spec/classes/mod/lbmethod_bytraffic.rb @@ -9,7 +9,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end @@ -26,7 +26,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end diff --git a/spec/classes/mod/lbmethod_heartbeat.rb b/spec/classes/mod/lbmethod_heartbeat.rb index 49510076de..d55629bcad 100644 --- a/spec/classes/mod/lbmethod_heartbeat.rb +++ b/spec/classes/mod/lbmethod_heartbeat.rb @@ -9,7 +9,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end @@ -26,7 +26,7 @@ context 'with Apache version >= 2.4' do let :params do { - apache_version: '2.4', + apache_version: '2.4' } end diff --git a/spec/classes/mod/ldap_spec.rb b/spec/classes/mod/ldap_spec.rb index 3038683586..8faa1e0502 100644 --- a/spec/classes/mod/ldap_spec.rb +++ b/spec/classes/mod/ldap_spec.rb @@ -33,7 +33,7 @@ ldap_cache_ttl: 600, ldap_opcache_entries: 1024, ldap_opcache_ttl: 600, - ldap_path: '/custom-ldap-status', + ldap_path: '/custom-ldap-status' } end @@ -75,7 +75,7 @@ let(:params) do { ldap_trusted_global_cert_file: 'ca.pem', - ldap_trusted_global_cert_type: 'CA_DER', + ldap_trusted_global_cert_type: 'CA_DER' } end diff --git a/spec/classes/mod/md_spec.rb b/spec/classes/mod/md_spec.rb index 738671d04e..495cbfd8f3 100644 --- a/spec/classes/mod/md_spec.rb +++ b/spec/classes/mod/md_spec.rb @@ -39,7 +39,7 @@ 'md_stapling_keep_response' => { type: 'Duration', pass_opt: 'MDStaplingKeepResponse' }, 'md_stapling_renew_window' => { type: 'Duration', pass_opt: 'MDStaplingRenewWindow' }, 'md_store_dir' => { type: 'Path', pass_opt: 'MDStoreDir' }, - 'md_warn_window' => { type: 'Duration', pass_opt: 'MDWarnWindow' }, + 'md_warn_window' => { type: 'Duration', pass_opt: 'MDWarnWindow' } } md_options.each do |config_option, config_hash| diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 34cb7124d6..603b1cddb7 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -107,7 +107,7 @@ 'rails_ruby' => { type: 'String', pass_opt: :RailsRuby }, 'rails_spawn_method' => { type: 'String', pass_opt: :RailsSpawnMethod }, 'rails_user_switching' => { type: 'String', pass_opt: :RailsUserSwitching }, - 'wsgi_auto_detect' => { type: 'String', pass_opt: :WsgiAutoDetect }, + 'wsgi_auto_detect' => { type: 'String', pass_opt: :WsgiAutoDetect } } passenger_config_options.each do |config_option, config_hash| puppetized_config_option = config_option @@ -179,7 +179,7 @@ let :expected_value do { true => 'On', - false => 'Off', + false => 'Off' }[valid_value] end @@ -216,7 +216,7 @@ let :params do { passenger_installed_version: '4.0.0', - passenger_instance_registry_dir: '/some/path/to/nowhere', + passenger_instance_registry_dir: '/some/path/to/nowhere' } end @@ -227,7 +227,7 @@ let :params do { passenger_installed_version: '5.0.0', - rails_autodetect: 'on', + rails_autodetect: 'on' } end @@ -238,7 +238,7 @@ let :params do { passenger_installed_version: '5.0.0', - rails_ruby: '/some/path/to/ruby', + rails_ruby: '/some/path/to/ruby' } end diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index 0684e2f642..789cd31196 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -161,7 +161,7 @@ end let :params do { - extensions: ['.php', '.php5'], + extensions: ['.php', '.php5'] } end @@ -306,7 +306,7 @@ let :params do { template: 'apache/mod/php5.conf.erb', - content: 'somecontent', + content: 'somecontent' } end @@ -320,7 +320,7 @@ let :params do { template: 'apache/mod/php5.conf.erb', - source: 'some-path', + source: 'some-path' } end @@ -334,7 +334,7 @@ let :params do { content: 'somecontent', - source: 'some-path', + source: 'some-path' } end diff --git a/spec/classes/mod/proxy_balancer_spec.rb b/spec/classes/mod/proxy_balancer_spec.rb index e5735cafdd..e89dce60a1 100644 --- a/spec/classes/mod/proxy_balancer_spec.rb +++ b/spec/classes/mod/proxy_balancer_spec.rb @@ -47,7 +47,7 @@ def balancer_manager_conf_spec(allow_from, manager_path) { manager: true, allow_from: ['10.10.10.10', '11.11.11.11'], - manager_path: '/custom-manager', + manager_path: '/custom-manager' } end diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index 1118cf72dc..e8b3cc36f8 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -90,7 +90,7 @@ secrequestbodyaccess: 'Off', secresponsebodyaccess: 'On', secrequestbodylimitaction: 'ProcessPartial', - secresponsebodylimitaction: 'Reject', + secresponsebodylimitaction: 'Reject' } end @@ -113,7 +113,7 @@ describe 'with other modsec parameters' do let :params do { - manage_security_crs: false, + manage_security_crs: false } end @@ -122,7 +122,7 @@ describe 'with custom parameters' do let :params do { - custom_rules: false, + custom_rules: false } end @@ -134,7 +134,7 @@ let :params do { custom_rules: true, - custom_rules_set: ['REMOTE_ADDR "^127.0.0.1" "id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"'], + custom_rules_set: ['REMOTE_ADDR "^127.0.0.1" "id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"'] } end @@ -155,7 +155,7 @@ enable_dos_protection: true, dos_burst_time_slice: 30, dos_counter_threshold: 120, - dos_block_timeout: 300, + dos_block_timeout: 300 } end @@ -201,7 +201,7 @@ let :params do { paranoia_level: 2, - executing_paranoia_level: 1, + executing_paranoia_level: 1 } end @@ -281,7 +281,7 @@ secrequestbodyaccess: 'Off', secresponsebodyaccess: 'On', secrequestbodylimitaction: 'ProcessPartial', - secresponsebodylimitaction: 'Reject', + secresponsebodylimitaction: 'Reject' } end @@ -307,7 +307,7 @@ describe 'with custom parameters' do let :params do { - custom_rules: false, + custom_rules: false } end @@ -320,7 +320,7 @@ let :params do { custom_rules: true, - custom_rules_set: ['REMOTE_ADDR "^127.0.0.1" "id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"'], + custom_rules_set: ['REMOTE_ADDR "^127.0.0.1" "id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"'] } end @@ -336,7 +336,7 @@ describe 'with mod security version' do let :params do { - version: 2, + version: 2 } end @@ -356,7 +356,7 @@ enable_dos_protection: true, dos_burst_time_slice: 30, dos_counter_threshold: 120, - dos_block_timeout: 300, + dos_block_timeout: 300 } end @@ -384,7 +384,7 @@ let :params do { paranoia_level: 2, - executing_paranoia_level: 1, + executing_paranoia_level: 1 } end diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index ff1e3ee31b..82f3922c1a 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -28,7 +28,7 @@ context 'with ssl_proxy_cipher_suite' do let(:params) do { - ssl_proxy_cipher_suite: 'HIGH', + ssl_proxy_cipher_suite: 'HIGH' } end @@ -38,7 +38,7 @@ context 'with empty ssl_protocol' do let(:params) do { - ssl_protocol: [], + ssl_protocol: [] } end @@ -104,7 +104,7 @@ context 'setting ssl_cert' do let :params do { - ssl_cert: '/etc/pki/some/path/localhost.crt', + ssl_cert: '/etc/pki/some/path/localhost.crt' } end @@ -114,7 +114,7 @@ context 'setting ssl_key' do let :params do { - ssl_key: '/etc/pki/some/path/localhost.key', + ssl_key: '/etc/pki/some/path/localhost.key' } end @@ -124,7 +124,7 @@ context 'setting ssl_ca to a path' do let :params do { - ssl_ca: '/etc/pki/some/path/ca.crt', + ssl_ca: '/etc/pki/some/path/ca.crt' } end @@ -135,7 +135,7 @@ let :params do { ssl_cert: '/etc/pki/some/path/localhost.crt', - ssl_reload_on_change: true, + ssl_reload_on_change: true } end @@ -150,7 +150,7 @@ context 'with ssl_compression set to true' do let :params do { - ssl_compression: true, + ssl_compression: true } end @@ -160,7 +160,7 @@ context 'with ssl_sessiontickets set to false' do let :params do { - ssl_sessiontickets: false, + ssl_sessiontickets: false } end @@ -170,7 +170,7 @@ context 'with ssl_stapling set to true' do let :params do { - ssl_stapling: true, + ssl_stapling: true } end @@ -179,7 +179,7 @@ context 'with ssl_stapling_return_errors set to true' do let :params do { - ssl_stapling_return_errors: true, + ssl_stapling_return_errors: true } end @@ -188,7 +188,7 @@ context 'with stapling_cache' do let :params do { - stapling_cache: '/tmp/customstaplingcache(51200)', + stapling_cache: '/tmp/customstaplingcache(51200)' } end @@ -198,7 +198,7 @@ context 'setting ssl_pass_phrase_dialog' do let :params do { - ssl_pass_phrase_dialog: 'exec:/path/to/program', + ssl_pass_phrase_dialog: 'exec:/path/to/program' } end @@ -208,7 +208,7 @@ context 'setting ssl_random_seed_bytes' do let :params do { - ssl_random_seed_bytes: 1024, + ssl_random_seed_bytes: 1024 } end @@ -218,7 +218,7 @@ context 'setting ssl_openssl_conf_cmd' do let :params do { - ssl_openssl_conf_cmd: 'DHParameters "foo.pem"', + ssl_openssl_conf_cmd: 'DHParameters "foo.pem"' } end @@ -228,7 +228,7 @@ context 'setting ssl_mutex' do let :params do { - ssl_mutex: 'posixsem', + ssl_mutex: 'posixsem' } end @@ -237,7 +237,7 @@ context 'setting ssl_sessioncache' do let :params do { - ssl_sessioncache: '/tmp/customsessioncache(51200)', + ssl_sessioncache: '/tmp/customsessioncache(51200)' } end @@ -246,7 +246,7 @@ context 'setting ssl_proxy_protocol' do let :params do { - ssl_proxy_protocol: ['-ALL', '+TLSv1'], + ssl_proxy_protocol: ['-ALL', '+TLSv1'] } end @@ -261,7 +261,7 @@ context 'force on' do let :params do { - ssl_honorcipherorder: true, + ssl_honorcipherorder: true } end @@ -271,7 +271,7 @@ context 'force off' do let :params do { - ssl_honorcipherorder: false, + ssl_honorcipherorder: false } end @@ -281,7 +281,7 @@ context 'set on' do let :params do { - ssl_honorcipherorder: 'on', + ssl_honorcipherorder: 'on' } end @@ -291,7 +291,7 @@ context 'set off' do let :params do { - ssl_honorcipherorder: 'off', + ssl_honorcipherorder: 'off' } end diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index 39111ab6df..19d4ab7e9a 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -69,7 +69,7 @@ def require_directives(requires) let :params do { extended_status: 'Off', - status_path: '/custom-status', + status_path: '/custom-status' } end @@ -130,21 +130,21 @@ def require_directives(requires) requires: [ 'ip 10.1', 'host somehost', - ], + ] }, enforce: { enforce: 'all', requires: [ 'ip 127.0.0.1', 'host localhost', - ], - }, + ] + } } valid_requires.each do |req_key, req_value| context "with default params and #{req_key} requires" do let :params do { - requires: req_value, + requires: req_value } end diff --git a/spec/classes/mod/userdir_spec.rb b/spec/classes/mod/userdir_spec.rb index 3449373834..fa6c6af8e2 100644 --- a/spec/classes/mod/userdir_spec.rb +++ b/spec/classes/mod/userdir_spec.rb @@ -19,7 +19,7 @@ context 'with dir set to something' do let :params do { - dir: 'hi', + dir: 'hi' } end @@ -29,7 +29,7 @@ context 'with home set to something' do let :params do { - home: '/u', + home: '/u' } end @@ -39,7 +39,7 @@ context 'with path set to something' do let :params do { - path: '/home/*/*/public_html', + path: '/home/*/*/public_html' } end @@ -50,7 +50,7 @@ let :params do { path: '/home/*/*/public_html', - userdir: 'public_html', + userdir: 'public_html' } end @@ -60,7 +60,7 @@ context 'with unmanaged_path set to true' do let :params do { - unmanaged_path: true, + unmanaged_path: true } end @@ -70,7 +70,7 @@ context 'with custom_fragment set to something' do let :params do { - custom_fragment: 'custom_test_string', + custom_fragment: 'custom_test_string' } end diff --git a/spec/classes/mod/watchdog_spec.rb b/spec/classes/mod/watchdog_spec.rb index 648357b879..02acc5fdba 100644 --- a/spec/classes/mod/watchdog_spec.rb +++ b/spec/classes/mod/watchdog_spec.rb @@ -24,7 +24,7 @@ context 'with custom configuration' do let(:params) do { - watchdog_interval: 5, + watchdog_interval: 5 } end diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 25f1ee8b30..4396aba6dc 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -72,7 +72,7 @@ threadsperchild: 15, maxrequestsperchild: 16, threadlimit: 17, - listenbacklog: 8, + listenbacklog: 8 } end diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index 95d10625d6..1fcc95789f 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -63,7 +63,7 @@ let :params do { package_name: 'mod_wsgi_package', - mod_path: '/foo/bar/baz', + mod_path: '/foo/bar/baz' } end @@ -78,7 +78,7 @@ let :params do { package_name: 'mod_wsgi_package', - mod_path: 'wsgi_mod_name.so', + mod_path: 'wsgi_mod_name.so' } end @@ -91,7 +91,7 @@ describe 'with package_name but no mod_path' do let :params do { - mod_path: '/foo/bar/baz', + mod_path: '/foo/bar/baz' } end @@ -100,7 +100,7 @@ describe 'with mod_path but no package_name' do let :params do { - package_name: '/foo/bar/baz', + package_name: '/foo/bar/baz' } end diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 1b6b2e4590..2e621b137e 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -101,7 +101,7 @@ { 'service_ensure' => 'running', 'service_name' => 'httpd', - 'service_manage' => false, + 'service_manage' => false } end diff --git a/spec/classes/vhosts_spec.rb b/spec/classes/vhosts_spec.rb index 01ae1848c3..70f0cae528 100644 --- a/spec/classes/vhosts_spec.rb +++ b/spec/classes/vhosts_spec.rb @@ -12,13 +12,13 @@ vhosts: { 'custom_vhost_1' => { 'docroot' => '/var/www/custom_vhost_1', - 'port' => 81, + 'port' => 81 }, 'custom_vhost_2' => { 'docroot' => '/var/www/custom_vhost_2', - 'port' => 82, - }, - }, + 'port' => 82 + } + } } end diff --git a/spec/defines/balancer_spec.rb b/spec/defines/balancer_spec.rb index 3b2078aae6..fd299b954a 100644 --- a/spec/defines/balancer_spec.rb +++ b/spec/defines/balancer_spec.rb @@ -21,7 +21,7 @@ describe 'accept a target parameter and use it' do let :params do { - target: '/tmp/myapp.conf', + target: '/tmp/myapp.conf' } end @@ -32,7 +32,7 @@ describe 'accept an options parameter and use it' do let :params do { - options: ['timeout=0', 'nonce=none'], + options: ['timeout=0', 'nonce=none'] } end @@ -59,8 +59,8 @@ let :params do { proxy_set: { - 'lbmethod' => 'bytraffic', - }, + 'lbmethod' => 'bytraffic' + } } end diff --git a/spec/defines/balancermember_spec.rb b/spec/defines/balancermember_spec.rb index 9521d52ee6..aeef4f1cce 100644 --- a/spec/defines/balancermember_spec.rb +++ b/spec/defines/balancermember_spec.rb @@ -24,7 +24,7 @@ { options: [], url: 'http://127.0.0.1:8080/', - balancer_cluster: 'balancer-internal', + balancer_cluster: 'balancer-internal' } end @@ -44,7 +44,7 @@ { options: [], url: 'http://127.0.0.1:8080/', - balancer_cluster: 'balancername', + balancer_cluster: 'balancername' } end diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index 85f03f90c8..604ea2f4bd 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -15,7 +15,7 @@ context 'defaults with content' do let :params do { - 'content' => '# Test', + 'content' => '# Test' } end @@ -43,7 +43,7 @@ 'confdir' => '/dne', 'priority' => 30, 'source' => 'puppet:///modules/apache/test', - 'verify_command' => ['/bin/true'], + 'verify_command' => ['/bin/true'] } end @@ -66,7 +66,7 @@ let :params do { 'content' => '# test', - 'verify_config' => false, + 'verify_config' => false } end @@ -77,7 +77,7 @@ context 'ensure => absent' do let :params do { - 'ensure' => 'absent', + 'ensure' => 'absent' } end @@ -90,7 +90,7 @@ let :params do { 'content' => 'foo', - 'source' => 'bar', + 'source' => 'bar' } end diff --git a/spec/defines/vhost_custom_spec.rb b/spec/defines/vhost_custom_spec.rb index 43a0ab25e3..a66fcb4752 100644 --- a/spec/defines/vhost_custom_spec.rb +++ b/spec/defines/vhost_custom_spec.rb @@ -8,7 +8,7 @@ end let(:params) do { - content: 'foobar', + content: 'foobar' } end diff --git a/spec/defines/vhost_fragment_spec.rb b/spec/defines/vhost_fragment_spec.rb index c5aac54c96..0352d5c8bb 100644 --- a/spec/defines/vhost_fragment_spec.rb +++ b/spec/defines/vhost_fragment_spec.rb @@ -15,7 +15,7 @@ { vhost: 'default', port: 80, - priority: 15, + priority: 15 } end @@ -47,7 +47,7 @@ let(:params) do { vhost: 'custom', - content: '# Foo', + content: '# Foo' } end diff --git a/spec/defines/vhost_proxy_spec.rb b/spec/defines/vhost_proxy_spec.rb index fbdf642386..1619a10121 100644 --- a/spec/defines/vhost_proxy_spec.rb +++ b/spec/defines/vhost_proxy_spec.rb @@ -15,7 +15,7 @@ { vhost: 'default', port: 80, - priority: 15, + priority: 15 } end @@ -29,7 +29,7 @@ proxy_pass: [ { path: '/', - url: 'http://localhost:8080/', + url: 'http://localhost:8080/' }, ], ) diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index a52289283d..f9972f4f43 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -18,7 +18,7 @@ let :default_params do { docroot: '/rspec/docroot', - port: 84, + port: 84 } end @@ -89,7 +89,7 @@ 'aliases' => [ { 'alias' => '/image', - 'path' => '/rspec/image', + 'path' => '/rspec/image' }, ], 'access_log' => false, @@ -101,17 +101,17 @@ { 'path' => '/var/www/files', 'provider' => 'files', - 'require' => ['valid-user', 'all denied'], + 'require' => ['valid-user', 'all denied'] }, { 'path' => '/var/www/files', 'provider' => 'files', - 'additional_includes' => ['/custom/path/includes', '/custom/path/another_includes'], + 'additional_includes' => ['/custom/path/includes', '/custom/path/another_includes'] }, { 'path' => '/var/www/files', 'provider' => 'files', - 'require' => 'all granted', + 'require' => 'all granted' }, { 'path' => '/var/www/files', @@ -119,8 +119,8 @@ 'require' => { 'enforce' => 'all', - 'requires' => ['all-valid1', 'all-valid2'], - }, + 'requires' => ['all-valid1', 'all-valid2'] + } }, { 'path' => '/var/www/files', @@ -128,8 +128,8 @@ 'require' => { 'enforce' => 'none', - 'requires' => ['none-valid1', 'none-valid2'], - }, + 'requires' => ['none-valid1', 'none-valid2'] + } }, { 'path' => '/var/www/files', @@ -137,12 +137,12 @@ 'require' => { 'enforce' => 'any', - 'requires' => ['any-valid1', 'any-valid2'], - }, + 'requires' => ['any-valid1', 'any-valid2'] + } }, { 'path' => '*', - 'provider' => 'proxy', + 'provider' => 'proxy' }, { 'path' => '/var/www/files/indexed_directory', 'directoryindex' => 'disabled', @@ -175,7 +175,7 @@ 'h2_push_resource' => [ '/foo.css', '/foo.js', - ], + ] }, { 'path' => '/', @@ -184,7 +184,7 @@ 'auth_basic_fake' => 'demo demopass', 'auth_user_file' => '/path/to/authz_user_file', 'auth_group_file' => '/path/to/authz_group_file', - 'setenv' => ['SPECIAL_PATH /foo/bin'], + 'setenv' => ['SPECIAL_PATH /foo/bin'] }, { 'path' => '/proxy', @@ -195,10 +195,10 @@ 'keywords' => ['noquery', 'interpolate'], 'params' => { 'retry' => 0, - 'timeout' => 5, - }, + 'timeout' => 5 + } }, - ], + ] }, { 'path' => '^/proxy', @@ -209,10 +209,10 @@ 'keywords' => ['noquery', 'interpolate'], 'params' => { 'retry' => 0, - 'timeout' => 5, - }, + 'timeout' => 5 + } }, - ], + ] }, { 'path' => '/var/www/node-app/public', @@ -269,14 +269,14 @@ 'cred_store' => { 'ccache' => ['/path/to/directory'], 'client_keytab' => ['/path/to/example.keytab'], - 'keytab' => ['/path/to/example.keytab'], + 'keytab' => ['/path/to/example.keytab'] }, 'deleg_ccache_dir' => '/path/to/directory', 'deleg_ccache_env_var' => 'KRB5CCNAME', 'deleg_ccache_perms' => { 'mode' => '0600', 'uid' => 'example-user', - 'gid' => 'example-group', + 'gid' => 'example-group' }, 'deleg_ccache_unique' => true, 'impersonate' => true, @@ -290,15 +290,15 @@ 'signal_persistent_auth' => true, 'ssl_only' => true, 'use_s4u2_proxy' => true, - 'use_sessions' => true, - }, + 'use_sessions' => true + } }, { 'path' => '/private_1', 'provider' => 'location', 'ssl_options' => ['+ExportCertData', '+StdEnvVars'], 'ssl_verify_client' => 'optional', - 'ssl_verify_depth' => 10, + 'ssl_verify_depth' => 10 }, ], 'error_log' => false, @@ -311,11 +311,11 @@ 'scriptaliases' => [ { 'alias' => '/myscript', - 'path' => '/usr/share/myscript', + 'path' => '/usr/share/myscript' }, { 'aliasmatch' => '^/foo(.*)', - 'path' => '/usr/share/fooscripts$1', + 'path' => '/usr/share/fooscripts$1' }, ], 'limitreqfieldsize' => 8190, @@ -333,18 +333,18 @@ 'reverse_cookies' => [ { 'path' => '/a', - 'url' => 'http://backend-a/', + 'url' => 'http://backend-a/' }, { 'domain' => 'foo', - 'url' => 'http://foo', + 'url' => 'http://foo' }, ], 'params' => { 'retry' => 0, - 'timeout' => 5, + 'timeout' => 5 }, - 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'], + 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'] }, ], 'proxy_pass_match' => [ @@ -356,9 +356,9 @@ 'no_proxy_uris_match' => ['/a/foomatch'], 'params' => { 'retry' => 0, - 'timeout' => 5, + 'timeout' => 5 }, - 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'], + 'setenv' => ['proxy-nokeepalive 1', 'force-proxy-request-1.0 1'] }, ], 'proxy_requests' => false, @@ -379,7 +379,7 @@ 'request_headers' => ['append MirrorID "mirror 12"'], 'rewrites' => [ { - 'rewrite_rule' => ['^index.html$ rewrites.html'], + 'rewrite_rule' => ['^index.html$ rewrites.html'] }, ], 'filters' => [ @@ -404,25 +404,25 @@ 'wsgi_daemon_process_options' => { 'processes' => 2, 'threads' => 15, - 'display-name' => '%{GROUP}', + 'display-name' => '%{GROUP}' }, 'wsgi_import_script' => '/var/www/demo.wsgi', 'wsgi_import_script_options' => { 'process-group' => 'wsgi', - 'application-group' => '%{GLOBAL}', + 'application-group' => '%{GLOBAL}' }, 'wsgi_process_group' => 'wsgi', 'wsgi_script_aliases' => { - '/' => '/var/www/demo.wsgi', + '/' => '/var/www/demo.wsgi' }, 'wsgi_script_aliases_match' => { - '^/test/(^[/*)' => '/var/www/demo.wsgi', + '^/test/(^[/*)' => '/var/www/demo.wsgi' }, 'wsgi_pass_authorization' => 'On', 'custom_fragment' => '#custom string', 'itk' => { 'user' => 'someuser', - 'group' => 'somegroup', + 'group' => 'somegroup' }, 'wsgi_chunked_request' => 'On', 'action' => 'foo', @@ -526,7 +526,7 @@ 'ClientSecret' => 'aae053a9-4abf-4824-8956-e94b2af335c8', 'CryptoPassphrase' => '4ad1bb46-9979-450e-ae58-c696967df3cd' }, 'mdomain' => 'example.com example.net auto', - 'userdir' => 'disabled', + 'userdir' => 'disabled' } end @@ -924,7 +924,7 @@ 'override' => ['All'], 'directoryindex' => 'index.html', 'vhost_name' => 'test', - 'proxy_add_headers' => true, + 'proxy_add_headers' => true } end @@ -951,7 +951,7 @@ 'override' => ['All'], 'directoryindex' => 'index.html', 'vhost_name' => 'test', - 'proxy_add_headers' => false, + 'proxy_add_headers' => false } end @@ -977,7 +977,7 @@ 'options' => ['MultiView'], 'override' => ['All'], 'directoryindex' => 'index.html', - 'vhost_name' => 'test', + 'vhost_name' => 'test' } end @@ -1004,7 +1004,7 @@ 'override' => ['All'], 'directoryindex' => 'index.html', 'vhost_name' => 'test', - 'proxy_preserve_host' => true, + 'proxy_preserve_host' => true } end @@ -1116,7 +1116,7 @@ 'servername' => 'example.com', 'docroot' => '/var/www/html', 'add_listen' => true, - 'ensure' => 'present', + 'ensure' => 'present' } end @@ -1141,7 +1141,7 @@ 'servername' => 'example.com', 'docroot' => '/var/www/html', 'add_listen' => true, - 'ensure' => 'present', + 'ensure' => 'present' } end @@ -1166,7 +1166,7 @@ 'servername' => 'example.com', 'docroot' => '/var/www/html', 'add_listen' => true, - 'ensure' => 'present', + 'ensure' => 'present' } end @@ -1195,7 +1195,7 @@ 'servername' => 'example.com', 'docroot' => '/var/www/html', 'add_listen' => true, - 'ensure' => 'present', + 'ensure' => 'present' } end @@ -1218,7 +1218,7 @@ 'servername' => 'example.com', 'docroot' => '/var/www/html', 'add_listen' => true, - 'ensure' => 'present', + 'ensure' => 'present' } end @@ -1236,7 +1236,7 @@ let :params do { 'docroot' => '/var/www/html', - 'virtual_docroot' => '/var/www/sites/%0', + 'virtual_docroot' => '/var/www/sites/%0' } end @@ -1257,7 +1257,7 @@ { 'docroot' => '/var/www/html', 'virtual_use_default_docroot' => true, - 'virtual_docroot' => '/var/www/sites/%0', + 'virtual_docroot' => '/var/www/sites/%0' } end @@ -1278,7 +1278,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'modsec_audit_log' => true, + 'modsec_audit_log' => true } end @@ -1293,7 +1293,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'modsec_audit_log_file' => 'foo.log', + 'modsec_audit_log_file' => 'foo.log' } end @@ -1310,7 +1310,7 @@ { 'docroot' => '/rspec/docroot', 'modsec_inbound_anomaly_threshold' => 10_000, - 'modsec_outbound_anomaly_threshold' => 10_000, + 'modsec_outbound_anomaly_threshold' => 10_000 } end @@ -1335,7 +1335,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'modsec_allowed_methods' => 'GET HEAD POST OPTIONS', + 'modsec_allowed_methods' => 'GET HEAD POST OPTIONS' } end @@ -1361,9 +1361,9 @@ 'aliases' => [ { 'alias' => '/alias', - 'path' => '/rspec/docroot', + 'path' => '/rspec/docroot' }, - ], + ] } end @@ -1377,9 +1377,9 @@ { 'path' => '.*', 'url' => 'http://backend-a/', - 'params' => { 'timeout' => 300 }, + 'params' => { 'timeout' => 300 } }, - ], + ] } end @@ -1394,7 +1394,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'proxy_dest_match' => '/', + 'proxy_dest_match' => '/' } end @@ -1408,7 +1408,7 @@ { 'docroot' => '/rspec/docroot', 'proxy_dest_match' => '/', - 'proxy_dest_reverse_match' => 'http://localhost:8180', + 'proxy_dest_reverse_match' => 'http://localhost:8180' } end @@ -1426,7 +1426,7 @@ 'ensure' => 'absent', 'manage_docroot' => true, 'logroot' => '/tmp/logroot', - 'logroot_ensure' => 'absent', + 'logroot_ensure' => 'absent' } end @@ -1488,7 +1488,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'wsgi_application_group' => '%{GLOBAL}', + 'wsgi_application_group' => '%{GLOBAL}' } end @@ -1498,7 +1498,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'wsgi_daemon_process' => { 'foo' => { 'python-home' => '/usr' }, 'bar' => {} }, + 'wsgi_daemon_process' => { 'foo' => { 'python-home' => '/usr' }, 'bar' => {} } } end @@ -1508,7 +1508,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'wsgi_import_script' => '/var/www/demo.wsgi', + 'wsgi_import_script' => '/var/www/demo.wsgi' } end @@ -1520,8 +1520,8 @@ 'docroot' => '/rspec/docroot', 'wsgi_import_script_options' => { 'process-group' => 'wsgi', - 'application-group' => '%{GLOBAL}', - }, + 'application-group' => '%{GLOBAL}' + } } end @@ -1534,8 +1534,8 @@ 'wsgi_import_script' => '/var/www/demo.wsgi', 'wsgi_import_script_options' => { 'process-group' => 'wsgi', - 'application-group' => '%{GLOBAL}', - }, + 'application-group' => '%{GLOBAL}' + } } end @@ -1545,7 +1545,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'wsgi_daemon_process' => 'wsgi', + 'wsgi_daemon_process' => 'wsgi' } end @@ -1556,8 +1556,8 @@ { 'docroot' => '/rspec/docroot', 'wsgi_script_aliases' => { - '/' => '/var/www/demo.wsgi', - }, + '/' => '/var/www/demo.wsgi' + } } end @@ -1567,7 +1567,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'wsgi_script_aliases' => {}, + 'wsgi_script_aliases' => {} } end @@ -1577,7 +1577,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'wsgi_pass_authorization' => 'On', + 'wsgi_pass_authorization' => 'On' } end @@ -1587,7 +1587,7 @@ let :params do { 'docroot' => false, - 'manage_docroot' => false, + 'manage_docroot' => false } end @@ -1599,7 +1599,7 @@ { 'docroot' => '/rspec/docroot', 'ssl' => false, - 'ssl_proxyengine' => true, + 'ssl_proxyengine' => true } end @@ -1613,7 +1613,7 @@ 'docroot' => '/rspec/docroot', 'ssl' => true, 'ssl_proxyengine' => false, - 'ssl_proxy_protocol' => 'TLSv1.2', + 'ssl_proxy_protocol' => 'TLSv1.2' } end @@ -1625,7 +1625,7 @@ let :params do { 'docroot' => '/rspec/docroot', - 'ssl' => true, + 'ssl' => true } end @@ -1672,7 +1672,7 @@ let(:params) do { 'docroot' => '/rspec/docroot', - 'access_log_file' => 'my_log_file', + 'access_log_file' => 'my_log_file' } end @@ -1687,7 +1687,7 @@ { 'docroot' => '/rspec/docroot', 'access_log_file' => 'my_log_file', - 'access_log_env_var' => 'prod', + 'access_log_env_var' => 'prod' } end @@ -1705,7 +1705,7 @@ { 'file' => '/tmp/log1', 'env' => 'dev' }, { 'file' => 'log2' }, { 'syslog' => 'syslog', 'format' => '%h %l' }, - ], + ] } end @@ -1731,7 +1731,7 @@ let(:params) do { 'docroot' => '/rspec/docroot', - 'error_log_format' => ['[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i'], + 'error_log_format' => ['[%t] [%l] %7F: %E: [client\ %a] %M% ,\ referer\ %{Referer}i'] } end @@ -1752,7 +1752,7 @@ { "[%{uc}t] [R:%L] UA:'%+{User-Agent}i'" => 'request' }, { "[%{uc}t] [R:%L] Referer:'%+{Referer}i'" => 'request' }, { '[%{uc}t] [C:%{c}L] local\ %a remote\ %A' => 'connection' }, - ], + ] } end @@ -1769,7 +1769,7 @@ describe 'validation' do let(:params) do { - 'docroot' => '/rspec/docroot', + 'docroot' => '/rspec/docroot' } end @@ -1884,9 +1884,9 @@ 'directories' => [ { 'path' => '/var/www/foo/files', - 'provider' => 'files', + 'provider' => 'files' }, - ], + ] } end @@ -1912,9 +1912,9 @@ 'directories' => [ { 'path' => '/var/www/foo', - 'require' => 'unmanaged', + 'require' => 'unmanaged' }, - ], + ] } end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 07db73426e..50071092d7 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -13,7 +13,7 @@ default_facts = { puppetversion: Puppet.version, - facterversion: Facter.version, + facterversion: Facter.version } default_fact_files = [ diff --git a/spec/spec_helper_local.rb b/spec/spec_helper_local.rb index 410c73818e..d2c5fc09bf 100644 --- a/spec/spec_helper_local.rb +++ b/spec/spec_helper_local.rb @@ -67,12 +67,12 @@ family: 'Redhat', release: { major: '28', - full: '28', - }, + full: '28' + } }, identity: { - uid: 'root', - }, + uid: 'root' + } } end end @@ -86,12 +86,12 @@ name: 'FreeBSD', family: 'FreeBSD', release: { - full: '9', - }, + full: '9' + } }, identity: { - uid: 'root', - }, + uid: 'root' + } } end end @@ -105,12 +105,12 @@ name: 'FreeBSD', family: 'FreeBSD', release: { - full: '10', - }, + full: '10' + } }, identity: { - uid: 'root', - }, + uid: 'root' + } } end end @@ -125,12 +125,12 @@ family: 'Gentoo', release: { major: '2.7', - full: '2.7', - }, + full: '2.7' + } }, identity: { - uid: 'root', - }, + uid: 'root' + } } end end @@ -142,9 +142,9 @@ family: 'Darwin', name: 'Darwin', release: { - full: '13.1.0', - }, - }, + full: '13.1.0' + } + } } end end @@ -158,12 +158,12 @@ name: 'Magic', family: 'Magic', release: { - full: '0', - }, + full: '0' + } }, identity: { - uid: 'root', - }, + uid: 'root' + } } end end diff --git a/spec/util/apache_mod_platform_compatibility_spec.rb b/spec/util/apache_mod_platform_compatibility_spec.rb index 356f4a55aa..f2ab43c297 100644 --- a/spec/util/apache_mod_platform_compatibility_spec.rb +++ b/spec/util/apache_mod_platform_compatibility_spec.rb @@ -18,7 +18,7 @@ 'scientific' => [6, 7], 'debian' => [8, 9, 10], 'sles' => [11, 12, 15], - 'ubuntu' => [14, 16, 18], + 'ubuntu' => [14, 16, 18] } context 'when initialized' do diff --git a/util/apache_mod_platform_support.rb b/util/apache_mod_platform_support.rb index 04d29bbe9d..b857126d20 100644 --- a/util/apache_mod_platform_support.rb +++ b/util/apache_mod_platform_support.rb @@ -23,7 +23,7 @@ class ApacheModPlatformCompatibility ERROR_MSG = { tag_parse: 'OS and version information in incorrect format:', - os_parse: 'OS name is not present in metadata.json:', + os_parse: 'OS name is not present in metadata.json:' }.freeze def initialize From 156539ac2a68e977585c0c6d9e047b12d8d2a45b Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 09:21:11 +0100 Subject: [PATCH 11/17] (CONT-772) Correct RSpec/EmptyLineAfterExample --- .rubocop_todo.yml | 4 +- spec/acceptance/apache_ssl_spec.rb | 3 + spec/acceptance/vhost_spec.rb | 12 ++++ spec/classes/apache_spec.rb | 34 +++++++++++ spec/classes/dev_spec.rb | 2 + spec/classes/mod/auth_cas_spec.rb | 1 + spec/classes/mod/auth_openidc_spec.rb | 1 + spec/classes/mod/dav_svn_spec.rb | 2 + spec/classes/mod/deflate_spec.rb | 1 + spec/classes/mod/dir_spec.rb | 1 + spec/classes/mod/disk_cache_spec.rb | 10 ++++ spec/classes/mod/event_spec.rb | 1 + spec/classes/mod/expires_spec.rb | 2 + spec/classes/mod/fcgid_spec.rb | 8 +++ spec/classes/mod/http2_spec.rb | 1 + spec/classes/mod/info_spec.rb | 1 + spec/classes/mod/itk_spec.rb | 1 + spec/classes/mod/jk_spec.rb | 3 + spec/classes/mod/mime_magic_spec.rb | 1 + spec/classes/mod/negotiation_spec.rb | 1 + spec/classes/mod/passenger_spec.rb | 11 ++++ spec/classes/mod/php_spec.rb | 9 +++ spec/classes/mod/prefork_spec.rb | 2 + spec/classes/mod/proxy_html_spec.rb | 2 + spec/classes/mod/proxy_spec.rb | 1 + spec/classes/mod/remoteip_spec.rb | 1 + spec/classes/mod/rpaf_spec.rb | 6 ++ spec/classes/mod/security_spec.rb | 20 +++++++ spec/classes/mod/ssl_spec.rb | 1 + spec/classes/mod/worker_spec.rb | 2 + spec/classes/mod/wsgi_spec.rb | 8 +++ spec/defines/custom_config_spec.rb | 4 ++ spec/defines/mod_spec.rb | 5 ++ spec/defines/modsec_link_spec.rb | 1 + spec/defines/vhost_custom_spec.rb | 1 + spec/defines/vhost_spec.rb | 60 +++++++++++++++++++ spec/functions/bool2httpd_spec.rb | 4 ++ .../apache_mod_platform_compatibility_spec.rb | 15 +++++ 38 files changed, 241 insertions(+), 2 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 772e71473d..d5b76ffbcd 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -76,8 +76,8 @@ RSpec/DescribeClass: # Offense count: 239 # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: AllowConsecutiveOneLiners. -RSpec/EmptyLineAfterExample: - Enabled: false +# RSpec/EmptyLineAfterExample: +# Enabled: false # Offense count: 270 # This cop supports safe autocorrection (--autocorrect). diff --git a/spec/acceptance/apache_ssl_spec.rb b/spec/acceptance/apache_ssl_spec.rb index 5e1c5909b6..08b249c9e4 100644 --- a/spec/acceptance/apache_ssl_spec.rb +++ b/spec/acceptance/apache_ssl_spec.rb @@ -23,6 +23,7 @@ class { 'apache': describe file("#{apache_hash['mod_ssl_dir']}/ssl.conf") do it { is_expected.to be_file } + if os[:family].include?('redhat') && os[:release].to_i >= 8 it { is_expected.not_to contain 'SSLProtocol' } elsif ['debian', 'ubuntu'].include?(os[:family]) @@ -40,6 +41,7 @@ class { 'apache': it { is_expected.to contain 'SSLCACertificateFile "/tmp/ssl_ca"' } it { is_expected.to contain 'SSLCARevocationPath "/tmp/ssl_crl_path"' } it { is_expected.to contain 'SSLCARevocationFile "/tmp/ssl_crl"' } + if apache_hash['version'] == '2.4' it { is_expected.to contain 'SSLCARevocationCheck chain' } else @@ -107,6 +109,7 @@ class { 'apache': it { is_expected.to contain 'SSLVerifyClient require' } it { is_expected.to contain 'SSLVerifyDepth 1' } it { is_expected.to contain 'SSLOptions test test1' } + if apache_hash['version'] == '2.4' it { is_expected.to contain 'SSLCARevocationCheck chain flag' } else diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index e10d22dbb2..36faf5b6c7 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -315,6 +315,7 @@ class { 'apache': } it 'answers to files.example.net #stdout' do expect(run_shell('/usr/bin/curl -sSf files.example.net:80/index.html').stdout).to eq("Hello World\n") end + it 'answers to files.example.net #stderr' do result = run_shell('/usr/bin/curl -sSf files.example.net:80/index.html.bak', expect_failures: true) expect(result.stderr).to match(%r{curl: \(22\) The requested URL returned error: 403}) @@ -369,14 +370,17 @@ class { 'apache': } it 'answers to files.example.net #stdout' do expect(run_shell('/usr/bin/curl -sSf files.example.net:80/').stdout).to eq("Hello World\n") end + it 'answers to files.example.net #stdout foo' do expect(run_shell('/usr/bin/curl -sSf files.example.net:80/foo/').stdout).to eq("Hello Foo\n") end + it 'answers to files.example.net #stderr' do result = run_shell('/usr/bin/curl -sSf files.example.net:80/private.html', expect_failures: true) expect(result.stderr).to match(%r{curl: \(22\) The requested URL returned error: 403}) expect(result.exit_code).to eq 22 end + it 'answers to files.example.net #stdout bar' do expect(run_shell('/usr/bin/curl -sSf files.example.net:80/bar/bar.html').stdout).to eq("Hello Bar\n") end @@ -411,6 +415,7 @@ class { 'apache': } it 'answers to files.example.net #stdout' do expect(run_shell('/usr/bin/curl -sSf files.example.net:80/index.html').stdout).to eq("Hello World\n") end + it 'answers to files.example.net #stdout regex' do expect(run_shell('/usr/bin/curl -sSf files.example.net:80/server-status?auto').stdout).to match(%r{Scoreboard: }) end @@ -576,6 +581,7 @@ class { 'apache': default_vhost => false, } expect(r.stdout).to eq("Hello from localhost\n") end end + it 'gets a response from the back end #exit_code' do run_shell('/usr/bin/curl --max-redirs 0 proxy.example.com:80') do |r| expect(r.exit_code).to eq(0) @@ -621,6 +627,7 @@ class { 'apache': default_vhost => false, } expect(r.stdout).to eq("Hello from localhost\n") end end + it 'gets a response from the back end #exit_code' do run_shell('/usr/bin/curl --max-redirs 0 proxy.example.com:80') do |r| expect(r.exit_code).to eq(0) @@ -967,6 +974,7 @@ class { 'apache': } it 'applies cleanly' do _result = apply_manifest(pp, catch_failures: true) end + describe file("#{apache_hash['vhost_dir']}/25-test.servername.conf") do it { is_expected.to be_file } it { is_expected.to contain ' ErrorLog "/tmp/test.servername_error.log' } @@ -986,6 +994,7 @@ class { 'apache': } it 'applies cleanly' do _result = apply_manifest(pp, catch_failures: true) end + describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do it { is_expected.to be_file } it { is_expected.to contain ' ErrorLog "/tmp/test.server_error.log' } @@ -1147,6 +1156,7 @@ class { 'apache::mod::wsgi': } it 'import_script applies cleanly' do apply_manifest(pp, catch_failures: true) end + describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do it { is_expected.to be_file } it { is_expected.to contain 'WSGIApplicationGroup %{GLOBAL}' } @@ -1212,6 +1222,7 @@ class { 'apache::mod::shib': } it 'applies cleanly' do apply_manifest(pp, catch_failures: true) end + describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do it { is_expected.to be_file } it { is_expected.to contain 'ShibCompatValidUser On' } @@ -1241,6 +1252,7 @@ class { 'apache': } it 'applys cleanly' do apply_manifest(pp, catch_failures: true) end + describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do it { is_expected.to be_file } it { is_expected.to contain 'OIDCProviderMetadataURL https://login.example.com/.well-known/openid-configuration' } diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index 3fff25d6f0..f5236e4d7a 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -7,45 +7,54 @@ include_examples 'Debian 11' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_package('httpd').with( 'notify' => 'Class[Apache::Service]', 'ensure' => 'installed', ) } + it { is_expected.to contain_user('www-data') } it { is_expected.to contain_group('www-data') } it { is_expected.to contain_class('apache::service') } + it { is_expected.to contain_file('/var/www/html').with( 'ensure' => 'directory', ) } + it { is_expected.to contain_file('/etc/apache2/sites-enabled').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_file('/etc/apache2/mods-enabled').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_file('/etc/apache2/mods-available').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'false' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_file('/etc/apache2/apache2.conf').without_content(%r{ServerAdmin}) } + it { is_expected.to contain_concat('/etc/apache2/ports.conf').with( 'owner' => 'root', 'group' => 'root', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') } + # Assert that load files are placed and symlinked for these mods, but no conf file. ['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { @@ -54,6 +63,7 @@ 'ensure' => 'file', ) } + it { is_expected.to contain_file("#{modname}.load symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.load", @@ -61,6 +71,7 @@ 'target' => "/etc/apache2/mods-available/#{modname}.load", ) } + it { is_expected.not_to contain_file("#{modname}.conf") } it { is_expected.not_to contain_file("#{modname}.conf symlink") } end @@ -125,6 +136,7 @@ 'ensure' => 'file', ) } + it { is_expected.to contain_file("#{modname}.load symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.load", @@ -132,12 +144,14 @@ 'target' => "/etc/apache2/mods-available/#{modname}.load", ) } + it { is_expected.to contain_file("#{modname}.conf").with( 'path' => "/etc/apache2/mods-available/#{modname}.conf", 'ensure' => 'file', ) } + it { is_expected.to contain_file("#{modname}.conf symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.conf", @@ -198,6 +212,7 @@ is_expected.to contain_file('/etc/apache2/apache2.conf').with_content reg end end + it 'Not expected to contain' do unexpected.each do |reg| is_expected.to contain_file('/etc/apache2/apache2.conf').without_content reg @@ -229,32 +244,38 @@ include_examples 'RedHat 8' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_package('httpd').with( 'notify' => 'Class[Apache::Service]', 'ensure' => 'installed', ) } + it { is_expected.to contain_user('apache') } it { is_expected.to contain_group('apache') } it { is_expected.to contain_class('apache::service') } + it { is_expected.to contain_file('/var/www/html').with( 'ensure' => 'directory', ) } + it { is_expected.to contain_file('/etc/httpd/conf.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_concat('/etc/httpd/conf/ports.conf').with( 'owner' => 'root', 'group' => 'root', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') } + describe 'Alternate confd/mod/vhosts directory' do let :params do { @@ -280,6 +301,7 @@ "/etc/httpd/mod.d/#{modname}.load", ) } + it { is_expected.not_to contain_file("#{modname}.conf").with_path( "/etc/httpd/mod.d/#{modname}.conf", @@ -294,6 +316,7 @@ "/etc/httpd/mod.d/#{modname}.load", ) } + it { is_expected.to contain_file("#{modname}.conf").with_path( "/etc/httpd/mod.d/#{modname}.conf", @@ -521,29 +544,34 @@ it { is_expected.to contain_user('www') } it { is_expected.to contain_group('www') } it { is_expected.to contain_class('apache::service') } + it { is_expected.to contain_file('/usr/local/www/apache24/data').with( 'ensure' => 'directory', ) } + it { is_expected.to contain_file('/usr/local/etc/apache24/Vhosts').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_file('/usr/local/etc/apache24/Modules').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_concat('/usr/local/etc/apache24/ports.conf').with( 'owner' => 'root', 'group' => 'wheel', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') } + # Assert that load files are placed for these mods, but no conf file. ['auth_basic', 'authn_core', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { @@ -552,6 +580,7 @@ 'ensure' => 'file', ) } + it { is_expected.not_to contain_file("#{modname}.conf") } end @@ -563,6 +592,7 @@ 'ensure' => 'file', ) } + it { is_expected.to contain_file("#{modname}.conf").with( 'path' => "/usr/local/etc/apache24/Modules/#{modname}.conf", @@ -578,23 +608,27 @@ it { is_expected.to contain_user('apache') } it { is_expected.to contain_group('apache') } it { is_expected.to contain_class('apache::service') } + it { is_expected.to contain_file('/var/www/localhost/htdocs').with( 'ensure' => 'directory', ) } + it { is_expected.to contain_file('/etc/apache2/vhosts.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_file('/etc/apache2/modules.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } + it { is_expected.to contain_concat('/etc/apache2/ports.conf').with( 'owner' => 'root', 'group' => 'wheel', diff --git a/spec/classes/dev_spec.rb b/spec/classes/dev_spec.rb index 6fbfa6fab1..1dcafdaeed 100644 --- a/spec/classes/dev_spec.rb +++ b/spec/classes/dev_spec.rb @@ -18,10 +18,12 @@ it { is_expected.to compile.with_all_deps } it { is_expected.to contain_class('apache::params') } + case facts[:os]['name'] when 'Debian' it { is_expected.to contain_package('libaprutil1-dev') } it { is_expected.to contain_package('libapr1-dev') } + it { is_expected.to contain_package('apache2-prefork-dev') } if facts[:os]['release']['major'].to_i < 8 when 'Ubuntu' it { is_expected.to contain_package('apache2-dev') } diff --git a/spec/classes/mod/auth_cas_spec.rb b/spec/classes/mod/auth_cas_spec.rb index d42a3cfec5..d9b62dc60f 100644 --- a/spec/classes/mod/auth_cas_spec.rb +++ b/spec/classes/mod/auth_cas_spec.rb @@ -63,6 +63,7 @@ it { is_expected.to contain_package('mod_auth_cas') } it { is_expected.to contain_file('auth_cas.conf').with_path('/etc/httpd/conf.modules.d/auth_cas.conf') } it { is_expected.to contain_file('/var/cache/mod_auth_cas/').with_owner('apache') } + it { is_expected.to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASRootProxiedAs http://test.server$}) is_expected.to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASCookiePath /my/cas/path$}) diff --git a/spec/classes/mod/auth_openidc_spec.rb b/spec/classes/mod/auth_openidc_spec.rb index 24f6228731..dc00f7d1ef 100644 --- a/spec/classes/mod/auth_openidc_spec.rb +++ b/spec/classes/mod/auth_openidc_spec.rb @@ -31,6 +31,7 @@ it { is_expected.to contain_class('apache::mod::authz_user') } it { is_expected.to contain_apache__mod('auth_openidc') } it { is_expected.to contain_package('mod_auth_openidc') } + it do is_expected.to contain_package('dnf-module-mod_auth_openidc') .with_ensure('present') diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index ab64e4e251..0240db7a09 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -13,6 +13,7 @@ it { is_expected.to contain_apache__mod('dav_svn') } it { is_expected.to contain_package('libapache2-mod-svn') } it { is_expected.to contain_file('dav_svn.load').with_content(%r{LoadModule dav_svn_module}) } + describe 'with parameters' do let :params do { @@ -34,6 +35,7 @@ it { is_expected.to contain_apache__mod('dav_svn') } it { is_expected.to contain_package('mod_dav_svn') } it { is_expected.to contain_file('dav_svn.load').with_content(%r{LoadModule dav_svn_module}) } + describe 'with parameters' do let :params do { diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index 9779610c88..2ee5a6d172 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -46,6 +46,7 @@ def general_deflate_specs is_expected.to contain_file('deflate.conf').with(ensure: 'file', path: '/etc/apache2/mods-available/deflate.conf') } + it { is_expected.to contain_file('deflate.conf symlink').with(ensure: 'link', path: '/etc/apache2/mods-enabled/deflate.conf') diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb index 21df7e29cb..12e5a0826b 100644 --- a/spec/classes/mod/dir_spec.rb +++ b/spec/classes/mod/dir_spec.rb @@ -10,6 +10,7 @@ context 'passing no parameters' do it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('dir') } + it do is_expected.to contain_file('dir.conf') .with_content(%r{^DirectoryIndex }) diff --git a/spec/classes/mod/disk_cache_spec.rb b/spec/classes/mod/disk_cache_spec.rb index 1185420ff5..c889a09952 100644 --- a/spec/classes/mod/disk_cache_spec.rb +++ b/spec/classes/mod/disk_cache_spec.rb @@ -23,10 +23,12 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } + context 'with $default_cache_enable = false' do let(:params) { { 'default_cache_enable' => false } } @@ -34,6 +36,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) @@ -46,6 +49,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) @@ -75,6 +79,7 @@ end it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) @@ -87,6 +92,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) @@ -99,6 +105,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) @@ -130,6 +137,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) @@ -142,6 +150,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) @@ -154,6 +163,7 @@ it { is_expected.to contain_class('apache::mod::disk_cache') } it { is_expected.to contain_class('apache::mod::cache').that_comes_before('Class[Apache::Mod::Disk_cache]') } it { is_expected.to contain_apache__mod('cache_disk') } + it { is_expected.to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 99523e770d..3177450456 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -111,6 +111,7 @@ is_expected.to contain_file('/etc/apache2/mods-available/event.load').with('ensure' => 'file', 'content' => "LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so\n") } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/event.load').with_ensure('link') } end context 'on a RedHat OS' do diff --git a/spec/classes/mod/expires_spec.rb b/spec/classes/mod/expires_spec.rb index d9dea92e6f..066448ecd2 100644 --- a/spec/classes/mod/expires_spec.rb +++ b/spec/classes/mod/expires_spec.rb @@ -24,6 +24,7 @@ include_examples 'RedHat 7' it { is_expected.to contain_apache__mod('expires') } + it { is_expected.to contain_file('expires.conf').with_content( "ExpiresActive On\n" \ @@ -47,6 +48,7 @@ include_examples 'RedHat 7' it { is_expected.to contain_apache__mod('expires') } + it { is_expected.to contain_file('expires.conf').with_content( "ExpiresActive On\n" \ diff --git a/spec/classes/mod/fcgid_spec.rb b/spec/classes/mod/fcgid_spec.rb index 341a2d986e..3adc0cb121 100644 --- a/spec/classes/mod/fcgid_spec.rb +++ b/spec/classes/mod/fcgid_spec.rb @@ -9,9 +9,11 @@ include_examples 'Debian 11' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => nil) } + it { is_expected.to contain_package('libapache2-mod-fcgid') } end @@ -20,9 +22,11 @@ describe 'without parameters' do it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => 'unixd_fcgid.load') } + it { is_expected.to contain_package('mod_fcgid') } end end @@ -31,9 +35,11 @@ include_examples 'FreeBSD 10' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => 'unixd_fcgid.load') } + it { is_expected.to contain_package('www/mod_fcgid') } end @@ -41,9 +47,11 @@ include_examples 'Gentoo' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => nil) } + it { is_expected.to contain_package('www-apache/mod_fcgid') } end end diff --git a/spec/classes/mod/http2_spec.rb b/spec/classes/mod/http2_spec.rb index 3870e3e45e..3046914d06 100644 --- a/spec/classes/mod/http2_spec.rb +++ b/spec/classes/mod/http2_spec.rb @@ -9,6 +9,7 @@ include_examples 'Debian 11' it { is_expected.to contain_class('apache::mod::http2') } + context 'with default values' do let(:expected_content) do <<~EOT diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index 661ec0f3b6..ee4a1abc56 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -71,6 +71,7 @@ def general_info_specs_apache24 is_expected.to contain_file('info.conf').with(ensure: 'file', path: '/etc/apache2/mods-available/info.conf') } + it { is_expected.to contain_file('info.conf symlink').with(ensure: 'link', path: '/etc/apache2/mods-enabled/info.conf') diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index 0197ddc469..4a4668dcf3 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -24,6 +24,7 @@ is_expected.to contain_file('/etc/apache2/mods-available/itk.load').with('ensure' => 'file', 'content' => "LoadModule mpm_itk_module /usr/lib/apache2/modules/mod_mpm_itk.so\n") } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/itk.load').with_ensure('link') } end context 'with enablecapabilities not set' do diff --git a/spec/classes/mod/jk_spec.rb b/spec/classes/mod/jk_spec.rb index 6b3f7ff4b6..bfad48533e 100644 --- a/spec/classes/mod/jk_spec.rb +++ b/spec/classes/mod/jk_spec.rb @@ -41,6 +41,7 @@ it { is_expected.to compile } it { is_expected.to compile.with_all_deps } + expected_content = "# This file is generated automatically by Puppet - DO NOT EDIT\n" \ "# Any manual changes will be overwritten\n" \ "\n" \ @@ -84,6 +85,7 @@ it_behaves_like 'specific workers_file', mod_dir it { is_expected.to contain_apache__listen("#{default_ip}:#{default_port}") } it { is_expected.to contain_package('libapache2-mod-jk') } + it { verify_contents(catalogue, 'jk.conf', ['', '']) } @@ -112,6 +114,7 @@ it_behaves_like 'minimal resources', mod_dir it_behaves_like 'specific workers_file', mod_dir it { is_expected.to contain_apache__listen("#{default_ip}:#{default_port}") } + it { verify_contents(catalogue, 'jk.conf', ['', '']) } diff --git a/spec/classes/mod/mime_magic_spec.rb b/spec/classes/mod/mime_magic_spec.rb index 8bc07b89f3..d1a5c038d2 100644 --- a/spec/classes/mod/mime_magic_spec.rb +++ b/spec/classes/mod/mime_magic_spec.rb @@ -25,6 +25,7 @@ def general_mime_magic_specs is_expected.to contain_file('mime_magic.conf').with(ensure: 'file', path: '/etc/apache2/mods-available/mime_magic.conf') } + it { is_expected.to contain_file('mime_magic.conf symlink').with(ensure: 'link', path: '/etc/apache2/mods-enabled/mime_magic.conf') diff --git a/spec/classes/mod/negotiation_spec.rb b/spec/classes/mod/negotiation_spec.rb index 0f4bd69273..1fccc517e9 100644 --- a/spec/classes/mod/negotiation_spec.rb +++ b/spec/classes/mod/negotiation_spec.rb @@ -9,6 +9,7 @@ context 'default params' do it { is_expected.to contain_class('apache') } + it do is_expected.to contain_file('negotiation.conf').with(ensure: 'file', content: 'LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 603b1cddb7..9bd68cfacf 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -15,9 +15,11 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('passenger') } it { is_expected.to contain_package('libapache2-mod-passenger') } + it { is_expected.to contain_file('zpassenger.load').with('path' => '/etc/apache2/mods-available/zpassenger.load') } + it { is_expected.to contain_file('passenger.conf').with('path' => '/etc/apache2/mods-available/passenger.conf') } @@ -204,9 +206,11 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('passenger') } it { is_expected.to contain_package('libapache2-mod-passenger') } + it { is_expected.to contain_file('zpassenger.load').with('path' => '/etc/apache2/mods-available/zpassenger.load') } + it { is_expected.to contain_file('passenger.conf').with('path' => '/etc/apache2/mods-available/passenger.conf') } @@ -415,16 +419,21 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('passenger') } it { is_expected.to contain_package('mod_passenger') } + it { is_expected.to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') } + it { is_expected.to contain_file('passenger_package.conf').without_content } it { is_expected.to contain_file('passenger_package.conf').without_source } + it { is_expected.to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.d/zpassenger.load') } + it { is_expected.to contain_file('passenger.conf').without_content(%r{PassengerRoot}) } it { is_expected.to contain_file('passenger.conf').without_content(%r{PassengerRuby}) } + describe "with passenger_root => '/usr/lib/example'" do let :params do { passenger_root: '/usr/lib/example' } @@ -446,6 +455,7 @@ it { is_expected.to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') } + it { is_expected.to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.modules.d/zpassenger.load') } @@ -456,6 +466,7 @@ it { is_expected.to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') } + it { is_expected.to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.modules.d/zpassenger.load') } diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index 789cd31196..364f554cdc 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -24,6 +24,7 @@ context 'on stretch' do it { is_expected.to contain_apache__mod('php7.0') } it { is_expected.to contain_package('libapache2-mod-php7.0') } + it { is_expected.to contain_file('php7.0.load').with( content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.0.so\n", @@ -34,6 +35,7 @@ context 'on buster' do it { is_expected.to contain_apache__mod('php7.3') } it { is_expected.to contain_package('libapache2-mod-php7.3') } + it { is_expected.to contain_file('php7.3.load').with( content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.3.so\n", @@ -47,6 +49,7 @@ it { is_expected.to contain_apache__mod('php8.0') } it { is_expected.to contain_package('libapache2-mod-php8.0') } + it { is_expected.to contain_file('php8.0.load').with( content: "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n", @@ -58,6 +61,7 @@ context 'on bullseye' do it { is_expected.to contain_apache__mod('php7.4') } it { is_expected.to contain_package('libapache2-mod-php7.4') } + it { is_expected.to contain_file('php7.4.load').with( content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.4.so\n", @@ -71,6 +75,7 @@ it { is_expected.to contain_apache__mod('php8.0') } it { is_expected.to contain_package('libapache2-mod-php8.0') } + it { is_expected.to contain_file('php8.0.load').with( content: "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n", @@ -105,6 +110,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_package('php') } + if facts[:os]['release']['major'].to_i < 8 it { is_expected.to contain_apache__mod('php5') } it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") } @@ -144,6 +150,7 @@ end it { is_expected.to contain_package('php') } + if facts[:os]['release']['major'].to_i < 8 it { is_expected.to contain_apache__mod('php5') } it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module alternative-path\n") } @@ -187,6 +194,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_class('apache::mod::prefork') } it { is_expected.to contain_package('php') } + if facts[:os]['release']['major'].to_i < 8 it { is_expected.to contain_apache__mod('php5') } it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") } @@ -206,6 +214,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_class('apache::mod::itk') } it { is_expected.to contain_package('php') } + if facts[:os]['release']['major'].to_i < 8 it { is_expected.to contain_apache__mod('php5') } it { is_expected.to contain_file('php5.load').with(content: "LoadModule php5_module modules/libphp5.so\n") } diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index 7cd52100d1..b4535a30a2 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -19,6 +19,7 @@ is_expected.to contain_file('/etc/apache2/mods-available/prefork.load').with('ensure' => 'file', 'content' => "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n") } + it { is_expected.to contain_file('/etc/apache2/mods-enabled/prefork.load').with_ensure('link') } end context 'on a RedHat OS' do @@ -27,6 +28,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('prefork') } it { is_expected.not_to contain_apache__mod('event') } + it { is_expected.to contain_file('/etc/httpd/conf.modules.d/prefork.load').with('ensure' => 'file', 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n") diff --git a/spec/classes/mod/proxy_html_spec.rb b/spec/classes/mod/proxy_html_spec.rb index 2122193990..346625a5e3 100644 --- a/spec/classes/mod/proxy_html_spec.rb +++ b/spec/classes/mod/proxy_html_spec.rb @@ -22,12 +22,14 @@ let(:facts) { override_facts(super(), os: { hardware: 'i386' }) } it { is_expected.to contain_apache__mod('xml2enc').with(loadfiles: nil) } + it_behaves_like 'debian', ['/usr/lib/i386-linux-gnu/libxml2.so.2'] end context 'on x64' do let(:facts) { override_facts(super(), os: { architecture: 'x86_64' }) } it { is_expected.to contain_apache__mod('xml2enc').with(loadfiles: nil) } + it_behaves_like 'debian', ['/usr/lib/x86_64-linux-gnu/libxml2.so.2'] end end diff --git a/spec/classes/mod/proxy_spec.rb b/spec/classes/mod/proxy_spec.rb index 841dd3833a..c14240353e 100644 --- a/spec/classes/mod/proxy_spec.rb +++ b/spec/classes/mod/proxy_spec.rb @@ -13,6 +13,7 @@ it { is_expected.to contain_file('proxy.conf').with_content(%r{ProxyRequests Off}) } it { is_expected.to contain_file('proxy.conf').without_content(%r{ProxyTimeout}) } + context 'with parameters set' do let(:params) do { proxy_timeout: 12_345 } diff --git a/spec/classes/mod/remoteip_spec.rb b/spec/classes/mod/remoteip_spec.rb index aab4d1478d..8e929a9d8b 100644 --- a/spec/classes/mod/remoteip_spec.rb +++ b/spec/classes/mod/remoteip_spec.rb @@ -8,6 +8,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('remoteip') } + it { is_expected.to contain_file('remoteip.conf').with('path' => '/etc/apache2/mods-available/remoteip.conf') } diff --git a/spec/classes/mod/rpaf_spec.rb b/spec/classes/mod/rpaf_spec.rb index 5506317448..560b82bfe3 100644 --- a/spec/classes/mod/rpaf_spec.rb +++ b/spec/classes/mod/rpaf_spec.rb @@ -10,9 +10,11 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('rpaf') } it { is_expected.to contain_package('libapache2-mod-rpaf') } + it { is_expected.to contain_file('rpaf.conf').with('path' => '/etc/apache2/mods-available/rpaf.conf') } + it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFenable On$}) } describe 'with sethostname => true' do @@ -43,9 +45,11 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('rpaf') } it { is_expected.to contain_package('www/mod_rpaf2') } + it { is_expected.to contain_file('rpaf.conf').with('path' => '/usr/local/etc/apache24/Modules/rpaf.conf') } + it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFenable On$}) } describe 'with sethostname => true' do @@ -76,9 +80,11 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('rpaf') } it { is_expected.to contain_package('www-apache/mod_rpaf') } + it { is_expected.to contain_file('rpaf.conf').with('path' => '/etc/apache2/modules.d/rpaf.conf') } + it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFenable On$}) } describe 'with sethostname => true' do diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index e8b3cc36f8..16fdf58630 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -25,6 +25,7 @@ lib: 'mod_security2.so', ) } + it { is_expected.to contain_apache__mod('unique_id').with( id: 'unique_id_module', @@ -51,24 +52,29 @@ .with_content(%r{^\s+SecAuditLog /var/log/httpd/modsec_audit.log$}) .with_content(%r{^\s+SecTmpDir /var/lib/mod_security$}) } + it { is_expected.to contain_file('/etc/httpd/modsecurity.d').with( ensure: 'directory', path: '/etc/httpd/modsecurity.d', owner: 'root', group: 'root', mode: '0755' ) } + it { is_expected.to contain_file('/etc/httpd/modsecurity.d/activated_rules').with( ensure: 'directory', path: '/etc/httpd/modsecurity.d/activated_rules', owner: 'apache', group: 'apache' ) } + it { is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with( path: '/etc/httpd/modsecurity.d/security_crs.conf', ) } + it { is_expected.to contain_apache__security__rule_link('base_rules/modsecurity_35_bad_robots.data') } + it { is_expected.to contain_file('modsecurity_35_bad_robots.data').with( path: '/etc/httpd/modsecurity.d/activated_rules/modsecurity_35_bad_robots.data', @@ -103,6 +109,7 @@ it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecRequestBodyLimitAction ProcessPartial$} } it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecResponseBodyLimitAction Reject$} } it { is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content %r{^\s*SecDefaultAction "phase:2,deny,status:406,nolog,auditlog"$} } + it { is_expected.to contain_file('bar.conf').with( path: '/etc/httpd/modsecurity.d/activated_rules/bar.conf', @@ -144,6 +151,7 @@ owner: 'apache', group: 'apache' ) } + it { is_expected.to contain_file('/etc/httpd/modsecurity.d/custom_rules/custom_01_rules.conf').with_content %r{^\s*.*"id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"$} } end @@ -218,18 +226,22 @@ lib: 'mod_security2.so', ) } + it { is_expected.to contain_apache__mod('unique_id').with( id: 'unique_id_module', lib: 'mod_unique_id.so', ) } + it { is_expected.to contain_package('modsecurity-crs') } + it { is_expected.to contain_file('security.conf').with( path: '/etc/apache2/mods-available/security.conf', ) } + it { is_expected.to contain_file('security.conf') .with_content(%r{^\s+SecAuditLogRelevantStatus "\^\(\?:5\|4\(\?!04\)\)"$}) @@ -239,26 +251,31 @@ .with_content(%r{^\s+SecAuditLog /var/log/apache2/modsec_audit.log$}) .with_content(%r{^\s+SecTmpDir /var/cache/modsecurity$}) } + it { is_expected.to contain_file('/etc/modsecurity').with( ensure: 'directory', path: '/etc/modsecurity', owner: 'root', group: 'root', mode: '0755' ) } + it { is_expected.to contain_file('/etc/modsecurity/activated_rules').with( ensure: 'directory', path: '/etc/modsecurity/activated_rules', owner: 'www-data', group: 'www-data' ) } + it { is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with( path: '/etc/modsecurity/security_crs.conf', ) } + if (facts[:os]['release']['major'].to_i < 18 && facts[:os]['name'] == 'Ubuntu') || (facts[:os]['release']['major'].to_i < 9 && facts[:os]['name'] == 'Debian') it { is_expected.to contain_apache__security__rule_link('base_rules/modsecurity_35_bad_robots.data') } + it { is_expected.to contain_file('modsecurity_35_bad_robots.data').with( path: '/etc/modsecurity/activated_rules/modsecurity_35_bad_robots.data', @@ -295,6 +312,7 @@ it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecRequestBodyLimitAction ProcessPartial$} } it { is_expected.to contain_file('security.conf').with_content %r{^\s+SecResponseBodyLimitAction Reject$} } it { is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content %r{^\s*SecDefaultAction "phase:2,deny,status:406,nolog,auditlog"$} } + it { is_expected.to contain_file('bar.conf').with( path: '/etc/modsecurity/activated_rules/bar.conf', @@ -330,6 +348,7 @@ owner: 'www-data', group: 'www-data' ) } + it { is_expected.to contain_file('/etc/modsecurity/custom_rules/custom_01_rules.conf').with_content %r{\s*.*"id:199999,phase:1,nolog,allow,ctl:ruleEngine=off"$} } end @@ -341,6 +360,7 @@ end it { is_expected.to contain_apache__mod('security2') } + it { is_expected.to contain_file('security.conf').with( path: '/etc/apache2/mods-available/security2.conf', diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index 82f3922c1a..ba4f4a5531 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -17,6 +17,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('ssl') } it { is_expected.to contain_package('mod_ssl') } + it { is_expected.to contain_file('ssl.conf') .with_path('/etc/httpd/conf.modules.d/ssl.conf') diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 4396aba6dc..4b776165a7 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -13,6 +13,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('worker') } it { is_expected.to contain_file('/etc/apache2/mods-available/worker.conf').with_ensure('file') } + it { is_expected.to contain_file('/etc/apache2/mods-available/worker.load').with('ensure' => 'file', 'content' => "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n") @@ -24,6 +25,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.not_to contain_apache__mod('worker') } it { is_expected.not_to contain_apache__mod('event') } + it { is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.load').with('ensure' => 'file', 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n") diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index 1fcc95789f..2b14895d74 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -8,11 +8,13 @@ include_examples 'Debian 11' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_class('apache::mod::wsgi').with( 'wsgi_socket_prefix' => nil, ) } + it { is_expected.to contain_package('libapache2-mod-wsgi-py3') } end context 'on a RedHat OS' do @@ -71,6 +73,7 @@ is_expected.to contain_apache__mod('wsgi').with('package' => 'mod_wsgi_package', 'path' => '/foo/bar/baz') } + it { is_expected.to contain_package('mod_wsgi_package') } it { is_expected.to contain_file('wsgi.load').with_content(%r{LoadModule wsgi_module /foo/bar/baz}) } end @@ -86,6 +89,7 @@ is_expected.to contain_apache__mod('wsgi').with('path' => 'modules/wsgi_mod_name.so', 'package' => 'mod_wsgi_package') } + it { is_expected.to contain_file('wsgi.load').with_content(%r{LoadModule wsgi_module modules/wsgi_mod_name.so}) } end describe 'with package_name but no mod_path' do @@ -111,22 +115,26 @@ include_examples 'FreeBSD 9' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_class('apache::mod::wsgi').with( 'wsgi_socket_prefix' => nil, ) } + it { is_expected.to contain_package('www/mod_wsgi') } end context 'on a Gentoo OS' do include_examples 'Gentoo' it { is_expected.to contain_class('apache::params') } + it { is_expected.to contain_class('apache::mod::wsgi').with( 'wsgi_socket_prefix' => nil, ) } + it { is_expected.to contain_package('www-apache/mod_wsgi') } end context 'overriding mod_libs' do diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index 604ea2f4bd..0e2a7dc79b 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -26,11 +26,13 @@ .that_notifies('Class[Apache::Service]') .that_comes_before('Exec[remove rspec if invalid]') } + it { is_expected.to contain_exec('remove rspec if invalid') .with('unless' => [['/usr/sbin/apachectl', '-t']], 'refreshonly' => 'true') .that_subscribes_to('File[apache_rspec]') } + it { is_expected.to contain_file('apache_rspec') .with('ensure' => 'present', 'content' => '# Test') @@ -50,10 +52,12 @@ it { is_expected.to contain_exec('syntax verification for rspec').with('command' => ['/bin/true']) } + it { is_expected.to contain_exec('remove rspec if invalid').with('command' => ['/bin/rm', '/dne/30-rspec.conf'], 'unless' => [['/bin/true']]) } + it { is_expected.to contain_file('apache_rspec') .that_requires('Package[httpd]') diff --git a/spec/defines/mod_spec.rb b/spec/defines/mod_spec.rb index a510cd564c..c1f4bd8a91 100644 --- a/spec/defines/mod_spec.rb +++ b/spec/defines/mod_spec.rb @@ -16,6 +16,7 @@ describe 'for non-special modules' do it { is_expected.to contain_class('apache::params') } + it 'manages the module load file' do is_expected.to contain_file('spec_m.load').with(path: '/etc/httpd/conf.modules.d/spec_m.load', content: "LoadModule spec_m_module modules/mod_spec_m.so\n", @@ -53,6 +54,7 @@ describe 'for non-special modules' do it { is_expected.to contain_class('apache::params') } + it 'manages the module load file' do is_expected.to contain_file('spec_m.load').with(path: '/etc/apache2/mods-available/spec_m.load', content: "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", @@ -60,6 +62,7 @@ group: 'root', mode: '0644') end + it 'links the module load file' do is_expected.to contain_file('spec_m.load symlink').with(path: '/etc/apache2/mods-enabled/spec_m.load', target: '/etc/apache2/mods-available/spec_m.load', @@ -75,6 +78,7 @@ describe 'for non-special modules' do it { is_expected.to contain_class('apache::params') } + it 'manages the module load file' do is_expected.to contain_file('spec_m.load').with(path: '/usr/local/etc/apache24/Modules/spec_m.load', content: "LoadModule spec_m_module /usr/local/libexec/apache24/mod_spec_m.so\n", @@ -90,6 +94,7 @@ describe 'for non-special modules' do it { is_expected.to contain_class('apache::params') } + it 'manages the module load file' do is_expected.to contain_file('spec_m.load').with(path: '/etc/apache2/modules.d/spec_m.load', content: "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", diff --git a/spec/defines/modsec_link_spec.rb b/spec/defines/modsec_link_spec.rb index 806be9f3d0..914741da3e 100644 --- a/spec/defines/modsec_link_spec.rb +++ b/spec/defines/modsec_link_spec.rb @@ -20,6 +20,7 @@ class { "apache::mod::security": activated_rules => [] } end it { is_expected.to compile.with_all_deps } + case facts[:os]['family'] when 'RedHat' it { diff --git a/spec/defines/vhost_custom_spec.rb b/spec/defines/vhost_custom_spec.rb index a66fcb4752..0e32e46d55 100644 --- a/spec/defines/vhost_custom_spec.rb +++ b/spec/defines/vhost_custom_spec.rb @@ -28,6 +28,7 @@ path: '/etc/apache2/sites-available/25-rspec.example.com.conf', ) } + it { is_expected.to contain_file('25-rspec.example.com.conf symlink').with( ensure: 'link', diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index f9972f4f43..52bf1bbaa9 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -533,29 +533,35 @@ it { is_expected.to compile } it { is_expected.not_to contain_file('/var/www/foo') } it { is_expected.to contain_class('apache::mod::ssl') } + it { is_expected.to contain_file('ssl.conf').with( content: %r{^\s+SSLHonorCipherOrder On$}, ) } + it { is_expected.to contain_file('ssl.conf').with( content: %r{^\s+SSLPassPhraseDialog builtin$}, ) } + it { is_expected.to contain_file('ssl.conf').with( content: %r{^\s+SSLSessionCacheTimeout 300$}, ) } + it { is_expected.to contain_file('rspec.example.com_ssl_cert') } it { is_expected.to contain_file('rspec.example.com_ssl_key') } it { is_expected.to contain_file('rspec.example.com_ssl_chain') } it { is_expected.to contain_file('rspec.example.com_ssl_foo.crl') } + it { is_expected.to contain_file('/var/www/logs').with('ensure' => 'directory', 'mode' => '0600') } + it { is_expected.to contain_class('apache::mod::alias') } it { is_expected.to contain_class('apache::mod::auth_basic') } it { is_expected.to contain_class('apache::mod::authn_file') } @@ -573,12 +579,14 @@ it { is_expected.to contain_class('apache::mod::suexec') } it { is_expected.to contain_class('apache::mod::vhost_alias') } it { is_expected.to contain_class('apache::mod::wsgi') } + it { is_expected.to contain_concat('30-rspec.example.com.conf').with('owner' => 'root', 'mode' => '0644', 'require' => 'Package[httpd]', 'notify' => 'Class[Apache::Service]') } + if os_facts[:os]['release']['major'].to_i >= 18 && os_facts[:os]['name'] == 'Ubuntu' it { is_expected.to contain_file('30-rspec.example.com.conf symlink').with('ensure' => 'link', @@ -592,14 +600,18 @@ .with_content(%r{^\s+LimitRequestLine 8190$}) .with_content(%r{^\s+LimitRequestBody 0$}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-docroot') } + it { is_expected.to contain_concat__fragment('rspec.example.com-aliases').with( content: %r{^\s+Alias /image "/rspec/image"$}, ) } + it { is_expected.to contain_concat__fragment('rspec.example.com-itk') } it { is_expected.to contain_concat__fragment('rspec.example.com-fallbackresource') } + it { is_expected.to contain_concat__fragment('rspec.example.com-directories') .with_content(%r{^\s+$}) @@ -709,16 +721,20 @@ .with_content(%r{^\s+SSLVerifyClient\soptional$}) .with_content(%r{^\s+SSLVerifyDepth\s10$}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') } + it { is_expected.to contain_concat__fragment('rspec.example.com-logging') .with_content(%r{^\s+ErrorLogFormat "\[%t\] \[%l\] %7F: %E: \[client\\ %a\] %M% ,\\ referer\\ %\{Referer\}i"$}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-serversignature') } it { is_expected.not_to contain_concat__fragment('rspec.example.com-access_log') } it { is_expected.to contain_concat__fragment('rspec.example.com-action') } it { is_expected.to contain_concat__fragment('rspec.example.com-block') } it { is_expected.to contain_concat__fragment('rspec.example.com-error_document') } + it { is_expected.to contain_concat__fragment('rspec.example.com-proxy') .with_content(%r{retry=0}) @@ -731,7 +747,9 @@ .with_content(%r{ProxyPassReverseCookiePath\s+\/a\s+http:\/\/}) .with_content(%r{ProxyPassReverseCookieDomain\s+foo\s+http:\/\/foo}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') } + it { is_expected.to contain_concat__fragment('rspec.example.com-rewrite') .with_content(%r{^\s+RewriteEngine On$}) @@ -739,20 +757,24 @@ .with_content(%r{^\s+RewriteBase /}) .with_content(%r{^\s+RewriteRule \^index\.html\$ rewrites.html$}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-scriptalias') } it { is_expected.to contain_concat__fragment('rspec.example.com-serveralias') } + it { is_expected.to contain_concat__fragment('rspec.example.com-setenv') .with_content(%r{SetEnv FOO=/bin/true}) .with_content(%r{SetEnvIf Request_URI "\\.gif\$" object_is_image=gif}) .with_content(%r{SetEnvIfNoCase REMOTE_ADDR \^127.0.0.1 localhost=true}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-ssl') .with_content(%r{^\s+SSLOpenSSLConfCmd\s+DHParameters "foo.pem"$}) .with_content(%r{^\s+SSLHonorCipherOrder\s+Off$}) .with_content(%r{^\s+SSLUserName\s+SSL_CLIENT_S_DN_CN$}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-sslproxy') .with_content(%r{^\s+SSLProxyEngine On$}) @@ -762,13 +784,16 @@ .with_content(%r{^\s+SSLProxyCipherSuite\s+HIGH$}) .with_content(%r{^\s+SSLProxyProtocol\s+TLSv1.2$}) } + it { is_expected.to contain_concat__fragment('rspec.example.com-php_admin') } it { is_expected.to contain_concat__fragment('rspec.example.com-header') } + it { is_expected.to contain_concat__fragment('rspec.example.com-filters').with( content: %r{^\s+FilterDeclare COMPRESS$}, ) } + it { is_expected.to contain_concat__fragment('rspec.example.com-requestheader') } it { is_expected.to contain_concat__fragment('rspec.example.com-wsgi') } it { is_expected.to contain_concat__fragment('rspec.example.com-custom_fragment') } @@ -898,6 +923,7 @@ } it { is_expected.to contain_class('apache::mod::md') } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^MDomain example\.com example\.net auto$}, @@ -1026,11 +1052,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName https:\/\/www\.example\.com:443$}, ) } + it { is_expected.to contain_concat('25-www.example.com.conf') } @@ -1050,11 +1078,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName https:\/\/www\.example\.com$}, ) } + it { is_expected.to contain_concat('25-www.example.com.conf') } @@ -1074,11 +1104,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName www\.example\.com:443$}, ) } + it { is_expected.to contain_concat('25-www.example.com.conf') } @@ -1098,11 +1130,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName www\.example\.com$}, ) } + it { is_expected.to contain_concat('25-www.example.com.conf') } @@ -1121,11 +1155,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[.\/m]*[.\/m]*$}, ) } + it { is_expected.to contain_concat__fragment('Listen 127.0.0.1:80') } it { is_expected.to contain_concat__fragment('Listen [::1]:80') } it { is_expected.not_to contain_concat__fragment('NameVirtualHost 127.0.0.1:80') } @@ -1146,11 +1182,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[.\/m]*[.\/m]*$}, ) } + it { is_expected.to contain_concat__fragment('Listen 127.0.0.1:80') } it { is_expected.to contain_concat__fragment('Listen 127.0.0.1:8080') } it { is_expected.not_to contain_concat__fragment('NameVirtualHost 127.0.0.1:80') } @@ -1171,11 +1209,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[.\/m]*[.\/m]*$}, ) } + it { is_expected.to contain_concat__fragment('Listen 127.0.0.1:80') } it { is_expected.to contain_concat__fragment('Listen 127.0.0.1:8080') } it { is_expected.to contain_concat__fragment('Listen [::1]:80') } @@ -1200,11 +1240,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[.\/m]*[.\/m]*$}, ) } + it { is_expected.to contain_concat__fragment('Listen [::1]:80') } it { is_expected.not_to contain_concat__fragment('NameVirtualHost [::1]:80') } end @@ -1223,11 +1265,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[.\/m]*[.\/m]*$}, ) } + it { is_expected.to contain_concat__fragment('Listen *:80') } it { is_expected.not_to contain_concat__fragment('NameVirtualHost *:80') } end @@ -1241,11 +1285,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+VirtualDocumentRoot "/var/www/sites/%0"$}, ) } + it { is_expected.not_to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+DocumentRoot "/var/www/html"$}, @@ -1262,11 +1308,13 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+VirtualDocumentRoot "/var/www/sites/%0"$}, ) } + it { is_expected.to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+DocumentRoot "/var/www/html"$}, @@ -1283,6 +1331,7 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-security').with( content: %r{^\s*SecAuditLog "\/var\/log\/#{apache_name}\/rspec\.example\.com_security\.log"$}, @@ -1298,6 +1347,7 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-security').with( content: %r{\s*SecAuditLog "\/var\/log\/#{apache_name}\/foo.log"$}, @@ -1315,6 +1365,7 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-security').with( content: %r{ @@ -1340,6 +1391,7 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-security').with( content: %r{ @@ -1447,12 +1499,15 @@ it { is_expected.not_to contain_file('rspec.example.com_ssl_chain') } it { is_expected.not_to contain_file('rspec.example.com_ssl_foo.crl') } it { is_expected.to contain_file('/var/www/foo') } + it { is_expected.to contain_file('/tmp/logroot').with('ensure' => 'absent') } + it { is_expected.to contain_concat('25-rspec.example.com.conf').with('ensure' => 'absent') } + it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header') } it { is_expected.not_to contain_concat__fragment('rspec.example.com-docroot') } it { is_expected.not_to contain_concat__fragment('rspec.example.com-aliases') } @@ -1714,11 +1769,13 @@ content: %r{^\s+CustomLog "\/tmp\/log1"\s+combined\s+env=dev$}, ) } + it { is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog "\/var\/log\/#{apache_name}\/log2"\s+combined\s*$}, ) } + it { is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog "syslog" "%h %l"\s*$}, @@ -1893,6 +1950,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat('25-rspec.example.com.conf') } + if (os_facts[:os]['family'] == 'RedHat' && os_facts[:os]['release']['major'].to_i > 6) || (os_facts[:os]['name'] == 'SLES' && os_facts[:os]['release']['major'].to_i > 11) it { @@ -1921,6 +1979,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat('25-rspec.example.com.conf') } + it { is_expected.not_to contain_concat__fragment('rspec.example.com-directories').with( content: %r{^\s+Require all granted$}, @@ -1958,6 +2017,7 @@ end it { is_expected.to compile } + it { is_expected.to contain_concat__fragment('rspec.example.com-auth_oidc').with( content: %r{^\s+OIDCRedirectURI\s/some/valid/relative/uri$}, diff --git a/spec/functions/bool2httpd_spec.rb b/spec/functions/bool2httpd_spec.rb index e3f40af43d..eb7bcf1c28 100644 --- a/spec/functions/bool2httpd_spec.rb +++ b/spec/functions/bool2httpd_spec.rb @@ -8,14 +8,18 @@ it { is_expected.to run.with_params('1', '2').and_raise_error(ArgumentError) } it { is_expected.to run.with_params(true).and_return('On') } it { is_expected.to run.with_params('true').and_return('On') } + it 'expected to return a string "On"' do expect(subject.execute(true)).to be_an_instance_of(String) end + it { is_expected.to run.with_params(false).and_return('Off') } it { is_expected.to run.with_params('false').and_return('Off') } + it 'expected to return a string "Off"' do expect(subject.execute(false)).to be_an_instance_of(String) end + it { is_expected.to run.with_params('mail').and_return('mail') } it { is_expected.to run.with_params(nil).and_return('Off') } it { is_expected.to run.with_params(:undef).and_return('Off') } diff --git a/spec/util/apache_mod_platform_compatibility_spec.rb b/spec/util/apache_mod_platform_compatibility_spec.rb index f2ab43c297..d2fe142542 100644 --- a/spec/util/apache_mod_platform_compatibility_spec.rb +++ b/spec/util/apache_mod_platform_compatibility_spec.rb @@ -27,9 +27,11 @@ it 'returns an empty hash when given garbage line' do expect(ampc.process_line('foobar')).to eq({}) end + it 'returns a hash with type: :unsupported_platform_declaration and extracted value' do expect(ampc.process_line('# @note Unsupported platforms: foobar')).to eq(type: :unsupported_platform_declaration, value: 'foobar') end + it 'returns a hash with type: :class_declaration and extracted value' do expect(ampc.process_line(foobar_class)).to eq(type: :class_declaration, value: foobar_mod) end @@ -40,27 +42,35 @@ it 'handles single OS with single Version' do expect(ampc.extract_os_ver_pairs('Debian: 5')).to eq('debian' => [5]) end + it 'handles single OS with multiple Versions' do expect(ampc.extract_os_ver_pairs('Debian: 5, 6, 7')).to eq('debian' => [5, 6, 7]) end + it 'handles multiple OSs with multiple Versions' do expect(ampc.extract_os_ver_pairs('Debian: 5, 6, 7; CentOS: 5,6,7')).to eq('debian' => [5, 6, 7], 'centos' => [5, 6, 7]) end + it 'handles Versions in \d+\.\d+ format' do expect(ampc.extract_os_ver_pairs('Ubuntu: 18.04, 20.04')).to eq('ubuntu' => [18, 20]) end + it 'handles Versions with "SP"' do expect(ampc.extract_os_ver_pairs('SLES: 11 SP1, 12')).to eq('sles' => [11, 12]) end + it 'returns an empty Hash when given data in an entirely invalid format' do expect(ampc.extract_os_ver_pairs('foobar')).to eq({}) end + it 'returns an empty Hash when given data with incorrect OS/Version group separator' do expect(ampc.extract_os_ver_pairs('Ubuntu#18.04, 20.04')).to eq({}) end + it 'returns an empty Hash when given data with incorrect OS + Version separator' do expect(ampc.extract_os_ver_pairs('CentOS:7,8#Debian:10,11')).to eq({}) end + it 'returns an empty Hash when given data with incorrect Version separator' do expect(ampc.extract_os_ver_pairs('CentOS:5@6')).to eq({}) end @@ -74,6 +84,7 @@ ampc.register_unsupported_platforms(foobar_pp, 1, foobar_mod, 'debian' => [8]) expect(ampc.mod_supported_on_platform?(foobar_mod)).to be(false) end + it 'registers multiple valid unsupported platforms' do expect(ampc).to receive(:valid_os?).with('debian').and_return(true) expect(ampc).to receive(:valid_os?).with('ubuntu').and_return(true) @@ -84,6 +95,7 @@ ampc.register_running_platform(family: 'ubuntu', release: '14.04', arch: 'x86_64') expect(ampc.mod_supported_on_platform?(foobar_mod)).to be(false) end + it 'registers an :os_parse error when given an invalid platform' do expect(ampc).to receive(:valid_os?).with(foobar_linux).and_return(false) expect(ampc).to receive(:register_error).with(foobar_pp, 1, :os_parse, foobar_linux) @@ -130,16 +142,19 @@ ampc.register_unsupported_platforms(foobar_pp, 1, foobar_mod, 'ubuntu' => [0]) expect(ampc.mod_supported_on_platform?(foobar_mod)).to be(false) end + it 'returns false when running on an OS with one specific version incompatible' do ampc.register_running_platform(ubuntu_14_04_os) ampc.register_unsupported_platforms(foobar_pp, 1, foobar_mod, 'ubuntu' => [14]) expect(ampc.mod_supported_on_platform?(foobar_mod)).to be(false) end + it 'returns true when running on an OS with no versions marked as incompatible' do ampc.register_running_platform(ubuntu_14_04_os) ampc.register_unsupported_platforms(foobar_pp, 1, foobar_mod, 'debian' => [6, 7]) expect(ampc.mod_supported_on_platform?(foobar_mod)).to be(true) end + it 'returns true when running on an OS version not marked as incompatible' do ampc.register_running_platform(ubuntu_14_04_os) ampc.register_unsupported_platforms(foobar_pp, 1, foobar_mod, 'ubuntu' => [16, 18]) From d39da2743ce914b46705ba96c85c42768b33327d Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 09:22:35 +0100 Subject: [PATCH 12/17] (CONT-772) Correct RSpec/EmptyLineAfterExampleGroup --- .rubocop_todo.yml | 11 ------ spec/acceptance/apache_parameters_spec.rb | 3 ++ spec/acceptance/vhost_spec.rb | 22 +++++++++++ spec/classes/apache_spec.rb | 23 ++++++++++++ spec/classes/mod/alias_spec.rb | 6 +++ spec/classes/mod/auth_cas_spec.rb | 1 + spec/classes/mod/auth_gssapi_spec.rb | 3 ++ spec/classes/mod/auth_kerb_spec.rb | 4 ++ spec/classes/mod/auth_mellon_spec.rb | 3 ++ spec/classes/mod/auth_openidc_spec.rb | 4 ++ spec/classes/mod/dav_svn_spec.rb | 3 ++ spec/classes/mod/dir_spec.rb | 1 + spec/classes/mod/disk_cache_spec.rb | 7 ++++ spec/classes/mod/dumpio_spec.rb | 2 + spec/classes/mod/event_spec.rb | 3 ++ spec/classes/mod/expires_spec.rb | 2 + spec/classes/mod/ext_filter_spec.rb | 3 ++ spec/classes/mod/info_spec.rb | 3 ++ spec/classes/mod/itk_spec.rb | 3 ++ spec/classes/mod/lbmethod_bybusyness.rb | 1 + spec/classes/mod/lbmethod_byrequests.rb | 1 + spec/classes/mod/lbmethod_bytraffic.rb | 1 + spec/classes/mod/lbmethod_heartbeat.rb | 1 + spec/classes/mod/passenger_spec.rb | 21 +++++++++++ spec/classes/mod/perl_spec.rb | 3 ++ spec/classes/mod/peruser_spec.rb | 1 + spec/classes/mod/php_spec.rb | 14 +++++++ spec/classes/mod/prefork_spec.rb | 3 ++ spec/classes/mod/proxy_balancer_spec.rb | 1 + spec/classes/mod/proxy_html_spec.rb | 4 ++ spec/classes/mod/python_spec.rb | 3 ++ spec/classes/mod/remoteip_spec.rb | 11 ++++++ spec/classes/mod/reqtimeout_spec.rb | 11 ++++++ spec/classes/mod/rpaf_spec.rb | 8 ++++ spec/classes/mod/security_spec.rb | 3 ++ spec/classes/mod/shib_spec.rb | 1 + spec/classes/mod/ssl_spec.rb | 7 ++++ spec/classes/mod/userdir_spec.rb | 6 +++ spec/classes/mod/worker_spec.rb | 3 ++ spec/classes/mod/wsgi_spec.rb | 12 ++++++ spec/defines/balancer_spec.rb | 3 ++ spec/defines/balancermember_spec.rb | 1 + spec/defines/custom_config_spec.rb | 4 ++ spec/defines/vhost_custom_spec.rb | 3 ++ spec/defines/vhost_spec.rb | 46 +++++++++++++++++++++++ spec/functions/pw_hash_spec.rb | 1 + 46 files changed, 270 insertions(+), 11 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index d5b76ffbcd..1ca9313190 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -73,17 +73,6 @@ RSpec/ContextWording: RSpec/DescribeClass: Enabled: false -# Offense count: 239 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: AllowConsecutiveOneLiners. -# RSpec/EmptyLineAfterExample: -# Enabled: false - -# Offense count: 270 -# This cop supports safe autocorrection (--autocorrect). -RSpec/EmptyLineAfterExampleGroup: - Enabled: false - # Offense count: 25 # Configuration parameters: CountAsOne. RSpec/ExampleLength: diff --git a/spec/acceptance/apache_parameters_spec.rb b/spec/acceptance/apache_parameters_spec.rb index 501a4a9baf..1469e9109c 100644 --- a/spec/acceptance/apache_parameters_spec.rb +++ b/spec/acceptance/apache_parameters_spec.rb @@ -16,6 +16,7 @@ end end end + describe 'default_confd_files => true' do it 'copies conf.d files' do pp = "class { 'apache': default_confd_files => true }" @@ -137,6 +138,7 @@ class { 'apache': describe file("#{apache_hash['confd_dir']}/test.conf") do it { is_expected.to be_file } end + describe file("#{apache_hash['confd_dir']}.vhosts/test.conf") do it { is_expected.to be_file } end @@ -161,6 +163,7 @@ class { 'apache': describe file("#{apache_hash['confd_dir']}/test.conf") do it { is_expected.not_to be_file } end + describe file("#{apache_hash['confd_dir']}.vhosts/test.conf") do it { is_expected.not_to be_file } end diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 36faf5b6c7..442fb31e9b 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -653,6 +653,7 @@ class { 'apache': } it { is_expected.to be_file } it { is_expected.not_to contain 'NameVirtualHost test.server' } end + describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do it { is_expected.to be_file } it { is_expected.to contain 'ServerName test.server' } @@ -677,6 +678,7 @@ class { 'apache': } it { is_expected.to be_file } it { is_expected.not_to contain 'NameVirtualHost test.server' } end + describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do it { is_expected.to be_file } it { is_expected.not_to contain 'ServerName' } @@ -872,27 +874,33 @@ class { 'apache': } it { is_expected.to be_file } it { is_expected.to contain 'AssignUserId nobody nobody' } end + describe file("#{apache_hash['vhost_dir']}/25-test.custom_fragment.conf") do it { is_expected.to be_file } it { is_expected.to contain '#weird test string' } end + describe file("#{apache_hash['vhost_dir']}/test.without_priority_prefix.conf") do it { is_expected.to be_file } end + describe file("#{apache_hash['vhost_dir']}/25-test.ssl_protocol.conf") do it { is_expected.to be_file } it { is_expected.to contain 'SSLProtocol *All -SSLv2' } it { is_expected.to contain 'SSLUserName *SSL_CLIENT_S_DN_CN' } end + describe file("#{apache_hash['vhost_dir']}/25-test.block.conf") do it { is_expected.to be_file } it { is_expected.to contain '' } end + describe file("#{apache_hash['vhost_dir']}/25-test.setenv_setenvif.conf") do it { is_expected.to be_file } it { is_expected.to contain 'SetEnv TEST /test' } it { is_expected.to contain 'SetEnvIf Request_URI "\.gif$" object_is_image=gif' } end + describe file("#{apache_hash['vhost_dir']}/25-test.rewrite.conf") do it { is_expected.to be_file } it { is_expected.to contain '#test' } @@ -900,32 +908,39 @@ class { 'apache': } it { is_expected.to contain 'RewriteRule ^index.html$ welcome.html' } it { is_expected.to contain 'RewriteMap lc int:tolower' } end + describe file("#{apache_hash['vhost_dir']}/25-test.request_headers.conf") do it { is_expected.to be_file } it { is_expected.to contain 'append MirrorID "mirror 12"' } end + describe file("#{apache_hash['vhost_dir']}/25-test.redirect.conf") do it { is_expected.to be_file } it { is_expected.to contain 'Redirect permanent /images http://test.server/' } end + describe file("#{apache_hash['vhost_dir']}/25-test.no_proxy_uris.conf") do it { is_expected.to be_file } it { is_expected.to contain 'ProxyPass http://test2/test !' } it { is_expected.to contain 'ProxyPass / http://test2/' } end + describe file("#{apache_hash['vhost_dir']}/25-test.proxy.conf") do it { is_expected.to be_file } it { is_expected.to contain 'ProxyPass / http://testproxy/' } end + describe file("#{apache_hash['vhost_dir']}/25-test.scriptaliases.conf") do it { is_expected.to be_file } it { is_expected.to contain 'ScriptAlias /myscript "/usr/share/myscript"' } end + describe file("#{apache_hash['vhost_dir']}/25-test.aliases.conf") do it { is_expected.to be_file } it { is_expected.to contain 'Alias /image "/ftp/pub/image"' } it { is_expected.to contain 'ScriptAlias /myscript "/usr/share/myscript"' } end + describe file("#{apache_hash['vhost_dir']}/25-test.access_logs.conf") do it { is_expected.to be_file } it { is_expected.to contain 'CustomLog "/tmp/log1" combined' } @@ -933,26 +948,32 @@ class { 'apache': } it { is_expected.to contain 'CustomLog "/var/tmp/log3" "%h %l"' } it { is_expected.to contain 'CustomLog "syslog" combined' } end + describe file("#{apache_hash['vhost_dir']}/25-test.access_log_env_var.conf") do it { is_expected.to be_file } it { is_expected.to contain 'CustomLog "syslog" combined env=admin' } end + describe file("#{apache_hash['vhost_dir']}/25-test.access_log_format.conf") do it { is_expected.to be_file } it { is_expected.to contain 'CustomLog "syslog" "%h %l"' } end + describe file("#{apache_hash['vhost_dir']}/25-test.logroot.conf") do it { is_expected.to be_file } it { is_expected.to contain ' CustomLog "/tmp' } end + describe file("#{apache_hash['vhost_dir']}/25-test.override.conf") do it { is_expected.to be_file } it { is_expected.to contain 'AllowOverride All' } end + describe file("#{apache_hash['vhost_dir']}/25-test.options.conf") do it { is_expected.to be_file } it { is_expected.to contain 'Options Indexes FollowSymLinks ExecCGI' } end + describe file("#{apache_hash['vhost_dir']}/25-test.empty_options.conf") do it { is_expected.to be_file } it { is_expected.not_to contain 'Options' } @@ -981,6 +1002,7 @@ class { 'apache': } it { is_expected.to contain ' CustomLog "/tmp/test.servername_access.log' } end end + describe 'when the $use_servername_for_filenames parameter is NOT defined' do pp = <<-MANIFEST class { 'apache': } diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index f5236e4d7a..0b88dc1d52 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -169,6 +169,7 @@ it { is_expected.not_to contain_user('www-data') } it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^User www-data\n} } end + describe "Don't create group resource when parameter manage_group is false" do let :params do { manage_group: false } @@ -328,6 +329,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^Include "/etc/httpd/mod\.d/\*\.conf"$} } it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^Include "/etc/httpd/mod\.d/\*\.load"$} } end + describe 'Alternate confd/mod/vhosts directory' do let :params do { @@ -340,6 +342,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^IncludeOptional "/etc/httpd/conf\.d/\*\.conf"$} } end + describe 'Alternate confd/mod/vhosts directory when specifying slash encoding behaviour' do let :params do { @@ -403,6 +406,7 @@ end end end + describe 'Alternate mpm_modules when declaring mpm_module => prefork' do let :params do { mpm_module: 'prefork' } @@ -414,6 +418,7 @@ it { is_expected.not_to contain_class('apache::mod::peruser') } it { is_expected.not_to contain_class('apache::mod::worker') } end + describe 'Alternate mpm_modules when declaring mpm_module => worker' do let :params do { mpm_module: 'worker' } @@ -433,6 +438,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^# Security\n} } end + describe 'different templates for httpd.conf with non-default' do let :params do { conf_template: 'site_apache/fake.conf.erb' } @@ -449,6 +455,7 @@ it { is_expected.to contain_apache__mod('authz_host') } it { is_expected.not_to contain_apache__mod('env') } end + describe 'default mods custom' do let :params do { default_mods: ['info', 'alias', 'mime', 'env', 'setenv', 'expires'] } @@ -459,6 +466,7 @@ it { is_expected.to contain_class('apache::mod::info') } it { is_expected.to contain_class('apache::mod::mime') } end + describe "Don't create user resource when parameter manage_user is false" do let :params do { manage_user: false } @@ -467,6 +475,7 @@ it { is_expected.not_to contain_user('apache') } it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^User apache\n} } end + describe "Don't create group resource when parameter manage_group is false" do let :params do { manage_group: false } @@ -487,6 +496,7 @@ }.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 let :params do { sendfile: 'On' } @@ -494,6 +504,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^EnableSendfile On\n} } end + describe 'sendfile Off' do let :params do { sendfile: 'Off' } @@ -513,6 +524,7 @@ }.to raise_error(Puppet::Error, %r{Evaluation Error}) end end + describe 'hostname_lookups On' do let :params do { hostname_lookups: 'On' } @@ -520,6 +532,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^HostnameLookups On\n} } end + describe 'hostname_lookups Off' do let :params do { hostname_lookups: 'Off' } @@ -536,6 +549,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{^HostnameLookups Double\n} } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 10' @@ -601,6 +615,7 @@ } end end + context 'on a Gentoo OS' do include_examples 'Gentoo' @@ -636,6 +651,7 @@ ).that_notifies('Class[Apache::Service]') } end + context 'on all OSes' do include_examples 'RedHat 8' @@ -653,6 +669,7 @@ ).that_notifies('Class[Apache::Service]') } end + context 'with a custom file_mode parameter' do let :params do { @@ -666,6 +683,7 @@ ) } end + context 'with a custom root_directory_options parameter' do let :params do { @@ -675,6 +693,7 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{Options -Indexes -FollowSymLinks} } end + context 'with a custom root_directory_secured parameter' do let :params do { @@ -684,11 +703,13 @@ it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{Options FollowSymLinks\n\s+AllowOverride None\n\s+Require all denied} } end + context 'default vhost defaults' do it { is_expected.to contain_apache__vhost('default').with_ensure('present') } it { is_expected.to contain_apache__vhost('default-ssl').with_ensure('absent') } it { is_expected.to contain_file('/etc/httpd/conf/httpd.conf').with_content %r{Options FollowSymLinks} } end + context 'without default non-ssl vhost' do let :params do { @@ -699,6 +720,7 @@ it { is_expected.to contain_apache__vhost('default').with_ensure('absent') } it { is_expected.not_to contain_file('/var/www/html') } end + context 'with default ssl vhost' do let :params do { @@ -710,6 +732,7 @@ it { is_expected.to contain_file('/var/www/html') } end end + context 'with unsupported osfamily' do include_examples 'Darwin' diff --git a/spec/classes/mod/alias_spec.rb b/spec/classes/mod/alias_spec.rb index f350f19507..fc17b07fc7 100644 --- a/spec/classes/mod/alias_spec.rb +++ b/spec/classes/mod/alias_spec.rb @@ -12,18 +12,21 @@ it { is_expected.to contain_apache__mod('alias') } it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/share\/apache2\/icons\/"}) } end + context 'on a RedHat 7-based OS', :compile do include_examples 'RedHat 7' it { is_expected.to contain_apache__mod('alias') } it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/share\/httpd\/icons\/"}) } end + context 'on a RedHat 8-based OS', :compile do include_examples 'RedHat 8' it { is_expected.to contain_apache__mod('alias') } it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/share\/httpd\/icons\/"}) } end + context 'with icons options', :compile do let :pre_condition do 'class { apache: default_mods => false }' @@ -39,6 +42,7 @@ it { is_expected.to contain_apache__mod('alias') } it { is_expected.to contain_file('alias.conf').with(content: %r{Options foo}) } end + context 'with icons path change', :compile do let :pre_condition do 'class { apache: default_mods => false }' @@ -54,6 +58,7 @@ it { is_expected.to contain_apache__mod('alias') } it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/apache-icons\/ "\/usr\/share\/httpd\/icons\/"}) } end + context 'with icons path as false', :compile do let :pre_condition do 'class { apache: default_mods => false }' @@ -69,6 +74,7 @@ it { is_expected.to contain_apache__mod('alias') } it { is_expected.not_to contain_file('alias.conf') } end + context 'on a FreeBSD OS', :compile do include_examples 'FreeBSD 10' diff --git a/spec/classes/mod/auth_cas_spec.rb b/spec/classes/mod/auth_cas_spec.rb index d9b62dc60f..8df086e963 100644 --- a/spec/classes/mod/auth_cas_spec.rb +++ b/spec/classes/mod/auth_cas_spec.rb @@ -37,6 +37,7 @@ it { is_expected.to contain_file('auth_cas.conf').with_content(%r{CASTimeout 1234}) } it { is_expected.to contain_file('auth_cas.conf').with_content(%r{CASIdleTimeout 4321}) } end + context 'on a RedHat OS', :compile do include_examples 'RedHat 8' diff --git a/spec/classes/mod/auth_gssapi_spec.rb b/spec/classes/mod/auth_gssapi_spec.rb index 3f67969747..f50d6dd2e4 100644 --- a/spec/classes/mod/auth_gssapi_spec.rb +++ b/spec/classes/mod/auth_gssapi_spec.rb @@ -14,6 +14,7 @@ it { is_expected.to contain_apache__mod('auth_gssapi') } it { is_expected.to contain_package('libapache2-mod-auth-gssapi') } end + context 'on a RedHat OS', :compile do include_examples 'RedHat 8' @@ -22,6 +23,7 @@ it { is_expected.to contain_apache__mod('auth_gssapi') } it { is_expected.to contain_package('mod_auth_gssapi') } end + context 'on a FreeBSD OS', :compile do include_examples 'FreeBSD 9' @@ -30,6 +32,7 @@ it { is_expected.to contain_apache__mod('auth_gssapi') } it { is_expected.to contain_package('www/mod_auth_gssapi') } end + context 'on a Gentoo OS', :compile do include_examples 'Gentoo' diff --git a/spec/classes/mod/auth_kerb_spec.rb b/spec/classes/mod/auth_kerb_spec.rb index 867a5b36d5..84410311bf 100644 --- a/spec/classes/mod/auth_kerb_spec.rb +++ b/spec/classes/mod/auth_kerb_spec.rb @@ -14,6 +14,7 @@ it { is_expected.to contain_apache__mod('auth_kerb') } it { is_expected.to contain_package('libapache2-mod-auth-kerb') } end + context 'on a RedHat OS', :compile do include_examples 'RedHat 8' @@ -22,6 +23,7 @@ it { is_expected.to contain_apache__mod('auth_kerb') } it { is_expected.to contain_package('mod_auth_kerb') } end + context 'on a FreeBSD OS', :compile do include_examples 'FreeBSD 9' @@ -30,6 +32,7 @@ it { is_expected.to contain_apache__mod('auth_kerb') } it { is_expected.to contain_package('www/mod_auth_kerb2') } end + context 'on a Gentoo OS', :compile do include_examples 'Gentoo' @@ -39,6 +42,7 @@ it { is_expected.to contain_package('www-apache/mod_auth_kerb') } end end + context 'overriding mod_packages' do context 'on a RedHat OS', :compile do include_examples 'RedHat 8' diff --git a/spec/classes/mod/auth_mellon_spec.rb b/spec/classes/mod/auth_mellon_spec.rb index ffeb0e6b58..bae7936b04 100644 --- a/spec/classes/mod/auth_mellon_spec.rb +++ b/spec/classes/mod/auth_mellon_spec.rb @@ -15,6 +15,7 @@ it { is_expected.to contain_file('auth_mellon.conf').with_path('/etc/apache2/mods-available/auth_mellon.conf') } it { is_expected.to contain_file('auth_mellon.conf').with_content("MellonPostDirectory \"\/var\/cache\/apache2\/mod_auth_mellon\/\"\n") } end + describe 'with parameters' do let :params do { mellon_cache_size: 200, @@ -35,6 +36,7 @@ it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostCount\s+10$}) } end end + context 'default configuration with parameters on a RedHat OS' do include_examples 'RedHat 8' @@ -45,6 +47,7 @@ it { is_expected.to contain_file('auth_mellon.conf').with_path('/etc/httpd/conf.modules.d/auth_mellon.conf') } it { is_expected.to contain_file('auth_mellon.conf').with_content("MellonCacheSize 100\nMellonLockFile \"/run/mod_auth_mellon/lock\"\n") } end + describe 'with parameters' do let :params do { mellon_cache_size: 200, diff --git a/spec/classes/mod/auth_openidc_spec.rb b/spec/classes/mod/auth_openidc_spec.rb index dc00f7d1ef..aac9be28ea 100644 --- a/spec/classes/mod/auth_openidc_spec.rb +++ b/spec/classes/mod/auth_openidc_spec.rb @@ -15,6 +15,7 @@ it { is_expected.to contain_package('libapache2-mod-auth-openidc') } it { is_expected.not_to contain_package('dnf-module-mod_auth_openidc') } end + context 'on RedHat 7', :compile do include_examples 'RedHat 7' @@ -24,6 +25,7 @@ it { is_expected.to contain_package('mod_auth_openidc') } it { is_expected.not_to contain_package('dnf-module-mod_auth_openidc') } end + context 'on RedHat 8', :compile do include_examples 'RedHat 8' @@ -39,6 +41,7 @@ .that_comes_before('Package[mod_auth_openidc]') end end + context 'on a FreeBSD OS', :compile do include_examples 'FreeBSD 9' @@ -49,6 +52,7 @@ it { is_expected.not_to contain_package('dnf-module-mod_auth_openidc') } end end + context 'overriding mod_packages' do context 'on a RedHat OS', :compile do include_examples 'RedHat 8' diff --git a/spec/classes/mod/dav_svn_spec.rb b/spec/classes/mod/dav_svn_spec.rb index 0240db7a09..fadcc69df6 100644 --- a/spec/classes/mod/dav_svn_spec.rb +++ b/spec/classes/mod/dav_svn_spec.rb @@ -28,6 +28,7 @@ it { is_expected.to contain_file('dav_svn_authz_svn.load').with_content(%r{LoadModule authz_svn_module}) } end end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -50,6 +51,7 @@ it { is_expected.to contain_file('dav_svn_authz_svn.load').with_content(%r{LoadModule authz_svn_module}) } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -72,6 +74,7 @@ it { is_expected.to contain_file('dav_svn_authz_svn.load').with_content(%r{LoadModule authz_svn_module}) } end end + context 'on a Gentoo OS', :compile do include_examples 'Gentoo' diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb index 12e5a0826b..96f50fcdea 100644 --- a/spec/classes/mod/dir_spec.rb +++ b/spec/classes/mod/dir_spec.rb @@ -22,6 +22,7 @@ .with_content(%r{ index\.xhtml$}) end end + context "passing indexes => ['example.txt','fearsome.aspx']" do let :params do { indexes: ['example.txt', 'fearsome.aspx'] } diff --git a/spec/classes/mod/disk_cache_spec.rb b/spec/classes/mod/disk_cache_spec.rb index c889a09952..6666654724 100644 --- a/spec/classes/mod/disk_cache_spec.rb +++ b/spec/classes/mod/disk_cache_spec.rb @@ -42,6 +42,7 @@ .with(content: %r{CacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end + context 'with $default_cache_enable = true' do let(:params) { { 'default_cache_enable' => true } } @@ -55,6 +56,7 @@ .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end + context 'with $default_cache_enable = foo' do let(:params) { { 'default_cache_enable' => 'foo' } } @@ -98,6 +100,7 @@ .with(content: %r{CacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end + context 'with $default_cache_enable = true' do let(:params) { { 'default_cache_enable' => true } } @@ -111,12 +114,14 @@ .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end + context 'with $default_cache_enable = foo' do let(:params) { { 'default_cache_enable' => 'foo' } } it { is_expected.not_to compile } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 10' @@ -156,6 +161,7 @@ .with(content: %r{CacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end + context 'with $default_cache_enable = true' do let(:params) { { 'default_cache_enable' => true } } @@ -169,6 +175,7 @@ .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end + context 'with $default_cache_enable = foo' do let(:params) { { 'default_cache_enable' => 'foo' } } diff --git a/spec/classes/mod/dumpio_spec.rb b/spec/classes/mod/dumpio_spec.rb index 64e01ed9c5..218351d5e0 100644 --- a/spec/classes/mod/dumpio_spec.rb +++ b/spec/classes/mod/dumpio_spec.rb @@ -20,6 +20,7 @@ it { is_expected.to contain_file('dumpio.conf').with_content(%r{^\s*DumpIOInput\s+"Off"$}) } it { is_expected.to contain_file('dumpio.conf').with_content(%r{^\s*DumpIOOutput\s+"Off"$}) } end + context 'with dumpio_input set to On' do let :params do { @@ -30,6 +31,7 @@ it { is_expected.to contain_file('dumpio.conf').with_content(%r{^\s*DumpIOInput\s+"On"$}) } it { is_expected.to contain_file('dumpio.conf').with_content(%r{^\s*DumpIOOutput\s+"Off"$}) } end + context 'with dumpio_ouput set to On' do let :params do { diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 3177450456..723c590cad 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -14,6 +14,7 @@ it { is_expected.not_to contain_apache__mod('event') } it { is_expected.to contain_file('/usr/local/etc/apache24/Modules/event.conf').with_ensure('file') } end + context 'on a Gentoo OS' do include_examples 'Gentoo' @@ -21,6 +22,7 @@ it { is_expected.not_to contain_apache__mod('event') } it { is_expected.to contain_file('/etc/apache2/modules.d/event.conf').with_ensure('file') } end + context 'on a Debian OS' do include_examples 'Debian 11' @@ -114,6 +116,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/event.load').with_ensure('link') } end + context 'on a RedHat OS' do include_examples 'RedHat 8' diff --git a/spec/classes/mod/expires_spec.rb b/spec/classes/mod/expires_spec.rb index 066448ecd2..c9d3681d93 100644 --- a/spec/classes/mod/expires_spec.rb +++ b/spec/classes/mod/expires_spec.rb @@ -11,6 +11,7 @@ it { is_expected.to contain_apache__mod('expires') } it { is_expected.to contain_file('expires.conf').with(content: %r{ExpiresActive On\n}) } end + context 'with expires default', :compile do let :pre_condition do 'class { apache: default_mods => false }' @@ -32,6 +33,7 @@ ) } end + context 'with expires by type', :compile do let :pre_condition do 'class { apache: default_mods => false }' diff --git a/spec/classes/mod/ext_filter_spec.rb b/spec/classes/mod/ext_filter_spec.rb index f75b87686c..010639103b 100644 --- a/spec/classes/mod/ext_filter_spec.rb +++ b/spec/classes/mod/ext_filter_spec.rb @@ -11,6 +11,7 @@ it { is_expected.to contain_apache__mod('ext_filter') } it { is_expected.not_to contain_file('ext_filter.conf') } end + describe 'with parameters' do let :params do { ext_filter_define: { 'filtA' => 'input=A output=B', @@ -21,6 +22,7 @@ it { is_expected.to contain_file('ext_filter.conf').with_content(%r{^ExtFilterDefine\s+filtB\s+input=C cmd="C"$}) } end end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -28,6 +30,7 @@ it { is_expected.to contain_apache__mod('ext_filter') } it { is_expected.not_to contain_file('ext_filter.conf') } end + describe 'with parameters' do let :params do { ext_filter_define: { 'filtA' => 'input=A output=B', diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index ee4a1abc56..88d2b93c01 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -12,6 +12,7 @@ def general_info_specs_apache24 "\n" it { is_expected.to contain_file('info.conf').with_content(expected) } end + context 'passing restrict_access => false' do let :params do { @@ -27,6 +28,7 @@ def general_info_specs_apache24 ) } end + context "passing allow_from => ['10.10.1.2', '192.168.1.2', '127.0.0.1']" do let :params do { allow_from: ['10.10.1.2', '192.168.1.2', '127.0.0.1'] } @@ -40,6 +42,7 @@ def general_info_specs_apache24 is_expected.to contain_file('info.conf').with_content(expected) } end + context 'passing both restrict_access and allow_from' do let :params do { diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index 4a4668dcf3..45f9b9780f 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -27,6 +27,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/itk.load').with_ensure('link') } end + context 'with enablecapabilities not set' do let :pre_condition do 'class { "apache": mpm_module => prefork, }' @@ -54,6 +55,7 @@ 'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n") } end + context 'with enablecapabilities set' do let :pre_condition do 'class { "apache": mpm_module => prefork, }' @@ -68,6 +70,7 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/itk.conf').with_content(%r{EnableCapabilities Off}) } end end + context 'on a FreeBSD OS' do let :pre_condition do 'class { "apache": mpm_module => false, }' diff --git a/spec/classes/mod/lbmethod_bybusyness.rb b/spec/classes/mod/lbmethod_bybusyness.rb index d55629bcad..fa3607c7b7 100644 --- a/spec/classes/mod/lbmethod_bybusyness.rb +++ b/spec/classes/mod/lbmethod_bybusyness.rb @@ -20,6 +20,7 @@ } end end + context 'on a RedHat OS' do include_examples 'RedHat 6' diff --git a/spec/classes/mod/lbmethod_byrequests.rb b/spec/classes/mod/lbmethod_byrequests.rb index d55629bcad..fa3607c7b7 100644 --- a/spec/classes/mod/lbmethod_byrequests.rb +++ b/spec/classes/mod/lbmethod_byrequests.rb @@ -20,6 +20,7 @@ } end end + context 'on a RedHat OS' do include_examples 'RedHat 6' diff --git a/spec/classes/mod/lbmethod_bytraffic.rb b/spec/classes/mod/lbmethod_bytraffic.rb index d55629bcad..fa3607c7b7 100644 --- a/spec/classes/mod/lbmethod_bytraffic.rb +++ b/spec/classes/mod/lbmethod_bytraffic.rb @@ -20,6 +20,7 @@ } end end + context 'on a RedHat OS' do include_examples 'RedHat 6' diff --git a/spec/classes/mod/lbmethod_heartbeat.rb b/spec/classes/mod/lbmethod_heartbeat.rb index d55629bcad..fa3607c7b7 100644 --- a/spec/classes/mod/lbmethod_heartbeat.rb +++ b/spec/classes/mod/lbmethod_heartbeat.rb @@ -20,6 +20,7 @@ } end end + context 'on a RedHat OS' do include_examples 'RedHat 6' diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 9bd68cfacf..5e994b1f6b 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -257,6 +257,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRoot "/usr/lib/example"}) } end + describe 'with passenger_ruby => /usr/lib/example/ruby' do let :params do { passenger_ruby: '/usr/lib/example/ruby' } @@ -264,6 +265,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby"}) } end + describe 'with passenger_default_ruby => /usr/lib/example/ruby1.9.3' do let :params do { passenger_ruby: '/usr/lib/example/ruby1.9.3' } @@ -271,6 +273,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{PassengerRuby "/usr/lib/example/ruby1.9.3"}) } end + describe 'with passenger_high_performance => on' do let :params do { passenger_high_performance: 'on' } @@ -278,6 +281,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerHighPerformance on$}) } end + describe 'with passenger_pool_idle_time => 1200' do let :params do { passenger_pool_idle_time: 1200 } @@ -285,6 +289,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerPoolIdleTime 1200$}) } end + describe 'with passenger_max_request_queue_size => 100' do let :params do { passenger_max_request_queue_size: 100 } @@ -300,6 +305,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerMaxRequests 20$}) } end + describe 'with passenger_spawn_method => direct' do let :params do { passenger_spawn_method: 'direct' } @@ -307,6 +313,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerSpawnMethod direct$}) } end + describe 'with passenger_stat_throttle_rate => 10' do let :params do { passenger_stat_throttle_rate: 10 } @@ -314,6 +321,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerStatThrottleRate 10$}) } end + describe 'with passenger_max_pool_size => 16' do let :params do { passenger_max_pool_size: 16 } @@ -321,6 +329,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerMaxPoolSize 16$}) } end + describe 'with passenger_min_instances => 5' do let :params do { passenger_min_instances: 5 } @@ -328,6 +337,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerMinInstances 5$}) } end + describe 'with passenger_max_instances_per_app => 8' do let :params do { passenger_max_instances_per_app: 8 } @@ -335,6 +345,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerMaxInstancesPerApp 8$}) } end + describe 'with rack_autodetect => on' do let :params do { rack_autodetect: 'on' } @@ -342,6 +353,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ RackAutoDetect on$}) } end + describe 'with rails_autodetect => on' do let :params do { rails_autodetect: 'on' } @@ -349,6 +361,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ RailsAutoDetect on$}) } end + describe 'with passenger_use_global_queue => on' do let :params do { passenger_use_global_queue: 'on' } @@ -356,6 +369,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerUseGlobalQueue on$}) } end + describe "with passenger_app_env => 'foo'" do let :params do { passenger_app_env: 'foo' } @@ -363,6 +377,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerAppEnv foo$}) } end + describe "with passenger_log_file => '/var/log/apache2/passenger.log'" do let :params do { passenger_log_file: '/var/log/apache2/passenger.log' } @@ -370,6 +385,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerLogFile "/var/log/apache2/passenger.log"$}) } end + describe 'with passenger_log_level => 3' do let :params do { passenger_log_level: 3 } @@ -377,6 +393,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerLogLevel 3$}) } end + describe "with mod_path => '/usr/lib/foo/mod_foo.so'" do let :params do { mod_path: '/usr/lib/foo/mod_foo.so' } @@ -384,6 +401,7 @@ it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module \/usr\/lib\/foo\/mod_foo\.so$}) } end + describe "with mod_lib_path => '/usr/lib/foo'" do let :params do { mod_lib_path: '/usr/lib/foo' } @@ -391,6 +409,7 @@ it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module \/usr\/lib\/foo\/mod_passenger\.so$}) } end + describe "with mod_lib => 'mod_foo.so'" do let :params do { mod_lib: 'mod_foo.so' } @@ -398,6 +417,7 @@ it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module \/usr\/lib\/apache2\/modules\/mod_foo\.so$}) } end + describe "with mod_id => 'mod_foo'" do let :params do { mod_id: 'mod_foo' } @@ -441,6 +461,7 @@ it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerRoot "\/usr\/lib\/example"$}) } end + describe 'with passenger_ruby => /usr/lib/example/ruby' do let :params do { passenger_ruby: '/usr/lib/example/ruby' } diff --git a/spec/classes/mod/perl_spec.rb b/spec/classes/mod/perl_spec.rb index c59f2bf2ac..ad41e97503 100644 --- a/spec/classes/mod/perl_spec.rb +++ b/spec/classes/mod/perl_spec.rb @@ -11,6 +11,7 @@ it { is_expected.to contain_apache__mod('perl') } it { is_expected.to contain_package('libapache2-mod-perl2') } end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -18,6 +19,7 @@ it { is_expected.to contain_apache__mod('perl') } it { is_expected.to contain_package('mod_perl') } end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -25,6 +27,7 @@ it { is_expected.to contain_apache__mod('perl') } it { is_expected.to contain_package('www/mod_perl2') } end + context 'on a Gentoo OS' do include_examples 'Gentoo' diff --git a/spec/classes/mod/peruser_spec.rb b/spec/classes/mod/peruser_spec.rb index d514238044..b95904a3b9 100644 --- a/spec/classes/mod/peruser_spec.rb +++ b/spec/classes/mod/peruser_spec.rb @@ -12,6 +12,7 @@ it { is_expected.to compile.and_raise_error(%r{Unsupported osfamily FreeBSD}) } end + context 'on a Gentoo OS' do include_examples 'Gentoo' diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index 364f554cdc..3e364adc21 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -19,6 +19,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_class('apache::mod::prefork') } end + case facts[:os]['release']['major'] when '9' context 'on stretch' do @@ -131,6 +132,7 @@ it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module modules/libphp.so\n") } end end + context 'with alternative package name' do let :pre_condition do 'class { "apache": }' @@ -141,6 +143,7 @@ it { is_expected.to contain_package('php54') } end + context 'with alternative path' do let :pre_condition do 'class { "apache": }' @@ -162,6 +165,7 @@ it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module alternative-path\n") } end end + context 'with alternative extensions' do let :pre_condition do 'class { "apache": }' @@ -174,6 +178,7 @@ it { is_expected.to contain_file('php5.conf').with_content(Regexp.new(Regexp.escape(''))) } if facts[:os]['release']['major'].to_i < 8 end + if facts[:os]['release']['major'].to_i > 5 context 'with specific version' do let :pre_condition do @@ -206,6 +211,7 @@ it { is_expected.to contain_file('php.load').with(content: "LoadModule php_module modules/libphp.so\n") } end end + context 'with mpm_module => itk' do let :pre_condition do 'class { "apache": mpm_module => itk, }' @@ -236,6 +242,7 @@ it { is_expected.to contain_package('www/mod_php5') } it { is_expected.to contain_file('php5.load') } end + context 'with mpm_module => itk' do let :pre_condition do 'class { "apache": mpm_module => itk, }' @@ -256,6 +263,7 @@ it { is_expected.to contain_package('dev-lang/php') } it { is_expected.to contain_file('php5.load') } end + context 'with mpm_module => itk' do let :pre_condition do 'class { "apache": mpm_module => itk, }' @@ -289,6 +297,7 @@ ) } end + context 'with template param' do let :params do { template: 'apache/mod/php.conf.erb' } @@ -300,6 +309,7 @@ ) } end + context 'with source param' do let :params do { source: 'some-path' } @@ -311,6 +321,7 @@ ) } end + context 'content has priority over template' do let :params do { @@ -325,6 +336,7 @@ ) } end + context 'source has priority over template' do let :params do { @@ -339,6 +351,7 @@ ) } end + context 'source has priority over content' do let :params do { @@ -353,6 +366,7 @@ ) } end + context 'with mpm_module => worker' do let :pre_condition do 'class { "apache": mpm_module => worker, }' diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index b4535a30a2..20b416c43a 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -22,6 +22,7 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/prefork.load').with_ensure('link') } end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -34,6 +35,7 @@ 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n") } end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -41,6 +43,7 @@ it { is_expected.not_to contain_apache__mod('prefork') } it { is_expected.to contain_file('/usr/local/etc/apache24/Modules/prefork.conf').with_ensure('file') } end + context 'on a Gentoo OS' do include_examples 'Gentoo' diff --git a/spec/classes/mod/proxy_balancer_spec.rb b/spec/classes/mod/proxy_balancer_spec.rb index e89dce60a1..1b03e82590 100644 --- a/spec/classes/mod/proxy_balancer_spec.rb +++ b/spec/classes/mod/proxy_balancer_spec.rb @@ -41,6 +41,7 @@ def balancer_manager_conf_spec(allow_from, manager_path) it { is_expected.not_to contain_file('proxy_balancer.conf symlink') } end end + context "default configuration with custom parameters $manager => true, $allow_from => ['10.10.10.10','11.11.11.11'], $status_path => '/custom-manager' on a Debian OS" do include_examples 'Debian 11' let :params do diff --git a/spec/classes/mod/proxy_html_spec.rb b/spec/classes/mod/proxy_html_spec.rb index 346625a5e3..a049f6aa71 100644 --- a/spec/classes/mod/proxy_html_spec.rb +++ b/spec/classes/mod/proxy_html_spec.rb @@ -16,6 +16,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__mod('proxy_html').with(loadfiles: loadfiles) } end + include_examples 'Debian 11' context 'on i386' do @@ -25,6 +26,7 @@ it_behaves_like 'debian', ['/usr/lib/i386-linux-gnu/libxml2.so.2'] end + context 'on x64' do let(:facts) { override_facts(super(), os: { architecture: 'x86_64' }) } @@ -42,6 +44,7 @@ it { is_expected.to contain_package('mod_proxy_html') } it { is_expected.to contain_apache__mod('xml2enc').with(loadfiles: nil) } end + context 'on a FreeBSD OS', :compile do include_examples 'FreeBSD 9' @@ -49,6 +52,7 @@ it { is_expected.to contain_apache__mod('proxy_html').with(loadfiles: nil) } it { is_expected.to contain_apache__mod('xml2enc').with(loadfiles: nil) } end + context 'on a Gentoo OS', :compile do include_examples 'Gentoo' diff --git a/spec/classes/mod/python_spec.rb b/spec/classes/mod/python_spec.rb index 4dbefd1bed..4fe137226c 100644 --- a/spec/classes/mod/python_spec.rb +++ b/spec/classes/mod/python_spec.rb @@ -12,6 +12,7 @@ it { is_expected.to contain_apache__mod('python') } it { is_expected.to contain_package('libapache2-mod-python') } end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -28,6 +29,7 @@ it { is_expected.to contain_file('FooBar').with_path('/etc/httpd/conf.modules.d/FooBar') } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -35,6 +37,7 @@ it { is_expected.to contain_apache__mod('python') } it { is_expected.to contain_package('www/mod_python3') } end + context 'on a Gentoo OS' do include_examples 'Gentoo' diff --git a/spec/classes/mod/remoteip_spec.rb b/spec/classes/mod/remoteip_spec.rb index 8e929a9d8b..b89546243d 100644 --- a/spec/classes/mod/remoteip_spec.rb +++ b/spec/classes/mod/remoteip_spec.rb @@ -20,6 +20,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPHeader X-Forwarded-For$}) } end + describe 'with internal_proxy => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { internal_proxy: ['10.42.17.8', '10.42.18.99'] } @@ -28,6 +29,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy 10.42.17.8$}) } it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy 10.42.18.99$}) } end + describe 'with IPv4 CIDR in internal_proxy => [ 192.168.1.0/24 ]' do let :params do { internal_proxy: ['192.168.1.0/24'] } @@ -35,6 +37,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy 192.168.1.0/24$}) } end + describe 'with IPv6 CIDR in internal_proxy => [ fd00:fd00:fd00:2000::/64 ]' do let :params do { internal_proxy: ['fd00:fd00:fd00:2000::/64'] } @@ -42,6 +45,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy fd00:fd00:fd00:2000::/64$}) } end + describe 'with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { proxy_ips: ['10.42.17.8', '10.42.18.99'] } @@ -50,6 +54,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy 10.42.17.8$}) } it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy 10.42.18.99$}) } end + describe 'with IPv4 CIDR in proxy_ips => [ 192.168.1.0/24 ]' do let :params do { proxy_ips: ['192.168.1.0/24'] } @@ -57,6 +62,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy 192.168.1.0/24$}) } end + describe 'with IPv6 CIDR in proxy_ips => [ fd00:fd00:fd00:2000::/64 ]' do let :params do { proxy_ips: ['fd00:fd00:fd00:2000::/64'] } @@ -64,6 +70,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPInternalProxy fd00:fd00:fd00:2000::/64$}) } end + describe 'with trusted_proxy => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { trusted_proxy: ['10.42.17.8', '10.42.18.99'] } @@ -72,6 +79,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPTrustedProxy 10.42.17.8$}) } it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPTrustedProxy 10.42.18.99$}) } end + describe 'with trusted_proxy_ips => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { trusted_proxy: ['10.42.17.8', '10.42.18.99'] } @@ -80,6 +88,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPTrustedProxy 10.42.17.8$}) } it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPTrustedProxy 10.42.18.99$}) } end + describe 'with proxy_protocol_exceptions => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { proxy_protocol_exceptions: ['10.42.17.8', '10.42.18.99'] } @@ -88,6 +97,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPProxyProtocolExceptions 10.42.17.8$}) } it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPProxyProtocolExceptions 10.42.18.99$}) } end + describe 'with IPv4 CIDR in proxy_protocol_exceptions => [ 192.168.1.0/24 ]' do let :params do { proxy_protocol_exceptions: ['192.168.1.0/24'] } @@ -95,6 +105,7 @@ it { is_expected.to contain_file('remoteip.conf').with_content(%r{^RemoteIPProxyProtocolExceptions 192.168.1.0/24$}) } end + describe 'with IPv6 CIDR in proxy_protocol_exceptions => [ fd00:fd00:fd00:2000::/64 ]' do let :params do { proxy_protocol_exceptions: ['fd00:fd00:fd00:2000::/64'] } diff --git a/spec/classes/mod/reqtimeout_spec.rb b/spec/classes/mod/reqtimeout_spec.rb index 9cf449c3cf..63b3415fc4 100644 --- a/spec/classes/mod/reqtimeout_spec.rb +++ b/spec/classes/mod/reqtimeout_spec.rb @@ -12,6 +12,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$}) } end + context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do let :params do { timeouts: ['header=20-60,minrate=600', 'body=60,minrate=600'] } @@ -21,6 +22,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$}) } end + context "passing timeouts => 'header=20-60,minrate=600'" do let :params do { timeouts: 'header=20-60,minrate=600' } @@ -31,6 +33,7 @@ it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600$}) } end end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -39,6 +42,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$}) } end + context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do let :params do { timeouts: ['header=20-60,minrate=600', 'body=60,minrate=600'] } @@ -48,6 +52,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$}) } end + context "passing timeouts => 'header=20-60,minrate=600'" do let :params do { timeouts: 'header=20-60,minrate=600' } @@ -58,6 +63,7 @@ it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600$}) } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -66,6 +72,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$}) } end + context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do let :params do { timeouts: ['header=20-60,minrate=600', 'body=60,minrate=600'] } @@ -75,6 +82,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$}) } end + context "passing timeouts => 'header=20-60,minrate=600'" do let :params do { timeouts: 'header=20-60,minrate=600' } @@ -85,6 +93,7 @@ it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600$}) } end end + context 'on a Gentoo OS' do include_examples 'Gentoo' @@ -93,6 +102,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-40,minrate=500\nRequestReadTimeout body=10,minrate=500$}) } end + context "passing timeouts => ['header=20-60,minrate=600', 'body=60,minrate=600']" do let :params do { timeouts: ['header=20-60,minrate=600', 'body=60,minrate=600'] } @@ -102,6 +112,7 @@ it { is_expected.to contain_apache__mod('reqtimeout') } it { is_expected.to contain_file('reqtimeout.conf').with_content(%r{^RequestReadTimeout header=20-60,minrate=600\nRequestReadTimeout body=60,minrate=600$}) } end + context "passing timeouts => 'header=20-60,minrate=600'" do let :params do { timeouts: 'header=20-60,minrate=600' } diff --git a/spec/classes/mod/rpaf_spec.rb b/spec/classes/mod/rpaf_spec.rb index 560b82bfe3..4de5fb5710 100644 --- a/spec/classes/mod/rpaf_spec.rb +++ b/spec/classes/mod/rpaf_spec.rb @@ -24,6 +24,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFsethostname On$}) } end + describe 'with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { proxy_ips: ['10.42.17.8', '10.42.18.99'] } @@ -31,6 +32,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFproxy_ips 10.42.17.8 10.42.18.99$}) } end + describe 'with header => X-Real-IP' do let :params do { header: 'X-Real-IP' } @@ -39,6 +41,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFheader X-Real-IP$}) } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -59,6 +62,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFsethostname On$}) } end + describe 'with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { proxy_ips: ['10.42.17.8', '10.42.18.99'] } @@ -66,6 +70,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFproxy_ips 10.42.17.8 10.42.18.99$}) } end + describe 'with header => X-Real-IP' do let :params do { header: 'X-Real-IP' } @@ -74,6 +79,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFheader X-Real-IP$}) } end end + context 'on a Gentoo OS' do include_examples 'Gentoo' @@ -94,6 +100,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFsethostname On$}) } end + describe 'with proxy_ips => [ 10.42.17.8, 10.42.18.99 ]' do let :params do { proxy_ips: ['10.42.17.8', '10.42.18.99'] } @@ -101,6 +108,7 @@ it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFproxy_ips 10.42.17.8 10.42.18.99$}) } end + describe 'with header => X-Real-IP' do let :params do { header: 'X-Real-IP' } diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index 16fdf58630..f38ac5037c 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -117,6 +117,7 @@ ) } end + describe 'with other modsec parameters' do let :params do { @@ -126,6 +127,7 @@ it { is_expected.not_to contain_file('/etc/httpd/modsecurity.d/security_crs.conf') } end + describe 'with custom parameters' do let :params do { @@ -137,6 +139,7 @@ is_expected.not_to contain_file('/etc/httpd/modsecurity.d/custom_rules/custom_01_rules.conf') } end + describe 'with parameters' do let :params do { diff --git a/spec/classes/mod/shib_spec.rb b/spec/classes/mod/shib_spec.rb index a1f25afb33..92168a7d56 100644 --- a/spec/classes/mod/shib_spec.rb +++ b/spec/classes/mod/shib_spec.rb @@ -11,6 +11,7 @@ it { is_expected.to contain_apache__mod('shib2').with_id('mod_shib') } end end + context 'on a RedHat OS' do include_examples 'RedHat 8' diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index ba4f4a5531..f631458edb 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -72,6 +72,7 @@ it { is_expected.not_to contain_package('libapache2-mod-ssl') } it { is_expected.to contain_file('ssl.conf').with_content(%r{SSLProtocol all -SSLv3}) } end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -94,6 +95,7 @@ it { is_expected.to contain_apache__mod('ssl') } it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLSessionCache "shmcb:/var/lib/apache2/ssl_scache\(512000\)"$}) } end + # Template config doesn't vary by distro context 'on all distros' do include_examples 'RedHat 8' @@ -148,6 +150,7 @@ it { is_expected.not_to contain_file('ssl.conf').with_content(%r{^ SSLCompression Off$}) } it { is_expected.not_to contain_file('ssl.conf').with_content(%r{^ SSLSessionTickets (Off|On)$}) } end + context 'with ssl_compression set to true' do let :params do { @@ -177,6 +180,7 @@ it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLUseStapling On$}) } end + context 'with ssl_stapling_return_errors set to true' do let :params do { @@ -186,6 +190,7 @@ it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLStaplingReturnResponderErrors On$}) } end + context 'with stapling_cache' do let :params do { @@ -235,6 +240,7 @@ it { is_expected.to contain_file('ssl.conf').with_content(%r{^ Mutex posixsem$}) } end + context 'setting ssl_sessioncache' do let :params do { @@ -244,6 +250,7 @@ it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLSessionCache "shmcb:/tmp/customsessioncache\(51200\)"$}) } end + context 'setting ssl_proxy_protocol' do let :params do { diff --git a/spec/classes/mod/userdir_spec.rb b/spec/classes/mod/userdir_spec.rb index fa6c6af8e2..2a721d4b11 100644 --- a/spec/classes/mod/userdir_spec.rb +++ b/spec/classes/mod/userdir_spec.rb @@ -16,6 +16,7 @@ context 'default parameters' do it { is_expected.to compile } end + context 'with dir set to something' do let :params do { @@ -26,6 +27,7 @@ it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/hi$}) } it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } end + context 'with home set to something' do let :params do { @@ -36,6 +38,7 @@ it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/u/\*/public_html$}) } it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } end + context 'with path set to something' do let :params do { @@ -46,6 +49,7 @@ it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/\*/public_html$}) } it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } end + context 'with userdir set to something' do let :params do { @@ -57,6 +61,7 @@ it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+public_html$}) } it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } end + context 'with unmanaged_path set to true' do let :params do { @@ -67,6 +72,7 @@ it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/public_html$}) } it { is_expected.not_to contain_file('userdir.conf').with_content(%r{^\s*\ "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n") } end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -31,6 +32,7 @@ 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n") } end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -38,6 +40,7 @@ it { is_expected.not_to contain_apache__mod('worker') } it { is_expected.to contain_file('/usr/local/etc/apache24/Modules/worker.conf').with_ensure('file') } end + context 'on a Gentoo OS' do include_examples 'Gentoo' diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index 2b14895d74..b539500e2f 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -17,6 +17,7 @@ it { is_expected.to contain_package('libapache2-mod-wsgi-py3') } end + context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -33,6 +34,7 @@ it { is_expected.to contain_file('wsgi.conf').with_content(%r{^ WSGIRestrictEmbedded On$}) } end + describe 'with custom WSGISocketPrefix' do let :params do { wsgi_socket_prefix: 'run/wsgi' } @@ -40,6 +42,7 @@ it { is_expected.to contain_file('wsgi.conf').with_content(%r{^ WSGISocketPrefix run\/wsgi$}) } end + describe 'with custom WSGIPythonHome' do let :params do { wsgi_python_home: '/path/to/virtenv' } @@ -47,6 +50,7 @@ it { is_expected.to contain_file('wsgi.conf').with_content(%r{^ WSGIPythonHome "\/path\/to\/virtenv"$}) } end + describe 'with custom WSGIApplicationGroup' do let :params do { wsgi_application_group: '%{GLOBAL}' } @@ -54,6 +58,7 @@ it { is_expected.to contain_file('wsgi.conf').with_content(%r{^ WSGIApplicationGroup "%{GLOBAL}"$}) } end + describe 'with custom WSGIPythonOptimize' do let :params do { wsgi_python_optimize: 1 } @@ -61,6 +66,7 @@ it { is_expected.to contain_file('wsgi.conf').with_content(%r{^ WSGIPythonOptimize 1$}) } end + describe 'with custom package_name and mod_path' do let :params do { @@ -77,6 +83,7 @@ it { is_expected.to contain_package('mod_wsgi_package') } it { is_expected.to contain_file('wsgi.load').with_content(%r{LoadModule wsgi_module /foo/bar/baz}) } end + describe 'with custom mod_path not containing /' do let :params do { @@ -92,6 +99,7 @@ it { is_expected.to contain_file('wsgi.load').with_content(%r{LoadModule wsgi_module modules/wsgi_mod_name.so}) } end + describe 'with package_name but no mod_path' do let :params do { @@ -101,6 +109,7 @@ it { is_expected.to compile.and_raise_error(%r{apache::mod::wsgi - both package_name and mod_path must be specified!}) } end + describe 'with mod_path but no package_name' do let :params do { @@ -111,6 +120,7 @@ it { is_expected.to compile.and_raise_error(%r{apache::mod::wsgi - both package_name and mod_path must be specified!}) } end end + context 'on a FreeBSD OS' do include_examples 'FreeBSD 9' @@ -124,6 +134,7 @@ it { is_expected.to contain_package('www/mod_wsgi') } end + context 'on a Gentoo OS' do include_examples 'Gentoo' @@ -137,6 +148,7 @@ it { is_expected.to contain_package('www-apache/mod_wsgi') } end + context 'overriding mod_libs' do context 'on a RedHat OS', :compile do include_examples 'RedHat 8' diff --git a/spec/defines/balancer_spec.rb b/spec/defines/balancer_spec.rb index fd299b954a..aa2dca3225 100644 --- a/spec/defines/balancer_spec.rb +++ b/spec/defines/balancer_spec.rb @@ -18,6 +18,7 @@ it { is_expected.to contain_concat('apache_balancer_myapp') } it { is_expected.to contain_concat__fragment('00-myapp-header').with_content(%r{^$}) } end + describe 'accept a target parameter and use it' do let :params do { @@ -29,6 +30,7 @@ is_expected.to contain_concat('apache_balancer_myapp').with(path: '/tmp/myapp.conf') } end + describe 'accept an options parameter and use it' do let :params do { @@ -43,6 +45,7 @@ } end end + describe 'apache pre_condition with conf_dir set' do let :pre_condition do 'class{"apache": diff --git a/spec/defines/balancermember_spec.rb b/spec/defines/balancermember_spec.rb index aeef4f1cce..cec2c5c97d 100644 --- a/spec/defines/balancermember_spec.rb +++ b/spec/defines/balancermember_spec.rb @@ -30,6 +30,7 @@ it { is_expected.to contain_concat__fragment('BalancerMember http://127.0.0.1:8080/') } end + describe 'allows balancermember with a different target' do let :pre_condition do 'include apache diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index 0e2a7dc79b..db695c05f2 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -39,6 +39,7 @@ .that_requires('Package[httpd]') } end + context 'set everything with source' do let :params do { @@ -66,6 +67,7 @@ 'source' => 'puppet:///modules/apache/test') } end + context 'verify_config => false' do let :params do { @@ -78,6 +80,7 @@ it { is_expected.not_to contain_exec('remove rspec if invalid') } it { is_expected.to contain_file('apache_rspec').that_notifies('Class[Apache::Service]') } end + context 'ensure => absent' do let :params do { @@ -89,6 +92,7 @@ it { is_expected.not_to contain_exec('remove rspec if invalid') } it { is_expected.to contain_file('apache_rspec').with('ensure' => 'absent') } end + describe 'validation' do context 'both content and source' do let :params do diff --git a/spec/defines/vhost_custom_spec.rb b/spec/defines/vhost_custom_spec.rb index 0e32e46d55..ffd6aca080 100644 --- a/spec/defines/vhost_custom_spec.rb +++ b/spec/defines/vhost_custom_spec.rb @@ -18,6 +18,7 @@ it { is_expected.to compile } end + context 'on Debian based systems' do include_examples 'Debian 11' @@ -37,6 +38,7 @@ ) } end + context 'on FreeBSD systems' do include_examples 'FreeBSD 9' @@ -48,6 +50,7 @@ ) } end + context 'on Gentoo systems' do include_examples 'Gentoo' diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 52bf1bbaa9..9fb5031987 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -34,6 +34,7 @@ it { is_expected.to contain_class('apache::params') } it { is_expected.to contain_apache__listen(params[:port]) } end + context 'set everything!' do let :params do { @@ -930,6 +931,7 @@ ) } end + context 'vhost with proxy_add_headers true' do let :params do { @@ -957,6 +959,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(%r{ProxyAddHeaders On}) } end + context 'vhost with proxy_add_headers false' do let :params do { @@ -984,6 +987,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content(%r{ProxyAddHeaders Off}) } end + context 'vhost without proxy' do let :params do { @@ -1010,6 +1014,7 @@ it { is_expected.to compile } it { is_expected.not_to contain_concat__fragment('rspec.example.com-proxy') } end + context 'vhost without proxy_add_headers' do let :params do { @@ -1037,6 +1042,7 @@ it { is_expected.to compile } it { is_expected.not_to contain_concat__fragment('rspec.example.com-proxy').with_content(%r{ProxyAddHeaders}) } end + context 'vhost with scheme and port in servername and use_servername_for_filenames' do let :params do { @@ -1063,6 +1069,7 @@ is_expected.to contain_concat('25-www.example.com.conf') } end + context 'vhost with scheme in servername and use_servername_for_filenames' do let :params do { @@ -1089,6 +1096,7 @@ is_expected.to contain_concat('25-www.example.com.conf') } end + context 'vhost with port in servername and use_servername_for_filenames' do let :params do { @@ -1115,6 +1123,7 @@ is_expected.to contain_concat('25-www.example.com.conf') } end + context 'vhost with servername and use_servername_for_filenames' do let :params do { @@ -1141,6 +1150,7 @@ is_expected.to contain_concat('25-www.example.com.conf') } end + context 'vhost with multiple ip addresses' do let :params do { @@ -1298,6 +1308,7 @@ ) } end + context 'vhost with virtual_docroot and docroot' do let :params do { @@ -1338,6 +1349,7 @@ ) } end + context 'modsec_audit_log_file' do let :params do { @@ -1421,6 +1433,7 @@ it { is_expected.to contain_class('apache::mod::alias') } end + context 'proxy_pass_match' do let :params do { @@ -1539,6 +1552,7 @@ it { is_expected.not_to contain_concat__fragment('rspec.example.com-limits') } it { is_expected.to contain_concat__fragment('rspec.example.com-file_footer') } end + context 'wsgi_application_group should set apache::mod::wsgi' do let :params do { @@ -1549,6 +1563,7 @@ it { is_expected.to contain_class('apache::mod::wsgi') } end + context 'wsgi_daemon_process should set apache::mod::wsgi' do let :params do { @@ -1559,6 +1574,7 @@ it { is_expected.to contain_class('apache::mod::wsgi') } end + context 'wsgi_import_script on its own should not set apache::mod::wsgi' do let :params do { @@ -1569,6 +1585,7 @@ it { is_expected.not_to contain_class('apache::mod::wsgi') } end + context 'wsgi_import_script_options on its own should not set apache::mod::wsgi' do let :params do { @@ -1582,6 +1599,7 @@ it { is_expected.not_to contain_class('apache::mod::wsgi') } end + context 'wsgi_import_script and wsgi_import_script_options should set apache::mod::wsgi' do let :params do { @@ -1596,6 +1614,7 @@ it { is_expected.to contain_class('apache::mod::wsgi') } end + context 'wsgi_process_group should set apache::mod::wsgi' do let :params do { @@ -1606,6 +1625,7 @@ it { is_expected.to contain_class('apache::mod::wsgi') } end + context 'wsgi_script_aliases with non-empty aliases should set apache::mod::wsgi' do let :params do { @@ -1618,6 +1638,7 @@ it { is_expected.to contain_class('apache::mod::wsgi') } end + context 'wsgi_script_aliases with empty aliases should set apache::mod::wsgi' do let :params do { @@ -1628,6 +1649,7 @@ it { is_expected.not_to contain_class('apache::mod::wsgi') } end + context 'wsgi_pass_authorization should set apache::mod::wsgi' do let :params do { @@ -1638,6 +1660,7 @@ it { is_expected.to contain_class('apache::mod::wsgi') } end + context 'when not setting nor managing the docroot' do let :params do { @@ -1649,6 +1672,7 @@ it { is_expected.to compile } it { is_expected.not_to contain_concat__fragment('rspec.example.com-docroot') } end + context 'ssl_proxyengine without ssl' do let :params do { @@ -1662,6 +1686,7 @@ it { is_expected.not_to contain_concat__fragment('rspec.example.com-ssl') } it { is_expected.to contain_concat__fragment('rspec.example.com-sslproxy') } end + context 'ssl_proxy_protocol without ssl_proxyengine' do let :params do { @@ -1676,6 +1701,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-ssl') } it { is_expected.not_to contain_concat__fragment('rspec.example.com-sslproxy') } end + context 'ssl_honorcipherorder' do let :params do { @@ -1697,6 +1723,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+On$}) } end + context 'ssl_honorcipherorder true' do let :params do super().merge({ 'ssl_honorcipherorder' => true }) @@ -1705,6 +1732,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+On$}) } end + context 'ssl_honorcipherorder off' do let :params do super().merge({ 'ssl_honorcipherorder' => 'off' }) @@ -1713,6 +1741,7 @@ it { is_expected.to compile } it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+Off$}) } end + context 'ssl_honorcipherorder false' do let :params do super().merge({ 'ssl_honorcipherorder' => false }) @@ -1722,6 +1751,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-ssl').with_content(%r{^\s*SSLHonorCipherOrder\s+Off$}) } end end + describe 'access logs' do context 'single log file' do let(:params) do @@ -1737,6 +1767,7 @@ ) } end + context 'single log file with environment' do let(:params) do { @@ -1752,6 +1783,7 @@ ) } end + context 'multiple log files' do let(:params) do { @@ -1783,6 +1815,7 @@ } end end # access logs + describe 'error logs format' do context 'single log format directive as a string' do let(:params) do @@ -1823,6 +1856,7 @@ } end end # error logs format + describe 'validation' do let(:params) do { @@ -1849,6 +1883,7 @@ it { is_expected.to raise_error(Puppet::Error) } end + context 'empty rewrites' do let(:params) do super().merge( @@ -1862,6 +1897,7 @@ is_expected.not_to contain_concat__fragment('rspec.example.com-rewrite') } end + context 'empty rewrites_with_rewrite_inherit' do let(:params) do super().merge( @@ -1877,6 +1913,7 @@ .with_content(%r{^\s+RewriteRule \^index\.html\$ welcome.html$}) } end + context 'empty rewrites_without_rewrite_inherit' do let(:params) do super().merge( @@ -1904,6 +1941,7 @@ it { is_expected.to raise_error(Puppet::Error) } end + context 'access_log_file and access_log_pipe' do let :params do super().merge( @@ -1914,6 +1952,7 @@ it { is_expected.to raise_error(Puppet::Error) } end + context 'error_log_file and error_log_pipe' do let :params do super().merge( @@ -1924,16 +1963,19 @@ it { is_expected.to raise_error(Puppet::Error) } end + context 'bad custom_fragment' do let(:params) { super().merge('custom_fragment' => true) } it { is_expected.to raise_error(Puppet::Error) } end + context 'bad access_logs' do let(:params) { super().merge('access_logs' => '/var/log/somewhere') } it { is_expected.to raise_error(Puppet::Error) } end + context 'default of require all granted' do let :params do { @@ -1986,6 +2028,7 @@ ) } end + describe 'redirectmatch_*' do let(:params) { super().merge(port: 84) } @@ -1995,12 +2038,14 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') } it { is_expected.to contain_class('apache::mod::alias') } end + context 'none' do it { is_expected.not_to contain_concat__fragment('rspec.example.com-redirect') } it { is_expected.not_to contain_class('apache::mod::alias') } end end end + context 'oidc_settings RedirectURL' do describe 'with VALID relative URI' do let :params do @@ -2042,6 +2087,7 @@ it { is_expected.not_to compile } end end + context 'mdomain' do let :params do default_params.merge( diff --git a/spec/functions/pw_hash_spec.rb b/spec/functions/pw_hash_spec.rb index 5faf7d43e9..40674aa890 100644 --- a/spec/functions/pw_hash_spec.rb +++ b/spec/functions/pw_hash_spec.rb @@ -20,6 +20,7 @@ describe 'apache_pw_hash', type: :puppet_function do it_behaves_like 'apache::pw_hash function' end + describe 'apache::apache_pw_hash', type: :puppet_function do it_behaves_like 'apache::pw_hash function' end From ac31ad56db5c1c3aaa10c4e541c10cafc223b83e Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 09:28:46 +0100 Subject: [PATCH 13/17] (CONT-772) Correct cop group 3 --- .rubocop_todo.yml | 35 ++--------------------- spec/acceptance/apache_parameters_spec.rb | 4 +-- spec/acceptance/vhost_spec.rb | 12 ++++---- spec/classes/mod/auth_mellon_spec.rb | 2 +- spec/defines/vhost_spec.rb | 4 +-- spec/spec_helper.rb | 2 +- util/apache_mod_platform_support.rb | 6 ++-- 7 files changed, 17 insertions(+), 48 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 1ca9313190..a5be54e7ee 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-19 23:25:24 UTC using RuboCop version 1.48.1. +# on 2023-04-20 08:33:47 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -98,7 +98,7 @@ RSpec/ImplicitSubject: Enabled: false # Offense count: 16 -# This cop supports safe autocorrection (--autocorrect). +# This cop supports safe autocorrection. RSpec/LetBeforeExamples: Exclude: - 'spec/classes/mod/auth_kerb_spec.rb' @@ -217,40 +217,9 @@ Style/RedundantRegexpEscape: - 'spec/classes/mod/wsgi_spec.rb' - 'spec/defines/vhost_spec.rb' -# Offense count: 22 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantStringEscape: - Exclude: - - 'spec/acceptance/apache_parameters_spec.rb' - - 'spec/acceptance/vhost_spec.rb' - - 'spec/classes/mod/auth_mellon_spec.rb' - - 'spec/defines/vhost_spec.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: implicit, explicit -Style/RescueStandardError: - Exclude: - - 'spec/spec_helper.rb' - -# Offense count: 3 -# This cop supports safe autocorrection (--autocorrect). -Style/StderrPuts: - Exclude: - - 'util/apache_mod_platform_support.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. Style/StringConcatenation: Exclude: - 'lib/puppet/functions/apache/pw_hash.rb' - -# Offense count: 1 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle, AllowSafeAssignment. -# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex -Style/TernaryParentheses: - Exclude: - - 'spec/defines/vhost_spec.rb' diff --git a/spec/acceptance/apache_parameters_spec.rb b/spec/acceptance/apache_parameters_spec.rb index 1469e9109c..28ba8f547f 100644 --- a/spec/acceptance/apache_parameters_spec.rb +++ b/spec/acceptance/apache_parameters_spec.rb @@ -367,8 +367,8 @@ class { 'apache': pp = <<-MANIFEST class { 'apache': log_formats => { - 'vhost_common' => '%v %h %l %u %t \\\"%r\\\" %>s %b', - 'vhost_combined' => '%v %h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-agent}i\\\"', + 'vhost_common' => '%v %h %l %u %t \\"%r\\" %>s %b', + 'vhost_combined' => '%v %h %l %u %t \\"%r\\" %>s %b \\"%{Referer}i\\" \\"%{User-agent}i\\"', } } MANIFEST diff --git a/spec/acceptance/vhost_spec.rb b/spec/acceptance/vhost_spec.rb index 442fb31e9b..da2867d162 100644 --- a/spec/acceptance/vhost_spec.rb +++ b/spec/acceptance/vhost_spec.rb @@ -125,7 +125,7 @@ class { 'apache': } it { is_expected.to contain 'ProxyPreserveHost On' } it { is_expected.to contain 'ProxyErrorOverride On' } it { is_expected.not_to contain 'ProxyAddHeaders' } - it { is_expected.not_to contain "" } + it { is_expected.not_to contain '' } end end @@ -153,7 +153,7 @@ class { 'apache': } it { is_expected.to contain 'ProxyPreserveHost On' } it { is_expected.to contain 'ProxyErrorOverride On' } it { is_expected.not_to contain 'ProxyAddHeaders' } - it { is_expected.not_to contain "" } + it { is_expected.not_to contain '' } end end @@ -276,9 +276,9 @@ class { 'apache': class { 'apache': } if versioncmp('#{apache_hash['version']}', '2.4') >= 0 { - $_files_match_directory = { 'path' => '(\.swp|\.bak|~)$', 'provider' => 'filesmatch', 'require' => 'all denied', } + $_files_match_directory = { 'path' => '(.swp|.bak|~)$', 'provider' => 'filesmatch', 'require' => 'all denied', } } else { - $_files_match_directory = { 'path' => '(\.swp|\.bak|~)$', 'provider' => 'filesmatch', 'deny' => 'from all', } + $_files_match_directory = { 'path' => '(.swp|.bak|~)$', 'provider' => 'filesmatch', 'deny' => 'from all', } } $_directories = [ @@ -785,14 +785,14 @@ class { 'apache': } apache::vhost { 'test.setenv_setenvif': docroot => '/tmp', setenv => ['TEST /test'], - setenvif => ['Request_URI "\.gif$" object_is_image=gif'] + setenvif => ['Request_URI ".gif$" object_is_image=gif'] } apache::vhost { 'test.rewrite': docroot => '/tmp', rewrites => [ { comment => 'test', rewrite_cond => '%{HTTP_USER_AGENT} ^Lynx/ [OR]', - rewrite_rule => ['^index\.html$ welcome.html'], + rewrite_rule => ['^index.html$ welcome.html'], rewrite_map => ['lc int:tolower'], } ], diff --git a/spec/classes/mod/auth_mellon_spec.rb b/spec/classes/mod/auth_mellon_spec.rb index bae7936b04..99e01afe7f 100644 --- a/spec/classes/mod/auth_mellon_spec.rb +++ b/spec/classes/mod/auth_mellon_spec.rb @@ -13,7 +13,7 @@ it { is_expected.to contain_apache__mod('auth_mellon') } it { is_expected.to contain_package('libapache2-mod-auth-mellon') } it { is_expected.to contain_file('auth_mellon.conf').with_path('/etc/apache2/mods-available/auth_mellon.conf') } - it { is_expected.to contain_file('auth_mellon.conf').with_content("MellonPostDirectory \"\/var\/cache\/apache2\/mod_auth_mellon\/\"\n") } + it { is_expected.to contain_file('auth_mellon.conf').with_content("MellonPostDirectory \"/var/cache/apache2/mod_auth_mellon/\"\n") } end describe 'with parameters' do diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 9fb5031987..852ca622c1 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -5,7 +5,7 @@ describe 'apache::vhost', type: :define do describe 'os-independent items' do on_supported_os.each do |os, os_facts| - let(:apache_name) { facts[:os]['family'] == 'RedHat' ? 'httpd' : 'apache2' } + let(:apache_name) { (facts[:os]['family'] == 'RedHat') ? 'httpd' : 'apache2' } let :pre_condition do "class {'apache': default_vhost => false, default_mods => false, vhost_enable_dir => '/etc/#{apache_name}/sites-enabled'}" @@ -2033,7 +2033,7 @@ let(:params) { super().merge(port: 84) } context 'dest and regexp' do - let(:params) { super().merge(redirectmatch_dest: 'http://other.example.com$1.jpg', redirectmatch_regexp: "(.*)\.gif$") } + let(:params) { super().merge(redirectmatch_dest: 'http://other.example.com$1.jpg', redirectmatch_regexp: '(.*).gif$') } it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') } it { is_expected.to contain_class('apache::mod::alias') } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 50071092d7..c6e5525752 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -26,7 +26,7 @@ begin default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) - rescue => e + rescue StandardError => e RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" end end diff --git a/util/apache_mod_platform_support.rb b/util/apache_mod_platform_support.rb index b857126d20..0add6f0e0b 100644 --- a/util/apache_mod_platform_support.rb +++ b/util/apache_mod_platform_support.rb @@ -60,12 +60,12 @@ def initialize(manifest, line_num, error_type, error_detail) def print_parsing_errors return if @manifest_errors.empty? - $stderr.puts "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n" + warn "The following errors were encountered when trying to parse the 'Unsupported platforms' tag(s) in 'manifests/mod':\n" @manifest_errors.each do |manifest_error| - $stderr.puts " * #{manifest_error.manifest} (line #{manifest_error.line_num}): #{ERROR_MSG[manifest_error.error_type]} #{manifest_error.error_detail}" + warn " * #{manifest_error.manifest} (line #{manifest_error.line_num}): #{ERROR_MSG[manifest_error.error_type]} #{manifest_error.error_detail}" end File.readlines('util/_resources/tag_format_help_msg.txt').each do |line| - $stderr.puts line + warn line end end From 80810695e1f78e8c5a0b5289645d61e627a3ed91 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 10:35:21 +0100 Subject: [PATCH 14/17] (CONT-772) Correct Style/RedundantRegexpEscape --- .rubocop_todo.yml | 15 ------- spec/classes/apache_spec.rb | 14 +++---- spec/classes/mod/alias_spec.rb | 10 ++--- spec/classes/mod/auth_mellon_spec.rb | 8 ++-- spec/classes/mod/disk_cache_spec.rb | 18 ++++----- spec/classes/mod/passenger_spec.rb | 12 +++--- spec/classes/mod/security_spec.rb | 12 +++--- spec/classes/mod/ssl_spec.rb | 2 +- spec/classes/mod/userdir_spec.rb | 10 ++--- spec/classes/mod/wsgi_spec.rb | 4 +- spec/defines/vhost_spec.rb | 58 ++++++++++++++-------------- 11 files changed, 74 insertions(+), 89 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index a5be54e7ee..985a71166c 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -202,21 +202,6 @@ Style/RedundantArgument: Exclude: - 'spec/classes/mod/status_spec.rb' -# Offense count: 247 -# This cop supports safe autocorrection (--autocorrect). -Style/RedundantRegexpEscape: - Exclude: - - 'spec/classes/apache_spec.rb' - - 'spec/classes/mod/alias_spec.rb' - - 'spec/classes/mod/auth_mellon_spec.rb' - - 'spec/classes/mod/disk_cache_spec.rb' - - 'spec/classes/mod/passenger_spec.rb' - - 'spec/classes/mod/security_spec.rb' - - 'spec/classes/mod/ssl_spec.rb' - - 'spec/classes/mod/userdir_spec.rb' - - 'spec/classes/mod/wsgi_spec.rb' - - 'spec/defines/vhost_spec.rb' - # Offense count: 1 # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: Mode. diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index 0b88dc1d52..7fbe1c14fe 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -187,8 +187,8 @@ } } end - it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common\n} } - it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%\{Referer\}i\" \"%\{User-agent\}i\"" vhost_combined\n} } + it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^LogFormat "%v %h %l %u %t "%r" %>s %b" vhost_common\n} } + it { is_expected.to contain_file('/etc/apache2/apache2.conf').with_content %r{^LogFormat "%v %h %l %u %t "%r" %>s %b "%\{Referer\}i" "%\{User-agent\}i"" vhost_combined\n} } end describe 'Override existing LogFormats When parameter log_formats is a hash' do @@ -200,13 +200,13 @@ end expected = [ - %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b" common\n}, - %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b" common\n}, - %r{^LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%\{Referer\}i\" \"%\{User-agent\}i\"" combined\n}, + %r{^LogFormat "%v %h %l %u %t "%r" %>s %b" common\n}, + %r{^LogFormat "%v %h %l %u %t "%r" %>s %b" common\n}, + %r{^LogFormat "%v %h %l %u %t "%r" %>s %b "%\{Referer\}i" "%\{User-agent\}i"" combined\n}, ] unexpected = [ - %r{^LogFormat "%h %l %u %t \"%r\" %>s %b \"%\{Referer\}i\" \"%\{User-agent\}i\"" combined\n}, - %r{^LogFormat "%h %l %u %t \"%r\" %>s %b \"%\{Referer\}i\" \"%\{User-agent\}i\"" combined\n}, + %r{^LogFormat "%h %l %u %t "%r" %>s %b "%\{Referer\}i" "%\{User-agent\}i"" combined\n}, + %r{^LogFormat "%h %l %u %t "%r" %>s %b "%\{Referer\}i" "%\{User-agent\}i"" combined\n}, ] it 'Expected to contain' do expected.each do |reg| diff --git a/spec/classes/mod/alias_spec.rb b/spec/classes/mod/alias_spec.rb index fc17b07fc7..cdaeba7ba2 100644 --- a/spec/classes/mod/alias_spec.rb +++ b/spec/classes/mod/alias_spec.rb @@ -10,21 +10,21 @@ include_examples 'Debian 11' it { is_expected.to contain_apache__mod('alias') } - it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/share\/apache2\/icons\/"}) } + it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /icons/ "/usr/share/apache2/icons/"}) } end context 'on a RedHat 7-based OS', :compile do include_examples 'RedHat 7' it { is_expected.to contain_apache__mod('alias') } - it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/share\/httpd\/icons\/"}) } + it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /icons/ "/usr/share/httpd/icons/"}) } end context 'on a RedHat 8-based OS', :compile do include_examples 'RedHat 8' it { is_expected.to contain_apache__mod('alias') } - it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/share\/httpd\/icons\/"}) } + it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /icons/ "/usr/share/httpd/icons/"}) } end context 'with icons options', :compile do @@ -56,7 +56,7 @@ include_examples 'RedHat 7' it { is_expected.to contain_apache__mod('alias') } - it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/apache-icons\/ "\/usr\/share\/httpd\/icons\/"}) } + it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /apache-icons/ "/usr/share/httpd/icons/"}) } end context 'with icons path as false', :compile do @@ -79,7 +79,7 @@ include_examples 'FreeBSD 10' it { is_expected.to contain_apache__mod('alias') } - it { is_expected.to contain_file('alias.conf').with(content: %r{Alias \/icons\/ "\/usr\/local\/www\/apache24\/icons\/"}) } + it { is_expected.to contain_file('alias.conf').with(content: %r{Alias /icons/ "/usr/local/www/apache24/icons/"}) } end end end diff --git a/spec/classes/mod/auth_mellon_spec.rb b/spec/classes/mod/auth_mellon_spec.rb index 99e01afe7f..22f496fe95 100644 --- a/spec/classes/mod/auth_mellon_spec.rb +++ b/spec/classes/mod/auth_mellon_spec.rb @@ -29,8 +29,8 @@ it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonCacheSize\s+200$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonCacheEntrySize\s+2010$}) } - it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonLockFile\s+"\/tmp\/junk"$}) } - it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostDirectory\s+"\/tmp\/post"$}) } + it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonLockFile\s+"/tmp/junk"$}) } + it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostDirectory\s+"/tmp/post"$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostTTL\s+5$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostSize\s+8$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostCount\s+10$}) } @@ -61,8 +61,8 @@ it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonCacheSize\s+200$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonCacheEntrySize\s+2010$}) } - it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonLockFile\s+"\/tmp\/junk"$}) } - it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostDirectory\s+"\/tmp\/post"$}) } + it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonLockFile\s+"/tmp/junk"$}) } + it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostDirectory\s+"/tmp/post"$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostTTL\s+5$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostSize\s+8$}) } it { is_expected.to contain_file('auth_mellon.conf').with_content(%r{^MellonPostCount\s+10$}) } diff --git a/spec/classes/mod/disk_cache_spec.rb b/spec/classes/mod/disk_cache_spec.rb index 6666654724..40fcd67fba 100644 --- a/spec/classes/mod/disk_cache_spec.rb +++ b/spec/classes/mod/disk_cache_spec.rb @@ -26,7 +26,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) + .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/apache2/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } context 'with $default_cache_enable = false' do @@ -39,7 +39,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) + .with(content: %r{CacheRoot "/var/cache/apache2/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -53,7 +53,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/apache2\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) + .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/apache2/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -84,7 +84,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) + .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/httpd/proxy"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } context 'with $default_cache_enable = false' do @@ -97,7 +97,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) + .with(content: %r{CacheRoot "/var/cache/httpd/proxy"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -111,7 +111,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/httpd\/proxy\"\nCacheDirLevels 2\nCacheDirLength 1\n}) + .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/httpd/proxy"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -145,7 +145,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) + .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } context 'with $default_cache_enable = false' do @@ -158,7 +158,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) + .with(content: %r{CacheRoot "/var/cache/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -172,7 +172,7 @@ it { is_expected.to contain_file('disk_cache.conf') - .with(content: %r{CacheEnable disk \/\nCacheRoot \"\/var\/cache\/mod_cache_disk\"\nCacheDirLevels 2\nCacheDirLength 1\n}) + .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index 5e994b1f6b..f12cbe3258 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -399,7 +399,7 @@ { mod_path: '/usr/lib/foo/mod_foo.so' } end - it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module \/usr\/lib\/foo\/mod_foo\.so$}) } + it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module /usr/lib/foo/mod_foo\.so$}) } end describe "with mod_lib_path => '/usr/lib/foo'" do @@ -407,7 +407,7 @@ { mod_lib_path: '/usr/lib/foo' } end - it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module \/usr\/lib\/foo\/mod_passenger\.so$}) } + it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module /usr/lib/foo/mod_passenger\.so$}) } end describe "with mod_lib => 'mod_foo.so'" do @@ -415,7 +415,7 @@ { mod_lib: 'mod_foo.so' } end - it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module \/usr\/lib\/apache2\/modules\/mod_foo\.so$}) } + it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule passenger_module /usr/lib/apache2/modules/mod_foo\.so$}) } end describe "with mod_id => 'mod_foo'" do @@ -423,7 +423,7 @@ { mod_id: 'mod_foo' } end - it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule mod_foo \/usr\/lib\/apache2\/modules\/mod_passenger\.so$}) } + it { is_expected.to contain_file('zpassenger.load').with_content(%r{^LoadModule mod_foo /usr/lib/apache2/modules/mod_passenger\.so$}) } end context 'with defaults' do @@ -459,7 +459,7 @@ { passenger_root: '/usr/lib/example' } end - it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerRoot "\/usr\/lib\/example"$}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerRoot "/usr/lib/example"$}) } end describe 'with passenger_ruby => /usr/lib/example/ruby' do @@ -467,7 +467,7 @@ { passenger_ruby: '/usr/lib/example/ruby' } end - it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerRuby "\/usr\/lib\/example\/ruby"$}) } + it { is_expected.to contain_file('passenger.conf').with_content(%r{^ PassengerRuby "/usr/lib/example/ruby"$}) } end end when '7' diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index f38ac5037c..5ad45531ad 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -189,13 +189,13 @@ else it { is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ - %r{^SecAction \\\n\s+\"id:900000,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.paranoia_level=1"$} + %r{^SecAction \\\n\s+"id:900000,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.paranoia_level=1"$} is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ - %r{^SecAction \\\n\s+\"id:900001,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.executing_paranoia_level=2"$} + %r{^SecAction \\\n\s+"id:900001,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.executing_paranoia_level=2"$} is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ %r{ ^SecAction\ \\\n - \s+\"id:900700,\\\n + \s+"id:900700,\\\n \s+phase:1,\\\n \s+nolog,\\\n \s+pass,\\\n @@ -385,13 +385,13 @@ it { is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content \ - %r{^SecAction \\\n\s+\"id:900000,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.paranoia_level=1"$} + %r{^SecAction \\\n\s+"id:900000,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.paranoia_level=1"$} is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content \ - %r{^SecAction \\\n\s+\"id:900001,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.executing_paranoia_level=1"$} + %r{^SecAction \\\n\s+"id:900001,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.executing_paranoia_level=1"$} is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content \ %r{ ^SecAction\ \\\n - \s+\"id:900700,\\\n + \s+"id:900700,\\\n \s+phase:1,\\\n \s+nolog,\\\n \s+pass,\\\n diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index f631458edb..056179cc92 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -208,7 +208,7 @@ } end - it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLPassPhraseDialog exec:\/path\/to\/program$}) } + it { is_expected.to contain_file('ssl.conf').with_content(%r{^ SSLPassPhraseDialog exec:/path/to/program$}) } end context 'setting ssl_random_seed_bytes' do diff --git a/spec/classes/mod/userdir_spec.rb b/spec/classes/mod/userdir_spec.rb index 2a721d4b11..cad5269ad7 100644 --- a/spec/classes/mod/userdir_spec.rb +++ b/spec/classes/mod/userdir_spec.rb @@ -25,7 +25,7 @@ end it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/hi$}) } - it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } + it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*$}) } end context 'with home set to something' do @@ -36,7 +36,7 @@ end it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/u/\*/public_html$}) } - it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } + it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*$}) } end context 'with path set to something' do @@ -47,7 +47,7 @@ end it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/\*/public_html$}) } - it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } + it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*$}) } end context 'with userdir set to something' do @@ -59,7 +59,7 @@ end it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+public_html$}) } - it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*\$}) } + it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*$}) } end context 'with unmanaged_path set to true' do @@ -70,7 +70,7 @@ end it { is_expected.to contain_file('userdir.conf').with_content(%r{^\s*UserDir\s+/home/\*/public_html$}) } - it { is_expected.not_to contain_file('userdir.conf').with_content(%r{^\s*\$}) - .with_content(%r{^\s+Include\s'\/custom\/path\/includes'$}) - .with_content(%r{^\s+Include\s'\/custom\/path\/another_includes'$}) + .with_content(%r{^\s+Include\s'/custom/path/includes'$}) + .with_content(%r{^\s+Include\s'/custom/path/another_includes'$}) .with_content(%r{^\s+H2CopyFiles\sOn$}) .with_content(%r{^\s+H2PushResource\s/foo.css$}) .with_content(%r{^\s+H2PushResource\s/foo.js$}) @@ -625,15 +625,15 @@ .with_content(%r{^\s+Require all denied$}) .with_content(%r{^\s+Require all granted$}) .with_content(%r{^\s+$}) - .with_content(%r{^\s+<\/RequireAll>$}) + .with_content(%r{^\s+$}) .with_content(%r{^\s+Require all-valid1$}) .with_content(%r{^\s+Require all-valid2$}) .with_content(%r{^\s+$}) - .with_content(%r{^\s+<\/RequireNone>$}) + .with_content(%r{^\s+$}) .with_content(%r{^\s+Require none-valid1$}) .with_content(%r{^\s+Require none-valid2$}) .with_content(%r{^\s+$}) - .with_content(%r{^\s+<\/RequireAny>$}) + .with_content(%r{^\s+$}) .with_content(%r{^\s+Require any-valid1$}) .with_content(%r{^\s+Require any-valid2$}) .with_content(%r{^\s+LDAPReferrals off$}) @@ -641,14 +641,14 @@ .with_content(%r{^\s+ProxyPassMatch http://backend-b/ retry=0 timeout=5 noquery interpolate$}) .with_content(%r{^\s+Options\sIndexes\sFollowSymLinks\sMultiViews$}) .with_content(%r{^\s+IndexOptions\sFancyIndexing$}) - .with_content(%r{^\s+IndexStyleSheet\s'\/styles\/style\.css'$}) + .with_content(%r{^\s+IndexStyleSheet\s'/styles/style\.css'$}) .with_content(%r{^\s+DirectoryIndex\sdisabled$}) .with_content(%r{^\s+SetOutputFilter\soutput_filter$}) .with_content(%r{^\s+SetInputFilter\sinput_filter$}) .with_content(%r{^\s+$}) - .with_content(%r{\s+\s*Require valid-user\s*<\/Limit>}m) + .with_content(%r{\s+\s*Require valid-user\s*}m) .with_content(%r{^\s+$}) - .with_content(%r{\s+\s*Require valid-user\s*<\/LimitExcept>}m) + .with_content(%r{\s+\s*Require valid-user\s*}m) .with_content(%r{^\s+Dav\sfilesystem$}) .with_content(%r{^\s+DavDepthInfinity\sOn$}) .with_content(%r{^\s+DavMinTimeout\s600$}) @@ -745,8 +745,8 @@ .with_content(%r{noquery interpolate}) .with_content(%r{ProxyPreserveHost On}) .with_content(%r{ProxyAddHeaders On}) - .with_content(%r{ProxyPassReverseCookiePath\s+\/a\s+http:\/\/}) - .with_content(%r{ProxyPassReverseCookieDomain\s+foo\s+http:\/\/foo}) + .with_content(%r{ProxyPassReverseCookiePath\s+/a\s+http://}) + .with_content(%r{ProxyPassReverseCookieDomain\s+foo\s+http://foo}) } it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') } @@ -811,8 +811,8 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-jk_mounts') - .with_content(%r{^\s+JkMount\s+\/\*\s+tcnode1$}) - .with_content(%r{^\s+JkUnMount\s+\/\*\.jpg\s+tcnode1$}) + .with_content(%r{^\s+JkMount\s+/\*\s+tcnode1$}) + .with_content(%r{^\s+JkUnMount\s+/\*\.jpg\s+tcnode1$}) } it { @@ -820,7 +820,7 @@ .with_content(%r{^\s+KrbMethodNegotiate\soff$}) .with_content(%r{^\s+KrbAuthoritative\soff$}) .with_content(%r{^\s+KrbAuthRealms\sEXAMPLE.ORG\sEXAMPLE.NET$}) - .with_content(%r{^\s+Krb5Keytab\s\/tmp\/keytab5$}) + .with_content(%r{^\s+Krb5Keytab\s/tmp/keytab5$}) .with_content(%r{^\s+KrbLocalUserMapping\soff$}) .with_content(%r{^\s+KrbServiceName\sHTTP$}) .with_content(%r{^\s+KrbSaveCredentials\soff$}) @@ -914,9 +914,9 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-auth_oidc') - .with_content(%r{^\s+OIDCProviderMetadataURL\shttps:\/\/login.example.com\/\.well-known\/openid-configuration$}) + .with_content(%r{^\s+OIDCProviderMetadataURL\shttps://login.example.com/\.well-known/openid-configuration$}) .with_content(%r{^\s+OIDCClientID\stest$}) - .with_content(%r{^\s+OIDCRedirectURI\shttps:\/\/login\.example.com\/redirect_uri$}) + .with_content(%r{^\s+OIDCRedirectURI\shttps://login\.example.com/redirect_uri$}) .with_content(%r{^\s+OIDCProviderTokenEndpointAuth\sclient_secret_basic$}) .with_content(%r{^\s+OIDCRemoteUserClaim\ssub$}) .with_content(%r{^\s+OIDCClientSecret\saae053a9-4abf-4824-8956-e94b2af335c8$}) @@ -1061,7 +1061,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{^\s+ServerName https:\/\/www\.example\.com:443$}, + content: %r{^\s+ServerName https://www\.example\.com:443$}, ) } @@ -1088,7 +1088,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{^\s+ServerName https:\/\/www\.example\.com$}, + content: %r{^\s+ServerName https://www\.example\.com$}, ) } @@ -1168,7 +1168,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{[.\/m]*[.\/m]*$}, + content: %r{[./m]*[./m]*$}, ) } @@ -1195,7 +1195,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{[.\/m]*[.\/m]*$}, + content: %r{[./m]*[./m]*$}, ) } @@ -1222,7 +1222,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{[.\/m]*[.\/m]*$}, + content: %r{[./m]*[./m]*$}, ) } @@ -1253,7 +1253,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{[.\/m]*[.\/m]*$}, + content: %r{[./m]*[./m]*$}, ) } @@ -1278,7 +1278,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( - content: %r{[.\/m]*[.\/m]*$}, + content: %r{[./m]*[./m]*$}, ) } @@ -1345,7 +1345,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-security').with( - content: %r{^\s*SecAuditLog "\/var\/log\/#{apache_name}\/rspec\.example\.com_security\.log"$}, + content: %r{^\s*SecAuditLog "/var/log/#{apache_name}/rspec\.example\.com_security\.log"$}, ) } end @@ -1362,7 +1362,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-security').with( - content: %r{\s*SecAuditLog "\/var\/log\/#{apache_name}\/foo.log"$}, + content: %r{\s*SecAuditLog "/var/log/#{apache_name}/foo.log"$}, ) } end @@ -1382,7 +1382,7 @@ is_expected.to contain_concat__fragment('rspec.example.com-security').with( content: %r{ ^\s+SecAction\ \\\n - \s+\"id:900110,\\\n + \s+"id:900110,\\\n \s+phase:1,\\\n \s+nolog,\\\n \s+pass,\\\n @@ -1408,7 +1408,7 @@ is_expected.to contain_concat__fragment('rspec.example.com-security').with( content: %r{ ^\s+SecAction\ \\\n - \s+\"id:900200,\\\n + \s+"id:900200,\\\n \s+phase:1,\\\n \s+nolog,\\\n\s+pass,\\\n \s+t:none,\\\n @@ -1450,7 +1450,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content( - %r{ProxyPassMatch .* http:\/\/backend-a\/ timeout=300}, + %r{ProxyPassMatch .* http://backend-a/ timeout=300}, ).with_content(%r{## Proxy rules}) } end @@ -1798,13 +1798,13 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( - content: %r{^\s+CustomLog "\/tmp\/log1"\s+combined\s+env=dev$}, + content: %r{^\s+CustomLog "/tmp/log1"\s+combined\s+env=dev$}, ) } it { is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( - content: %r{^\s+CustomLog "\/var\/log\/#{apache_name}\/log2"\s+combined\s*$}, + content: %r{^\s+CustomLog "/var/log/#{apache_name}/log2"\s+combined\s*$}, ) } From 55fa371d64d74db755d44ed5678d67e8cd058f58 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 11:23:59 +0100 Subject: [PATCH 15/17] (CONT-772) Correct RSpec/ImplicitSubject --- .rubocop_todo.yml | 17 ++- spec/classes/apache_spec.rb | 80 ++++++------- spec/classes/mod/auth_cas_spec.rb | 4 +- spec/classes/mod/auth_openidc_spec.rb | 2 +- spec/classes/mod/authnz_ldap_spec.rb | 4 +- spec/classes/mod/deflate_spec.rb | 18 +-- spec/classes/mod/dir_spec.rb | 2 +- spec/classes/mod/disk_cache_spec.rb | 18 +-- spec/classes/mod/event_spec.rb | 8 +- spec/classes/mod/expires_spec.rb | 4 +- spec/classes/mod/fcgid_spec.rb | 8 +- spec/classes/mod/info_spec.rb | 26 ++--- spec/classes/mod/itk_spec.rb | 8 +- spec/classes/mod/lbmethod_bybusyness.rb | 8 +- spec/classes/mod/lbmethod_byrequests.rb | 8 +- spec/classes/mod/lbmethod_bytraffic.rb | 8 +- spec/classes/mod/lbmethod_heartbeat.rb | 8 +- spec/classes/mod/mime_magic_spec.rb | 14 +-- spec/classes/mod/mime_spec.rb | 8 +- spec/classes/mod/negotiation_spec.rb | 12 +- spec/classes/mod/passenger_spec.rb | 20 ++-- spec/classes/mod/php_spec.rb | 28 ++--- spec/classes/mod/prefork_spec.rb | 8 +- spec/classes/mod/proxy_balancer_spec.rb | 2 +- spec/classes/mod/remoteip_spec.rb | 2 +- spec/classes/mod/rpaf_spec.rb | 6 +- spec/classes/mod/security_spec.rb | 66 +++++------ spec/classes/mod/ssl_spec.rb | 2 +- spec/classes/mod/status_spec.rb | 22 ++-- spec/classes/mod/worker_spec.rb | 8 +- spec/classes/mod/wsgi_spec.rb | 14 +-- spec/classes/service_spec.rb | 18 +-- spec/defines/balancer_spec.rb | 6 +- spec/defines/balancermember_spec.rb | 2 +- spec/defines/custom_config_spec.rb | 14 +-- spec/defines/mod_spec.rb | 52 ++++----- spec/defines/modsec_link_spec.rb | 4 +- spec/defines/vhost_custom_spec.rb | 8 +- spec/defines/vhost_fragment_spec.rb | 30 ++--- spec/defines/vhost_proxy_spec.rb | 6 +- spec/defines/vhost_spec.rb | 142 ++++++++++++------------ 41 files changed, 362 insertions(+), 363 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 985a71166c..02032729a4 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config` -# on 2023-04-20 08:33:47 UTC using RuboCop version 1.48.1. +# on 2023-04-20 10:23:43 UTC using RuboCop version 1.48.1. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -90,15 +90,8 @@ RSpec/FilePath: - 'spec/classes/mod/lookup_identity.rb' - 'spec/classes/mod/proxy_wstunnel.rb' -# Offense count: 292 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: single_line_only, single_statement_only, disallow, require_implicit -RSpec/ImplicitSubject: - Enabled: false - # Offense count: 16 -# This cop supports safe autocorrection. +# This cop supports safe autocorrection (--autocorrect). RSpec/LetBeforeExamples: Exclude: - 'spec/classes/mod/auth_kerb_spec.rb' @@ -120,6 +113,12 @@ RSpec/MultipleExpectations: RSpec/MultipleMemoizedHelpers: Max: 6 +# Offense count: 291 +# Configuration parameters: EnforcedStyle, IgnoreSharedExamples. +# SupportedStyles: always, named_only +RSpec/NamedSubject: + Enabled: false + # Offense count: 123 # Configuration parameters: AllowedGroups. RSpec/NestedGroups: diff --git a/spec/classes/apache_spec.rb b/spec/classes/apache_spec.rb index 7fbe1c14fe..c1b8262459 100644 --- a/spec/classes/apache_spec.rb +++ b/spec/classes/apache_spec.rb @@ -9,7 +9,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_package('httpd').with( + expect(subject).to contain_package('httpd').with( 'notify' => 'Class[Apache::Service]', 'ensure' => 'installed', ) @@ -20,27 +20,27 @@ it { is_expected.to contain_class('apache::service') } it { - is_expected.to contain_file('/var/www/html').with( + expect(subject).to contain_file('/var/www/html').with( 'ensure' => 'directory', ) } it { - is_expected.to contain_file('/etc/apache2/sites-enabled').with( + expect(subject).to contain_file('/etc/apache2/sites-enabled').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_file('/etc/apache2/mods-enabled').with( + expect(subject).to contain_file('/etc/apache2/mods-enabled').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_file('/etc/apache2/mods-available').with( + expect(subject).to contain_file('/etc/apache2/mods-available').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'false' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') @@ -49,7 +49,7 @@ it { is_expected.to contain_file('/etc/apache2/apache2.conf').without_content(%r{ServerAdmin}) } it { - is_expected.to contain_concat('/etc/apache2/ports.conf').with( + expect(subject).to contain_concat('/etc/apache2/ports.conf').with( 'owner' => 'root', 'group' => 'root', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') @@ -58,14 +58,14 @@ # Assert that load files are placed and symlinked for these mods, but no conf file. ['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { - is_expected.to contain_file("#{modname}.load").with( + expect(subject).to contain_file("#{modname}.load").with( 'path' => "/etc/apache2/mods-available/#{modname}.load", 'ensure' => 'file', ) } it { - is_expected.to contain_file("#{modname}.load symlink").with( + expect(subject).to contain_file("#{modname}.load symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.load", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.load", @@ -131,14 +131,14 @@ # Assert that both load files and conf files are placed and symlinked for these mods ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname| it { - is_expected.to contain_file("#{modname}.load").with( + expect(subject).to contain_file("#{modname}.load").with( 'path' => "/etc/apache2/mods-available/#{modname}.load", 'ensure' => 'file', ) } it { - is_expected.to contain_file("#{modname}.load symlink").with( + expect(subject).to contain_file("#{modname}.load symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.load", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.load", @@ -146,14 +146,14 @@ } it { - is_expected.to contain_file("#{modname}.conf").with( + expect(subject).to contain_file("#{modname}.conf").with( 'path' => "/etc/apache2/mods-available/#{modname}.conf", 'ensure' => 'file', ) } it { - is_expected.to contain_file("#{modname}.conf symlink").with( + expect(subject).to contain_file("#{modname}.conf symlink").with( 'path' => "/etc/apache2/mods-enabled/#{modname}.conf", 'ensure' => 'link', 'target' => "/etc/apache2/mods-available/#{modname}.conf", @@ -210,13 +210,13 @@ ] it 'Expected to contain' do expected.each do |reg| - is_expected.to contain_file('/etc/apache2/apache2.conf').with_content reg + expect(subject).to contain_file('/etc/apache2/apache2.conf').with_content reg end end it 'Not expected to contain' do unexpected.each do |reg| - is_expected.to contain_file('/etc/apache2/apache2.conf').without_content reg + expect(subject).to contain_file('/etc/apache2/apache2.conf').without_content reg end end end @@ -234,7 +234,7 @@ include_examples 'Ubuntu 18.04' it { - is_expected.to contain_file('/var/www/html').with( + expect(subject).to contain_file('/var/www/html').with( 'ensure' => 'directory', ) } @@ -247,7 +247,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_package('httpd').with( + expect(subject).to contain_package('httpd').with( 'notify' => 'Class[Apache::Service]', 'ensure' => 'installed', ) @@ -258,20 +258,20 @@ it { is_expected.to contain_class('apache::service') } it { - is_expected.to contain_file('/var/www/html').with( + expect(subject).to contain_file('/var/www/html').with( 'ensure' => 'directory', ) } it { - is_expected.to contain_file('/etc/httpd/conf.d').with( + expect(subject).to contain_file('/etc/httpd/conf.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_concat('/etc/httpd/conf/ports.conf').with( + expect(subject).to contain_concat('/etc/httpd/conf/ports.conf').with( 'owner' => 'root', 'group' => 'root', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') @@ -288,7 +288,7 @@ ['mod.d', 'site.d', 'conf.d'].each do |dir| it { - is_expected.to contain_file("/etc/httpd/#{dir}").with( + expect(subject).to contain_file("/etc/httpd/#{dir}").with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') @@ -298,13 +298,13 @@ # Assert that load files are placed for these mods, but no conf file. ['auth_basic', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { - is_expected.to contain_file("#{modname}.load").with_path( + expect(subject).to contain_file("#{modname}.load").with_path( "/etc/httpd/mod.d/#{modname}.load", ) } it { - is_expected.not_to contain_file("#{modname}.conf").with_path( + expect(subject).not_to contain_file("#{modname}.conf").with_path( "/etc/httpd/mod.d/#{modname}.conf", ) } @@ -313,13 +313,13 @@ # Assert that both load files and conf files are placed for these mods ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname| it { - is_expected.to contain_file("#{modname}.load").with_path( + expect(subject).to contain_file("#{modname}.load").with_path( "/etc/httpd/mod.d/#{modname}.load", ) } it { - is_expected.to contain_file("#{modname}.conf").with_path( + expect(subject).to contain_file("#{modname}.conf").with_path( "/etc/httpd/mod.d/#{modname}.conf", ) } @@ -375,7 +375,7 @@ end it { - is_expected.to contain_file('/opt/rh/root/etc/httpd/conf/httpd.conf').with( + expect(subject).to contain_file('/opt/rh/root/etc/httpd/conf/httpd.conf').with( 'ensure' => 'file', ).that_notifies('Class[Apache::Service]').that_requires(['Package[httpd]', 'Concat[/etc/httpd/conf/ports.conf]']) } @@ -387,7 +387,7 @@ end it { - is_expected.to contain_file('/etc/httpd/special_conf.d').with( + expect(subject).to contain_file('/etc/httpd/special_conf.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') @@ -402,7 +402,7 @@ unexpected = ['apache::mod::event', 'apache::mod::itk', 'apache::mod::peruser', 'apache::mod::prefork', 'apache::mod::worker'] it 'does not declare mpm modules' do unexpected.each do |not_expect| - is_expected.not_to contain_class(not_expect) + expect(subject).not_to contain_class(not_expect) end end end @@ -560,27 +560,27 @@ it { is_expected.to contain_class('apache::service') } it { - is_expected.to contain_file('/usr/local/www/apache24/data').with( + expect(subject).to contain_file('/usr/local/www/apache24/data').with( 'ensure' => 'directory', ) } it { - is_expected.to contain_file('/usr/local/etc/apache24/Vhosts').with( + expect(subject).to contain_file('/usr/local/etc/apache24/Vhosts').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_file('/usr/local/etc/apache24/Modules').with( + expect(subject).to contain_file('/usr/local/etc/apache24/Modules').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_concat('/usr/local/etc/apache24/ports.conf').with( + expect(subject).to contain_concat('/usr/local/etc/apache24/ports.conf').with( 'owner' => 'root', 'group' => 'wheel', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') @@ -589,7 +589,7 @@ # Assert that load files are placed for these mods, but no conf file. ['auth_basic', 'authn_core', 'authn_file', 'authz_groupfile', 'authz_host', 'authz_user', 'dav', 'env'].each do |modname| it { - is_expected.to contain_file("#{modname}.load").with( + expect(subject).to contain_file("#{modname}.load").with( 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load", 'ensure' => 'file', ) @@ -601,14 +601,14 @@ # Assert that both load files and conf files are placed for these mods ['alias', 'autoindex', 'dav_fs', 'deflate', 'dir', 'mime', 'negotiation', 'setenvif'].each do |modname| it { - is_expected.to contain_file("#{modname}.load").with( + expect(subject).to contain_file("#{modname}.load").with( 'path' => "/usr/local/etc/apache24/Modules/#{modname}.load", 'ensure' => 'file', ) } it { - is_expected.to contain_file("#{modname}.conf").with( + expect(subject).to contain_file("#{modname}.conf").with( 'path' => "/usr/local/etc/apache24/Modules/#{modname}.conf", 'ensure' => 'file', ) @@ -625,27 +625,27 @@ it { is_expected.to contain_class('apache::service') } it { - is_expected.to contain_file('/var/www/localhost/htdocs').with( + expect(subject).to contain_file('/var/www/localhost/htdocs').with( 'ensure' => 'directory', ) } it { - is_expected.to contain_file('/etc/apache2/vhosts.d').with( + expect(subject).to contain_file('/etc/apache2/vhosts.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_file('/etc/apache2/modules.d').with( + expect(subject).to contain_file('/etc/apache2/modules.d').with( 'ensure' => 'directory', 'recurse' => 'true', 'purge' => 'true' ).that_notifies('Class[Apache::Service]').that_requires('Package[httpd]') } it { - is_expected.to contain_concat('/etc/apache2/ports.conf').with( + expect(subject).to contain_concat('/etc/apache2/ports.conf').with( 'owner' => 'root', 'group' => 'wheel', 'mode' => '0644' ).that_notifies('Class[Apache::Service]') @@ -663,7 +663,7 @@ end it { - is_expected.to contain_package('httpd').with( + expect(subject).to contain_package('httpd').with( 'ensure' => 'installed', 'name' => 'httpd24-httpd', ).that_notifies('Class[Apache::Service]') @@ -678,7 +678,7 @@ end it { - is_expected.to contain_concat('/etc/httpd/conf/ports.conf').with( + expect(subject).to contain_concat('/etc/httpd/conf/ports.conf').with( 'mode' => '0640', ) } diff --git a/spec/classes/mod/auth_cas_spec.rb b/spec/classes/mod/auth_cas_spec.rb index 8df086e963..9b053f3de2 100644 --- a/spec/classes/mod/auth_cas_spec.rb +++ b/spec/classes/mod/auth_cas_spec.rb @@ -66,8 +66,8 @@ it { is_expected.to contain_file('/var/cache/mod_auth_cas/').with_owner('apache') } it { - is_expected.to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASRootProxiedAs http://test.server$}) - is_expected.to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASCookiePath /my/cas/path$}) + expect(subject).to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASRootProxiedAs http://test.server$}) + expect(subject).to contain_concat__fragment('test.server-auth_cas').with(content: %r{^\s+CASCookiePath /my/cas/path$}) } end end diff --git a/spec/classes/mod/auth_openidc_spec.rb b/spec/classes/mod/auth_openidc_spec.rb index aac9be28ea..ed0ad42cfd 100644 --- a/spec/classes/mod/auth_openidc_spec.rb +++ b/spec/classes/mod/auth_openidc_spec.rb @@ -35,7 +35,7 @@ it { is_expected.to contain_package('mod_auth_openidc') } it do - is_expected.to contain_package('dnf-module-mod_auth_openidc') + expect(subject).to contain_package('dnf-module-mod_auth_openidc') .with_ensure('present') .with_name('mod_auth_openidc') .that_comes_before('Package[mod_auth_openidc]') diff --git a/spec/classes/mod/authnz_ldap_spec.rb b/spec/classes/mod/authnz_ldap_spec.rb index e9b4feeca1..f76ac9c4b4 100644 --- a/spec/classes/mod/authnz_ldap_spec.rb +++ b/spec/classes/mod/authnz_ldap_spec.rb @@ -26,7 +26,7 @@ let(:params) { { verify_server_cert: 'wrong' } } it 'raises an error' do - is_expected.to compile.and_raise_error(%r{parameter 'verify_server_cert' expects a Boolean value, got String}) + expect(subject).to compile.and_raise_error(%r{parameter 'verify_server_cert' expects a Boolean value, got String}) end end end # Debian @@ -64,7 +64,7 @@ let(:params) { { verify_server_cert: 'wrong' } } it 'raises an error' do - is_expected.to compile.and_raise_error(%r{parameter 'verify_server_cert' expects a Boolean value, got String}) + expect(subject).to compile.and_raise_error(%r{parameter 'verify_server_cert' expects a Boolean value, got String}) end end diff --git a/spec/classes/mod/deflate_spec.rb b/spec/classes/mod/deflate_spec.rb index 2ee5a6d172..045a3cd04b 100644 --- a/spec/classes/mod/deflate_spec.rb +++ b/spec/classes/mod/deflate_spec.rb @@ -16,7 +16,7 @@ def general_deflate_specs "DeflateFilterNote Ratio ratio\n" it do - is_expected.to contain_file('deflate.conf').with_content(expected) + expect(subject).to contain_file('deflate.conf').with_content(expected) end end @@ -43,13 +43,13 @@ def general_deflate_specs general_deflate_specs it { - is_expected.to contain_file('deflate.conf').with(ensure: 'file', - path: '/etc/apache2/mods-available/deflate.conf') + expect(subject).to contain_file('deflate.conf').with(ensure: 'file', + path: '/etc/apache2/mods-available/deflate.conf') } it { - is_expected.to contain_file('deflate.conf symlink').with(ensure: 'link', - path: '/etc/apache2/mods-enabled/deflate.conf') + expect(subject).to contain_file('deflate.conf symlink').with(ensure: 'link', + path: '/etc/apache2/mods-enabled/deflate.conf') } end @@ -69,8 +69,8 @@ def general_deflate_specs general_deflate_specs it { - is_expected.to contain_file('deflate.conf').with(ensure: 'file', - path: '/usr/local/etc/apache24/Modules/deflate.conf') + expect(subject).to contain_file('deflate.conf').with(ensure: 'file', + path: '/usr/local/etc/apache24/Modules/deflate.conf') } end @@ -81,8 +81,8 @@ def general_deflate_specs general_deflate_specs it { - is_expected.to contain_file('deflate.conf').with(ensure: 'file', - path: '/etc/apache2/modules.d/deflate.conf') + expect(subject).to contain_file('deflate.conf').with(ensure: 'file', + path: '/etc/apache2/modules.d/deflate.conf') } end end diff --git a/spec/classes/mod/dir_spec.rb b/spec/classes/mod/dir_spec.rb index 96f50fcdea..f76404eda5 100644 --- a/spec/classes/mod/dir_spec.rb +++ b/spec/classes/mod/dir_spec.rb @@ -12,7 +12,7 @@ it { is_expected.to contain_apache__mod('dir') } it do - is_expected.to contain_file('dir.conf') + expect(subject).to contain_file('dir.conf') .with_content(%r{^DirectoryIndex }) .with_content(%r{ index\.html }) .with_content(%r{ index\.html\.var }) diff --git a/spec/classes/mod/disk_cache_spec.rb b/spec/classes/mod/disk_cache_spec.rb index 40fcd67fba..ce840bdcf6 100644 --- a/spec/classes/mod/disk_cache_spec.rb +++ b/spec/classes/mod/disk_cache_spec.rb @@ -25,7 +25,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/apache2/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } @@ -38,7 +38,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheRoot "/var/cache/apache2/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -52,7 +52,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/apache2/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -83,7 +83,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/httpd/proxy"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } @@ -96,7 +96,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheRoot "/var/cache/httpd/proxy"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -110,7 +110,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/httpd/proxy"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -144,7 +144,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\nCacheIgnoreHeaders Set-Cookie}) } @@ -157,7 +157,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheRoot "/var/cache/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end @@ -171,7 +171,7 @@ it { is_expected.to contain_apache__mod('cache_disk') } it { - is_expected.to contain_file('disk_cache.conf') + expect(subject).to contain_file('disk_cache.conf') .with(content: %r{CacheEnable disk /\nCacheRoot "/var/cache/mod_cache_disk"\nCacheDirLevels 2\nCacheDirLength 1\n}) } end diff --git a/spec/classes/mod/event_spec.rb b/spec/classes/mod/event_spec.rb index 723c590cad..39d83ae992 100644 --- a/spec/classes/mod/event_spec.rb +++ b/spec/classes/mod/event_spec.rb @@ -110,8 +110,8 @@ end it { - is_expected.to contain_file('/etc/apache2/mods-available/event.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/event.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so\n") } it { is_expected.to contain_file('/etc/apache2/mods-enabled/event.load').with_ensure('link') } @@ -127,8 +127,8 @@ it { is_expected.to contain_file('/etc/httpd/conf.modules.d/event.conf').with_ensure('file') } it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/event.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_event_module modules/mod_mpm_event.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/event.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_event_module modules/mod_mpm_event.so\n") } end end diff --git a/spec/classes/mod/expires_spec.rb b/spec/classes/mod/expires_spec.rb index c9d3681d93..e9b201a79d 100644 --- a/spec/classes/mod/expires_spec.rb +++ b/spec/classes/mod/expires_spec.rb @@ -27,7 +27,7 @@ it { is_expected.to contain_apache__mod('expires') } it { - is_expected.to contain_file('expires.conf').with_content( + expect(subject).to contain_file('expires.conf').with_content( "ExpiresActive On\n" \ "ExpiresDefault \"access plus 1 month\"\n", ) @@ -52,7 +52,7 @@ it { is_expected.to contain_apache__mod('expires') } it { - is_expected.to contain_file('expires.conf').with_content( + expect(subject).to contain_file('expires.conf').with_content( "ExpiresActive On\n" \ "ExpiresByType text/json \"mod plus 1 day\"\n" \ "ExpiresByType text/html \"access plus 1 year\"\n", diff --git a/spec/classes/mod/fcgid_spec.rb b/spec/classes/mod/fcgid_spec.rb index 3adc0cb121..7121d4984d 100644 --- a/spec/classes/mod/fcgid_spec.rb +++ b/spec/classes/mod/fcgid_spec.rb @@ -11,7 +11,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => nil) + expect(subject).to contain_apache__mod('fcgid').with('loadfile_name' => nil) } it { is_expected.to contain_package('libapache2-mod-fcgid') } @@ -24,7 +24,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => 'unixd_fcgid.load') + expect(subject).to contain_apache__mod('fcgid').with('loadfile_name' => 'unixd_fcgid.load') } it { is_expected.to contain_package('mod_fcgid') } @@ -37,7 +37,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => 'unixd_fcgid.load') + expect(subject).to contain_apache__mod('fcgid').with('loadfile_name' => 'unixd_fcgid.load') } it { is_expected.to contain_package('www/mod_fcgid') } @@ -49,7 +49,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_apache__mod('fcgid').with('loadfile_name' => nil) + expect(subject).to contain_apache__mod('fcgid').with('loadfile_name' => nil) } it { is_expected.to contain_package('www-apache/mod_fcgid') } diff --git a/spec/classes/mod/info_spec.rb b/spec/classes/mod/info_spec.rb index 88d2b93c01..b683c51241 100644 --- a/spec/classes/mod/info_spec.rb +++ b/spec/classes/mod/info_spec.rb @@ -21,7 +21,7 @@ def general_info_specs_apache24 end it { - is_expected.to contain_file('info.conf').with_content( + expect(subject).to contain_file('info.conf').with_content( "\n " \ "SetHandler server-info\n" \ "\n", @@ -39,7 +39,7 @@ def general_info_specs_apache24 "Require ip 10.10.1.2 192.168.1.2 127.0.0.1\n" \ "\n" it { - is_expected.to contain_file('info.conf').with_content(expected) + expect(subject).to contain_file('info.conf').with_content(expected) } end @@ -52,7 +52,7 @@ def general_info_specs_apache24 end it { - is_expected.to contain_file('info.conf').with_content( + expect(subject).to contain_file('info.conf').with_content( "\n " \ "SetHandler server-info\n" \ "\n", @@ -71,13 +71,13 @@ def general_info_specs_apache24 general_info_specs_apache24 it { - is_expected.to contain_file('info.conf').with(ensure: 'file', - path: '/etc/apache2/mods-available/info.conf') + expect(subject).to contain_file('info.conf').with(ensure: 'file', + path: '/etc/apache2/mods-available/info.conf') } it { - is_expected.to contain_file('info.conf symlink').with(ensure: 'link', - path: '/etc/apache2/mods-enabled/info.conf') + expect(subject).to contain_file('info.conf symlink').with(ensure: 'link', + path: '/etc/apache2/mods-enabled/info.conf') } end @@ -88,8 +88,8 @@ def general_info_specs_apache24 general_info_specs_apache24 it { - is_expected.to contain_file('info.conf').with(ensure: 'file', - path: '/etc/httpd/conf.modules.d/info.conf') + expect(subject).to contain_file('info.conf').with(ensure: 'file', + path: '/etc/httpd/conf.modules.d/info.conf') } end @@ -100,8 +100,8 @@ def general_info_specs_apache24 general_info_specs_apache24 it { - is_expected.to contain_file('info.conf').with(ensure: 'file', - path: '/usr/local/etc/apache24/Modules/info.conf') + expect(subject).to contain_file('info.conf').with(ensure: 'file', + path: '/usr/local/etc/apache24/Modules/info.conf') } end @@ -112,8 +112,8 @@ def general_info_specs_apache24 general_info_specs_apache24 it { - is_expected.to contain_file('info.conf').with(ensure: 'file', - path: '/etc/apache2/modules.d/info.conf') + expect(subject).to contain_file('info.conf').with(ensure: 'file', + path: '/etc/apache2/modules.d/info.conf') } end end diff --git a/spec/classes/mod/itk_spec.rb b/spec/classes/mod/itk_spec.rb index 45f9b9780f..2ecf14f76f 100644 --- a/spec/classes/mod/itk_spec.rb +++ b/spec/classes/mod/itk_spec.rb @@ -21,8 +21,8 @@ end it { - is_expected.to contain_file('/etc/apache2/mods-available/itk.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_itk_module /usr/lib/apache2/modules/mod_mpm_itk.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/itk.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_itk_module /usr/lib/apache2/modules/mod_mpm_itk.so\n") } it { is_expected.to contain_file('/etc/apache2/mods-enabled/itk.load').with_ensure('link') } @@ -51,8 +51,8 @@ end it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/itk.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/itk.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_itk_module modules/mod_mpm_itk.so\n") } end diff --git a/spec/classes/mod/lbmethod_bybusyness.rb b/spec/classes/mod/lbmethod_bybusyness.rb index fa3607c7b7..8e26df19a7 100644 --- a/spec/classes/mod/lbmethod_bybusyness.rb +++ b/spec/classes/mod/lbmethod_bybusyness.rb @@ -15,8 +15,8 @@ it { # rubocop:disable Layout/LineLength - is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -32,8 +32,8 @@ end it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") # rubocop:enable Layout/LineLength } end diff --git a/spec/classes/mod/lbmethod_byrequests.rb b/spec/classes/mod/lbmethod_byrequests.rb index fa3607c7b7..8e26df19a7 100644 --- a/spec/classes/mod/lbmethod_byrequests.rb +++ b/spec/classes/mod/lbmethod_byrequests.rb @@ -15,8 +15,8 @@ it { # rubocop:disable Layout/LineLength - is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -32,8 +32,8 @@ end it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") # rubocop:enable Layout/LineLength } end diff --git a/spec/classes/mod/lbmethod_bytraffic.rb b/spec/classes/mod/lbmethod_bytraffic.rb index fa3607c7b7..8e26df19a7 100644 --- a/spec/classes/mod/lbmethod_bytraffic.rb +++ b/spec/classes/mod/lbmethod_bytraffic.rb @@ -15,8 +15,8 @@ it { # rubocop:disable Layout/LineLength - is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -32,8 +32,8 @@ end it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") # rubocop:enable Layout/LineLength } end diff --git a/spec/classes/mod/lbmethod_heartbeat.rb b/spec/classes/mod/lbmethod_heartbeat.rb index fa3607c7b7..8e26df19a7 100644 --- a/spec/classes/mod/lbmethod_heartbeat.rb +++ b/spec/classes/mod/lbmethod_heartbeat.rb @@ -15,8 +15,8 @@ it { # rubocop:disable Layout/LineLength - is_expected.to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/apache2/mods-enabled/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module /usr/lib/apache2/modules/mod_lbmethod_byrequests.so\n") } end end @@ -32,8 +32,8 @@ end it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', - 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/lbmethod_byrequests.load').with('ensure' => 'file', + 'content' => "LoadModule lbmethod_byrequests_module modules/mod_lbmethod_byrequests.so\n") # rubocop:enable Layout/LineLength } end diff --git a/spec/classes/mod/mime_magic_spec.rb b/spec/classes/mod/mime_magic_spec.rb index d1a5c038d2..12da4510f9 100644 --- a/spec/classes/mod/mime_magic_spec.rb +++ b/spec/classes/mod/mime_magic_spec.rb @@ -16,19 +16,19 @@ def general_mime_magic_specs general_mime_magic_specs it do - is_expected.to contain_file('mime_magic.conf').with_content( + expect(subject).to contain_file('mime_magic.conf').with_content( "MIMEMagicFile \"/etc/apache2/magic\"\n", ) end it { - is_expected.to contain_file('mime_magic.conf').with(ensure: 'file', - path: '/etc/apache2/mods-available/mime_magic.conf') + expect(subject).to contain_file('mime_magic.conf').with(ensure: 'file', + path: '/etc/apache2/mods-available/mime_magic.conf') } it { - is_expected.to contain_file('mime_magic.conf symlink').with(ensure: 'link', - path: '/etc/apache2/mods-enabled/mime_magic.conf') + expect(subject).to contain_file('mime_magic.conf symlink').with(ensure: 'link', + path: '/etc/apache2/mods-enabled/mime_magic.conf') } context 'with magic_file => /tmp/Debian_magic' do @@ -37,7 +37,7 @@ def general_mime_magic_specs end it do - is_expected.to contain_file('mime_magic.conf').with_content( + expect(subject).to contain_file('mime_magic.conf').with_content( "MIMEMagicFile \"/tmp/Debian_magic\"\n", ) end @@ -50,7 +50,7 @@ def general_mime_magic_specs general_mime_magic_specs it do - is_expected.to contain_file('mime_magic.conf').with_content( + expect(subject).to contain_file('mime_magic.conf').with_content( "MIMEMagicFile \"/etc/httpd/conf/magic\"\n", ) end diff --git a/spec/classes/mod/mime_spec.rb b/spec/classes/mod/mime_spec.rb index 0891059f02..483e9b5989 100644 --- a/spec/classes/mod/mime_spec.rb +++ b/spec/classes/mod/mime_spec.rb @@ -7,10 +7,10 @@ def general_mime_specs it { is_expected.to contain_apache__mod('mime') } it do - is_expected.to contain_file('mime.conf').with_content(%r{AddHandler type-map var}) - is_expected.to contain_file('mime.conf').with_content(%r{ddOutputFilter INCLUDES .shtml}) - is_expected.to contain_file('mime.conf').with_content(%r{AddType text/html .shtml}) - is_expected.to contain_file('mime.conf').with_content(%r{AddType application/x-compress .Z}) + expect(subject).to contain_file('mime.conf').with_content(%r{AddHandler type-map var}) + expect(subject).to contain_file('mime.conf').with_content(%r{ddOutputFilter INCLUDES .shtml}) + expect(subject).to contain_file('mime.conf').with_content(%r{AddType text/html .shtml}) + expect(subject).to contain_file('mime.conf').with_content(%r{AddType application/x-compress .Z}) end end diff --git a/spec/classes/mod/negotiation_spec.rb b/spec/classes/mod/negotiation_spec.rb index 1fccc517e9..dc0074fe2a 100644 --- a/spec/classes/mod/negotiation_spec.rb +++ b/spec/classes/mod/negotiation_spec.rb @@ -11,8 +11,8 @@ it { is_expected.to contain_class('apache') } it do - is_expected.to contain_file('negotiation.conf').with(ensure: 'file', - content: 'LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW + expect(subject).to contain_file('negotiation.conf').with(ensure: 'file', + content: 'LanguagePriority en ca cs da de el eo es et fr he hr it ja ko ltz nl nn no pl pt pt-BR ru sv zh-CN zh-TW ForceLanguagePriority Prefer Fallback ') end @@ -24,8 +24,8 @@ end it do - is_expected.to contain_file('negotiation.conf').with(ensure: 'file', - content: %r{^ForceLanguagePriority Prefer$}) + expect(subject).to contain_file('negotiation.conf').with(ensure: 'file', + content: %r{^ForceLanguagePriority Prefer$}) end end @@ -35,8 +35,8 @@ end it do - is_expected.to contain_file('negotiation.conf').with(ensure: 'file', - content: %r{^LanguagePriority en es$}) + expect(subject).to contain_file('negotiation.conf').with(ensure: 'file', + content: %r{^LanguagePriority en es$}) end end end diff --git a/spec/classes/mod/passenger_spec.rb b/spec/classes/mod/passenger_spec.rb index f12cbe3258..2805e8c53c 100644 --- a/spec/classes/mod/passenger_spec.rb +++ b/spec/classes/mod/passenger_spec.rb @@ -17,11 +17,11 @@ it { is_expected.to contain_package('libapache2-mod-passenger') } it { - is_expected.to contain_file('zpassenger.load').with('path' => '/etc/apache2/mods-available/zpassenger.load') + expect(subject).to contain_file('zpassenger.load').with('path' => '/etc/apache2/mods-available/zpassenger.load') } it { - is_expected.to contain_file('passenger.conf').with('path' => '/etc/apache2/mods-available/passenger.conf') + expect(subject).to contain_file('passenger.conf').with('path' => '/etc/apache2/mods-available/passenger.conf') } passenger_config_options = { @@ -208,11 +208,11 @@ it { is_expected.to contain_package('libapache2-mod-passenger') } it { - is_expected.to contain_file('zpassenger.load').with('path' => '/etc/apache2/mods-available/zpassenger.load') + expect(subject).to contain_file('zpassenger.load').with('path' => '/etc/apache2/mods-available/zpassenger.load') } it { - is_expected.to contain_file('passenger.conf').with('path' => '/etc/apache2/mods-available/passenger.conf') + expect(subject).to contain_file('passenger.conf').with('path' => '/etc/apache2/mods-available/passenger.conf') } context 'passenger config with passenger_installed_version set', test: true do @@ -441,14 +441,14 @@ it { is_expected.to contain_package('mod_passenger') } it { - is_expected.to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') + expect(subject).to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') } it { is_expected.to contain_file('passenger_package.conf').without_content } it { is_expected.to contain_file('passenger_package.conf').without_source } it { - is_expected.to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.d/zpassenger.load') + expect(subject).to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.d/zpassenger.load') } it { is_expected.to contain_file('passenger.conf').without_content(%r{PassengerRoot}) } @@ -474,22 +474,22 @@ context 'on EL7' do it { - is_expected.to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') + expect(subject).to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') } it { - is_expected.to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.modules.d/zpassenger.load') + expect(subject).to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.modules.d/zpassenger.load') } end when '8' context 'on EL8' do it { - is_expected.to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') + expect(subject).to contain_file('passenger_package.conf').with('path' => '/etc/httpd/conf.d/passenger.conf') } it { - is_expected.to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.modules.d/zpassenger.load') + expect(subject).to contain_file('zpassenger.load').with('path' => '/etc/httpd/conf.modules.d/zpassenger.load') } end end diff --git a/spec/classes/mod/php_spec.rb b/spec/classes/mod/php_spec.rb index 3e364adc21..67e7d86b76 100644 --- a/spec/classes/mod/php_spec.rb +++ b/spec/classes/mod/php_spec.rb @@ -27,7 +27,7 @@ it { is_expected.to contain_package('libapache2-mod-php7.0') } it { - is_expected.to contain_file('php7.0.load').with( + expect(subject).to contain_file('php7.0.load').with( content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.0.so\n", ) } @@ -38,7 +38,7 @@ it { is_expected.to contain_package('libapache2-mod-php7.3') } it { - is_expected.to contain_file('php7.3.load').with( + expect(subject).to contain_file('php7.3.load').with( content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.3.so\n", ) } @@ -52,7 +52,7 @@ it { is_expected.to contain_package('libapache2-mod-php8.0') } it { - is_expected.to contain_file('php8.0.load').with( + expect(subject).to contain_file('php8.0.load').with( content: "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n", ) } @@ -64,7 +64,7 @@ it { is_expected.to contain_package('libapache2-mod-php7.4') } it { - is_expected.to contain_file('php7.4.load').with( + expect(subject).to contain_file('php7.4.load').with( content: "LoadModule php7_module /usr/lib/apache2/modules/libphp7.4.so\n", ) } @@ -78,7 +78,7 @@ it { is_expected.to contain_package('libapache2-mod-php8.0') } it { - is_expected.to contain_file('php8.0.load').with( + expect(subject).to contain_file('php8.0.load').with( content: "LoadModule php_module /usr/lib/apache2/modules/libphp8.0.so\n", ) } @@ -91,7 +91,7 @@ end it { - is_expected.to contain_file('php7.2.conf').with( + expect(subject).to contain_file('php7.2.conf').with( content: 'somecontent', ) } @@ -189,7 +189,7 @@ end it { - is_expected.to contain_package('php').with( + expect(subject).to contain_package('php').with( ensure: '5.3.13', ) } @@ -292,7 +292,7 @@ end it { - is_expected.to contain_file('php5.conf').with( + expect(subject).to contain_file('php5.conf').with( content: 'somecontent', ) } @@ -304,7 +304,7 @@ end it { - is_expected.to contain_file('php5.conf').with( + expect(subject).to contain_file('php5.conf').with( content: %r{^# PHP is an HTML-embedded scripting language which attempts to make it}, ) } @@ -316,7 +316,7 @@ end it { - is_expected.to contain_file('php5.conf').with( + expect(subject).to contain_file('php5.conf').with( source: 'some-path', ) } @@ -331,7 +331,7 @@ end it { - is_expected.to contain_file('php5.conf').with( + expect(subject).to contain_file('php5.conf').with( content: 'somecontent', ) } @@ -346,7 +346,7 @@ end it { - is_expected.to contain_file('php5.conf').with( + expect(subject).to contain_file('php5.conf').with( source: 'some-path', ) } @@ -361,7 +361,7 @@ end it { - is_expected.to contain_file('php5.conf').with( + expect(subject).to contain_file('php5.conf').with( source: 'some-path', ) } @@ -373,7 +373,7 @@ end it 'raises an error' do - is_expected.to compile.and_raise_error(%r{mpm_module => 'prefork' or mpm_module => 'itk'}) + expect(subject).to compile.and_raise_error(%r{mpm_module => 'prefork' or mpm_module => 'itk'}) end end end diff --git a/spec/classes/mod/prefork_spec.rb b/spec/classes/mod/prefork_spec.rb index 20b416c43a..0ebe44794a 100644 --- a/spec/classes/mod/prefork_spec.rb +++ b/spec/classes/mod/prefork_spec.rb @@ -16,8 +16,8 @@ it { is_expected.to contain_file('/etc/apache2/mods-enabled/prefork.conf').with_ensure('link') } it { - is_expected.to contain_file('/etc/apache2/mods-available/prefork.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/prefork.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_prefork_module /usr/lib/apache2/modules/mod_mpm_prefork.so\n") } it { is_expected.to contain_file('/etc/apache2/mods-enabled/prefork.load').with_ensure('link') } @@ -31,8 +31,8 @@ it { is_expected.not_to contain_apache__mod('event') } it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/prefork.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/prefork.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_prefork_module modules/mod_mpm_prefork.so\n") } end diff --git a/spec/classes/mod/proxy_balancer_spec.rb b/spec/classes/mod/proxy_balancer_spec.rb index 1b03e82590..d43cecd7fd 100644 --- a/spec/classes/mod/proxy_balancer_spec.rb +++ b/spec/classes/mod/proxy_balancer_spec.rb @@ -9,7 +9,7 @@ def balancer_manager_conf_spec(allow_from, manager_path) "Require ip #{Array(allow_from).join(' ')}\n" \ "\n" it do - is_expected.to contain_file('proxy_balancer.conf').with_content(expected) + expect(subject).to contain_file('proxy_balancer.conf').with_content(expected) end end diff --git a/spec/classes/mod/remoteip_spec.rb b/spec/classes/mod/remoteip_spec.rb index b89546243d..2ab7ee72aa 100644 --- a/spec/classes/mod/remoteip_spec.rb +++ b/spec/classes/mod/remoteip_spec.rb @@ -10,7 +10,7 @@ it { is_expected.to contain_apache__mod('remoteip') } it { - is_expected.to contain_file('remoteip.conf').with('path' => '/etc/apache2/mods-available/remoteip.conf') + expect(subject).to contain_file('remoteip.conf').with('path' => '/etc/apache2/mods-available/remoteip.conf') } describe 'with header X-Forwarded-For' do diff --git a/spec/classes/mod/rpaf_spec.rb b/spec/classes/mod/rpaf_spec.rb index 4de5fb5710..27b1dfdf93 100644 --- a/spec/classes/mod/rpaf_spec.rb +++ b/spec/classes/mod/rpaf_spec.rb @@ -12,7 +12,7 @@ it { is_expected.to contain_package('libapache2-mod-rpaf') } it { - is_expected.to contain_file('rpaf.conf').with('path' => '/etc/apache2/mods-available/rpaf.conf') + expect(subject).to contain_file('rpaf.conf').with('path' => '/etc/apache2/mods-available/rpaf.conf') } it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFenable On$}) } @@ -50,7 +50,7 @@ it { is_expected.to contain_package('www/mod_rpaf2') } it { - is_expected.to contain_file('rpaf.conf').with('path' => '/usr/local/etc/apache24/Modules/rpaf.conf') + expect(subject).to contain_file('rpaf.conf').with('path' => '/usr/local/etc/apache24/Modules/rpaf.conf') } it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFenable On$}) } @@ -88,7 +88,7 @@ it { is_expected.to contain_package('www-apache/mod_rpaf') } it { - is_expected.to contain_file('rpaf.conf').with('path' => '/etc/apache2/modules.d/rpaf.conf') + expect(subject).to contain_file('rpaf.conf').with('path' => '/etc/apache2/modules.d/rpaf.conf') } it { is_expected.to contain_file('rpaf.conf').with_content(%r{^RPAFenable On$}) } diff --git a/spec/classes/mod/security_spec.rb b/spec/classes/mod/security_spec.rb index 5ad45531ad..cd01d3a067 100644 --- a/spec/classes/mod/security_spec.rb +++ b/spec/classes/mod/security_spec.rb @@ -13,21 +13,21 @@ when 'Suse' context 'on Suse based systems' do it { - is_expected.to contain_file('security.conf') + expect(subject).to contain_file('security.conf') .with_content(%r{^\s+SecTmpDir /var/lib/mod_security$}) } end when 'RedHat' context 'on RedHat based systems' do it { - is_expected.to contain_apache__mod('security').with( + expect(subject).to contain_apache__mod('security').with( id: 'security2_module', lib: 'mod_security2.so', ) } it { - is_expected.to contain_apache__mod('unique_id').with( + expect(subject).to contain_apache__mod('unique_id').with( id: 'unique_id_module', lib: 'mod_unique_id.so', ) @@ -37,14 +37,14 @@ 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( + expect(subject).to contain_file('security.conf').with( path: '/etc/httpd/conf.modules.d/security.conf', ) } end it { - is_expected.to contain_file('security.conf') + expect(subject).to contain_file('security.conf') .with_content(%r{^\s+SecAuditLogRelevantStatus "\^\(\?:5\|4\(\?!04\)\)"$}) .with_content(%r{^\s+SecAuditLogParts ABIJDEFHZ$}) .with_content(%r{^\s+SecAuditLogType Serial$}) @@ -54,21 +54,21 @@ } it { - is_expected.to contain_file('/etc/httpd/modsecurity.d').with( + expect(subject).to contain_file('/etc/httpd/modsecurity.d').with( ensure: 'directory', path: '/etc/httpd/modsecurity.d', owner: 'root', group: 'root', mode: '0755' ) } it { - is_expected.to contain_file('/etc/httpd/modsecurity.d/activated_rules').with( + expect(subject).to contain_file('/etc/httpd/modsecurity.d/activated_rules').with( ensure: 'directory', path: '/etc/httpd/modsecurity.d/activated_rules', owner: 'apache', group: 'apache' ) } it { - is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with( + expect(subject).to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with( path: '/etc/httpd/modsecurity.d/security_crs.conf', ) } @@ -76,7 +76,7 @@ it { is_expected.to contain_apache__security__rule_link('base_rules/modsecurity_35_bad_robots.data') } it { - is_expected.to contain_file('modsecurity_35_bad_robots.data').with( + expect(subject).to contain_file('modsecurity_35_bad_robots.data').with( path: '/etc/httpd/modsecurity.d/activated_rules/modsecurity_35_bad_robots.data', target: '/usr/lib/modsecurity.d/base_rules/modsecurity_35_bad_robots.data', ) @@ -111,7 +111,7 @@ it { is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content %r{^\s*SecDefaultAction "phase:2,deny,status:406,nolog,auditlog"$} } it { - is_expected.to contain_file('bar.conf').with( + expect(subject).to contain_file('bar.conf').with( path: '/etc/httpd/modsecurity.d/activated_rules/bar.conf', target: '/tmp/foo/bar.conf', ) @@ -136,7 +136,7 @@ end it { - is_expected.not_to contain_file('/etc/httpd/modsecurity.d/custom_rules/custom_01_rules.conf') + expect(subject).not_to contain_file('/etc/httpd/modsecurity.d/custom_rules/custom_01_rules.conf') } end @@ -149,7 +149,7 @@ end it { - is_expected.to contain_file('/etc/httpd/modsecurity.d/custom_rules').with( + expect(subject).to contain_file('/etc/httpd/modsecurity.d/custom_rules').with( ensure: 'directory', path: '/etc/httpd/modsecurity.d/custom_rules', owner: 'apache', group: 'apache' ) @@ -172,7 +172,7 @@ if facts[:os]['release']['major'].to_i < 8 && facts[:os]['family'] == 'RedHat' it { - is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ %r{ ^SecAction\ \\\n \ \ "id:'900001',\ \\\n @@ -188,11 +188,11 @@ } else it { - is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ %r{^SecAction \\\n\s+"id:900000,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.paranoia_level=1"$} - is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ %r{^SecAction \\\n\s+"id:900001,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.executing_paranoia_level=2"$} - is_expected.to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/httpd/modsecurity.d/security_crs.conf').with_content \ %r{ ^SecAction\ \\\n \s+"id:900700,\\\n @@ -217,21 +217,21 @@ end it { - is_expected.to compile.and_raise_error(%r{Executing paranoia level cannot be lower than paranoia level}) + expect(subject).to compile.and_raise_error(%r{Executing paranoia level cannot be lower than paranoia level}) } end end when 'Debian' context 'on Debian based systems' do it { - is_expected.to contain_apache__mod('security').with( + expect(subject).to contain_apache__mod('security').with( id: 'security2_module', lib: 'mod_security2.so', ) } it { - is_expected.to contain_apache__mod('unique_id').with( + expect(subject).to contain_apache__mod('unique_id').with( id: 'unique_id_module', lib: 'mod_unique_id.so', ) @@ -240,13 +240,13 @@ it { is_expected.to contain_package('modsecurity-crs') } it { - is_expected.to contain_file('security.conf').with( + expect(subject).to contain_file('security.conf').with( path: '/etc/apache2/mods-available/security.conf', ) } it { - is_expected.to contain_file('security.conf') + expect(subject).to contain_file('security.conf') .with_content(%r{^\s+SecAuditLogRelevantStatus "\^\(\?:5\|4\(\?!04\)\)"$}) .with_content(%r{^\s+SecAuditLogParts ABIJDEFHZ$}) .with_content(%r{^\s+SecAuditLogType Serial$}) @@ -256,21 +256,21 @@ } it { - is_expected.to contain_file('/etc/modsecurity').with( + expect(subject).to contain_file('/etc/modsecurity').with( ensure: 'directory', path: '/etc/modsecurity', owner: 'root', group: 'root', mode: '0755' ) } it { - is_expected.to contain_file('/etc/modsecurity/activated_rules').with( + expect(subject).to contain_file('/etc/modsecurity/activated_rules').with( ensure: 'directory', path: '/etc/modsecurity/activated_rules', owner: 'www-data', group: 'www-data' ) } it { - is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with( + expect(subject).to contain_file('/etc/modsecurity/security_crs.conf').with( path: '/etc/modsecurity/security_crs.conf', ) } @@ -280,7 +280,7 @@ it { is_expected.to contain_apache__security__rule_link('base_rules/modsecurity_35_bad_robots.data') } it { - is_expected.to contain_file('modsecurity_35_bad_robots.data').with( + expect(subject).to contain_file('modsecurity_35_bad_robots.data').with( path: '/etc/modsecurity/activated_rules/modsecurity_35_bad_robots.data', target: '/usr/share/modsecurity-crs/base_rules/modsecurity_35_bad_robots.data', ) @@ -317,7 +317,7 @@ it { is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content %r{^\s*SecDefaultAction "phase:2,deny,status:406,nolog,auditlog"$} } it { - is_expected.to contain_file('bar.conf').with( + expect(subject).to contain_file('bar.conf').with( path: '/etc/modsecurity/activated_rules/bar.conf', target: '/tmp/foo/bar.conf', ) @@ -333,7 +333,7 @@ end it { - is_expected.not_to contain_file('/etc/modsecurity/custom_rules/custom_01_rules.conf') + expect(subject).not_to contain_file('/etc/modsecurity/custom_rules/custom_01_rules.conf') } end @@ -346,7 +346,7 @@ end it { - is_expected.to contain_file('/etc/modsecurity/custom_rules').with( + expect(subject).to contain_file('/etc/modsecurity/custom_rules').with( ensure: 'directory', path: '/etc/modsecurity/custom_rules', owner: 'www-data', group: 'www-data' ) @@ -365,7 +365,7 @@ it { is_expected.to contain_apache__mod('security2') } it { - is_expected.to contain_file('security.conf').with( + expect(subject).to contain_file('security.conf').with( path: '/etc/apache2/mods-available/security2.conf', ) } @@ -384,11 +384,11 @@ end it { - is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/modsecurity/security_crs.conf').with_content \ %r{^SecAction \\\n\s+"id:900000,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.paranoia_level=1"$} - is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/modsecurity/security_crs.conf').with_content \ %r{^SecAction \\\n\s+"id:900001,\\\n\s+phase:1,\\\n\s+nolog,\\\n\s+pass,\\\n\s+t:none,\\\n\s+setvar:tx.executing_paranoia_level=1"$} - is_expected.to contain_file('/etc/modsecurity/security_crs.conf').with_content \ + expect(subject).to contain_file('/etc/modsecurity/security_crs.conf').with_content \ %r{ ^SecAction\ \\\n \s+"id:900700,\\\n @@ -412,7 +412,7 @@ end it { - is_expected.to compile.and_raise_error(%r{Executing paranoia level cannot be lower than paranoia level}) + expect(subject).to compile.and_raise_error(%r{Executing paranoia level cannot be lower than paranoia level}) } end end diff --git a/spec/classes/mod/ssl_spec.rb b/spec/classes/mod/ssl_spec.rb index 056179cc92..d54be82016 100644 --- a/spec/classes/mod/ssl_spec.rb +++ b/spec/classes/mod/ssl_spec.rb @@ -19,7 +19,7 @@ it { is_expected.to contain_package('mod_ssl') } it { - is_expected.to contain_file('ssl.conf') + expect(subject).to contain_file('ssl.conf') .with_path('/etc/httpd/conf.modules.d/ssl.conf') .without_content(%r{SSLProtocol}) .with_content(%r{^ SSLCipherSuite PROFILE=SYSTEM$}) diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index 19d4ab7e9a..ce8fd5149b 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -38,7 +38,7 @@ def require_directives(requires) "ProxyStatus On\n" \ "\n" it('status conf require') do - is_expected.to contain_file('status.conf').with_content(expected) + expect(subject).to contain_file('status.conf').with_content(expected) end end @@ -55,13 +55,13 @@ def require_directives(requires) include_examples 'status_conf_spec_require', 'ip 127.0.0.1 ::1', 'On', '/server-status' it { - is_expected.to contain_file('status.conf').with(ensure: 'file', - path: '/etc/apache2/mods-available/status.conf') + expect(subject).to contain_file('status.conf').with(ensure: 'file', + path: '/etc/apache2/mods-available/status.conf') } it { - is_expected.to contain_file('status.conf symlink').with(ensure: 'link', - path: '/etc/apache2/mods-enabled/status.conf') + expect(subject).to contain_file('status.conf symlink').with(ensure: 'link', + path: '/etc/apache2/mods-enabled/status.conf') } end @@ -86,7 +86,7 @@ def require_directives(requires) end it 'expects to succeed regular expression validation' do - is_expected.to compile + expect(subject).to compile end end end @@ -98,7 +98,7 @@ def require_directives(requires) end it 'expects to fail regular expression validation' do - is_expected.to compile.and_raise_error(%r{extended_status}) + expect(subject).to compile.and_raise_error(%r{extended_status}) end end end @@ -156,13 +156,13 @@ def require_directives(requires) include_examples 'status_conf_spec_require', req_value, 'On', '/server-status' it { - is_expected.to contain_file('status.conf').with(ensure: 'file', - path: '/etc/apache2/mods-available/status.conf') + expect(subject).to contain_file('status.conf').with(ensure: 'file', + path: '/etc/apache2/mods-available/status.conf') } it { - is_expected.to contain_file('status.conf symlink').with(ensure: 'link', - path: '/etc/apache2/mods-enabled/status.conf') + expect(subject).to contain_file('status.conf symlink').with(ensure: 'link', + path: '/etc/apache2/mods-enabled/status.conf') } end diff --git a/spec/classes/mod/worker_spec.rb b/spec/classes/mod/worker_spec.rb index 8675d9b9fb..3377c9fd2f 100644 --- a/spec/classes/mod/worker_spec.rb +++ b/spec/classes/mod/worker_spec.rb @@ -15,8 +15,8 @@ it { is_expected.to contain_file('/etc/apache2/mods-available/worker.conf').with_ensure('file') } it { - is_expected.to contain_file('/etc/apache2/mods-available/worker.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n") + expect(subject).to contain_file('/etc/apache2/mods-available/worker.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_worker_module /usr/lib/apache2/modules/mod_mpm_worker.so\n") } end @@ -28,8 +28,8 @@ it { is_expected.not_to contain_apache__mod('event') } it { - is_expected.to contain_file('/etc/httpd/conf.modules.d/worker.load').with('ensure' => 'file', - 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n") + expect(subject).to contain_file('/etc/httpd/conf.modules.d/worker.load').with('ensure' => 'file', + 'content' => "LoadModule mpm_worker_module modules/mod_mpm_worker.so\n") } end diff --git a/spec/classes/mod/wsgi_spec.rb b/spec/classes/mod/wsgi_spec.rb index e0d785dfed..d3f9ff24f1 100644 --- a/spec/classes/mod/wsgi_spec.rb +++ b/spec/classes/mod/wsgi_spec.rb @@ -10,7 +10,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_class('apache::mod::wsgi').with( + expect(subject).to contain_class('apache::mod::wsgi').with( 'wsgi_socket_prefix' => nil, ) } @@ -76,8 +76,8 @@ end it { - is_expected.to contain_apache__mod('wsgi').with('package' => 'mod_wsgi_package', - 'path' => '/foo/bar/baz') + expect(subject).to contain_apache__mod('wsgi').with('package' => 'mod_wsgi_package', + 'path' => '/foo/bar/baz') } it { is_expected.to contain_package('mod_wsgi_package') } @@ -93,8 +93,8 @@ end it { - is_expected.to contain_apache__mod('wsgi').with('path' => 'modules/wsgi_mod_name.so', - 'package' => 'mod_wsgi_package') + expect(subject).to contain_apache__mod('wsgi').with('path' => 'modules/wsgi_mod_name.so', + 'package' => 'mod_wsgi_package') } it { is_expected.to contain_file('wsgi.load').with_content(%r{LoadModule wsgi_module modules/wsgi_mod_name.so}) } @@ -127,7 +127,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_class('apache::mod::wsgi').with( + expect(subject).to contain_class('apache::mod::wsgi').with( 'wsgi_socket_prefix' => nil, ) } @@ -141,7 +141,7 @@ it { is_expected.to contain_class('apache::params') } it { - is_expected.to contain_class('apache::mod::wsgi').with( + expect(subject).to contain_class('apache::mod::wsgi').with( 'wsgi_socket_prefix' => nil, ) } diff --git a/spec/classes/service_spec.rb b/spec/classes/service_spec.rb index 2e621b137e..85a03fbb40 100644 --- a/spec/classes/service_spec.rb +++ b/spec/classes/service_spec.rb @@ -11,7 +11,7 @@ include_examples 'Debian 11' it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'true', @@ -22,7 +22,7 @@ let(:params) { { service_name: 'foo' } } it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'name' => 'foo', ) } @@ -32,7 +32,7 @@ let(:params) { { service_enable: true } } it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'true', @@ -44,7 +44,7 @@ let(:params) { { service_enable: false } } it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'false', @@ -56,7 +56,7 @@ let(:params) { { service_ensure: 'running' } } it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'ensure' => 'running', 'enable' => 'true', ) @@ -67,7 +67,7 @@ let(:params) { { service_ensure: 'stopped' } } it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'ensure' => 'stopped', 'enable' => 'true', ) @@ -88,7 +88,7 @@ let(:params) { { service_restart: '/usr/sbin/apachectl graceful' } } it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'restart' => '/usr/sbin/apachectl graceful', ) } @@ -112,7 +112,7 @@ include_examples 'FreeBSD 9' it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'name' => 'apache24', 'ensure' => 'running', 'enable' => 'true', @@ -124,7 +124,7 @@ include_examples 'Gentoo' it { - is_expected.to contain_service('httpd').with( + expect(subject).to contain_service('httpd').with( 'name' => 'apache2', 'ensure' => 'running', 'enable' => 'true', diff --git a/spec/defines/balancer_spec.rb b/spec/defines/balancer_spec.rb index aa2dca3225..5626cff603 100644 --- a/spec/defines/balancer_spec.rb +++ b/spec/defines/balancer_spec.rb @@ -27,7 +27,7 @@ end it { - is_expected.to contain_concat('apache_balancer_myapp').with(path: '/tmp/myapp.conf') + expect(subject).to contain_concat('apache_balancer_myapp').with(path: '/tmp/myapp.conf') } end @@ -39,7 +39,7 @@ end it { - is_expected.to contain_concat__fragment('00-myapp-header').with_content( + expect(subject).to contain_concat__fragment('00-myapp-header').with_content( %r{^$}, ) } @@ -54,7 +54,7 @@ end it { - is_expected.to contain_concat('apache_balancer_myapp').with(path: '/junk/path/balancer_myapp.conf') + expect(subject).to contain_concat('apache_balancer_myapp').with(path: '/junk/path/balancer_myapp.conf') } end diff --git a/spec/defines/balancermember_spec.rb b/spec/defines/balancermember_spec.rb index cec2c5c97d..acd06c1be6 100644 --- a/spec/defines/balancermember_spec.rb +++ b/spec/defines/balancermember_spec.rb @@ -50,7 +50,7 @@ end it { - is_expected.to contain_concat__fragment('BalancerMember http://127.0.0.1:8080/').with(target: 'apache_balancer_balancername') + expect(subject).to contain_concat__fragment('BalancerMember http://127.0.0.1:8080/').with(target: 'apache_balancer_balancername') } end end diff --git a/spec/defines/custom_config_spec.rb b/spec/defines/custom_config_spec.rb index db695c05f2..89ef1f1611 100644 --- a/spec/defines/custom_config_spec.rb +++ b/spec/defines/custom_config_spec.rb @@ -20,7 +20,7 @@ end it { - is_expected.to contain_exec('syntax verification for rspec') + expect(subject).to contain_exec('syntax verification for rspec') .with('refreshonly' => 'true', 'command' => ['/usr/sbin/apachectl', '-t']) .that_subscribes_to('File[apache_rspec]') .that_notifies('Class[Apache::Service]') @@ -28,13 +28,13 @@ } it { - is_expected.to contain_exec('remove rspec if invalid') + expect(subject).to contain_exec('remove rspec if invalid') .with('unless' => [['/usr/sbin/apachectl', '-t']], 'refreshonly' => 'true') .that_subscribes_to('File[apache_rspec]') } it { - is_expected.to contain_file('apache_rspec') + expect(subject).to contain_file('apache_rspec') .with('ensure' => 'present', 'content' => '# Test') .that_requires('Package[httpd]') } @@ -51,16 +51,16 @@ end it { - is_expected.to contain_exec('syntax verification for rspec').with('command' => ['/bin/true']) + expect(subject).to contain_exec('syntax verification for rspec').with('command' => ['/bin/true']) } it { - is_expected.to contain_exec('remove rspec if invalid').with('command' => ['/bin/rm', '/dne/30-rspec.conf'], - 'unless' => [['/bin/true']]) + expect(subject).to contain_exec('remove rspec if invalid').with('command' => ['/bin/rm', '/dne/30-rspec.conf'], + 'unless' => [['/bin/true']]) } it { - is_expected.to contain_file('apache_rspec') + expect(subject).to contain_file('apache_rspec') .that_requires('Package[httpd]') .with('path' => '/dne/30-rspec.conf', 'ensure' => 'present', diff --git a/spec/defines/mod_spec.rb b/spec/defines/mod_spec.rb index c1f4bd8a91..dc7ddde243 100644 --- a/spec/defines/mod_spec.rb +++ b/spec/defines/mod_spec.rb @@ -18,11 +18,11 @@ it { is_expected.to contain_class('apache::params') } it 'manages the module load file' do - is_expected.to contain_file('spec_m.load').with(path: '/etc/httpd/conf.modules.d/spec_m.load', - content: "LoadModule spec_m_module modules/mod_spec_m.so\n", - owner: 'root', - group: 'root', - mode: '0644') + expect(subject).to contain_file('spec_m.load').with(path: '/etc/httpd/conf.modules.d/spec_m.load', + content: "LoadModule spec_m_module modules/mod_spec_m.so\n", + owner: 'root', + group: 'root', + mode: '0644') end end @@ -32,7 +32,7 @@ end it 'manages the module load file' do - is_expected.to contain_file('spec_m.load').with(mode: '0640') + expect(subject).to contain_file('spec_m.load').with(mode: '0640') end end @@ -56,19 +56,19 @@ it { is_expected.to contain_class('apache::params') } it 'manages the module load file' do - is_expected.to contain_file('spec_m.load').with(path: '/etc/apache2/mods-available/spec_m.load', - content: "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", - owner: 'root', - group: 'root', - mode: '0644') + expect(subject).to contain_file('spec_m.load').with(path: '/etc/apache2/mods-available/spec_m.load', + content: "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", + owner: 'root', + group: 'root', + mode: '0644') end it 'links the module load file' do - is_expected.to contain_file('spec_m.load symlink').with(path: '/etc/apache2/mods-enabled/spec_m.load', - target: '/etc/apache2/mods-available/spec_m.load', - owner: 'root', - group: 'root', - mode: '0644') + expect(subject).to contain_file('spec_m.load symlink').with(path: '/etc/apache2/mods-enabled/spec_m.load', + target: '/etc/apache2/mods-available/spec_m.load', + owner: 'root', + group: 'root', + mode: '0644') end end end @@ -80,11 +80,11 @@ it { is_expected.to contain_class('apache::params') } it 'manages the module load file' do - is_expected.to contain_file('spec_m.load').with(path: '/usr/local/etc/apache24/Modules/spec_m.load', - content: "LoadModule spec_m_module /usr/local/libexec/apache24/mod_spec_m.so\n", - owner: 'root', - group: 'wheel', - mode: '0644') + expect(subject).to contain_file('spec_m.load').with(path: '/usr/local/etc/apache24/Modules/spec_m.load', + content: "LoadModule spec_m_module /usr/local/libexec/apache24/mod_spec_m.so\n", + owner: 'root', + group: 'wheel', + mode: '0644') end end end @@ -96,11 +96,11 @@ it { is_expected.to contain_class('apache::params') } it 'manages the module load file' do - is_expected.to contain_file('spec_m.load').with(path: '/etc/apache2/modules.d/spec_m.load', - content: "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", - owner: 'root', - group: 'wheel', - mode: '0644') + expect(subject).to contain_file('spec_m.load').with(path: '/etc/apache2/modules.d/spec_m.load', + content: "LoadModule spec_m_module /usr/lib/apache2/modules/mod_spec_m.so\n", + owner: 'root', + group: 'wheel', + mode: '0644') end end end diff --git a/spec/defines/modsec_link_spec.rb b/spec/defines/modsec_link_spec.rb index 914741da3e..ec9f161e7a 100644 --- a/spec/defines/modsec_link_spec.rb +++ b/spec/defines/modsec_link_spec.rb @@ -24,14 +24,14 @@ class { "apache::mod::security": activated_rules => [] } case facts[:os]['family'] when 'RedHat' it { - is_expected.to contain_file('modsecurity_35_bad_robots.data').with( + expect(subject).to contain_file('modsecurity_35_bad_robots.data').with( path: '/etc/httpd/modsecurity.d/activated_rules/modsecurity_35_bad_robots.data', target: '/usr/lib/modsecurity.d/base_rules/modsecurity_35_bad_robots.data', ) } when 'Debian' it { - is_expected.to contain_file('modsecurity_35_bad_robots.data').with( + expect(subject).to contain_file('modsecurity_35_bad_robots.data').with( path: '/etc/modsecurity/activated_rules/modsecurity_35_bad_robots.data', target: '/usr/share/modsecurity-crs/base_rules/modsecurity_35_bad_robots.data', ) diff --git a/spec/defines/vhost_custom_spec.rb b/spec/defines/vhost_custom_spec.rb index ffd6aca080..627afa29d1 100644 --- a/spec/defines/vhost_custom_spec.rb +++ b/spec/defines/vhost_custom_spec.rb @@ -23,7 +23,7 @@ include_examples 'Debian 11' it { - is_expected.to contain_file('apache_rspec.example.com').with( + expect(subject).to contain_file('apache_rspec.example.com').with( ensure: 'present', content: 'foobar', path: '/etc/apache2/sites-available/25-rspec.example.com.conf', @@ -31,7 +31,7 @@ } it { - is_expected.to contain_file('25-rspec.example.com.conf symlink').with( + expect(subject).to contain_file('25-rspec.example.com.conf symlink').with( ensure: 'link', path: '/etc/apache2/sites-enabled/25-rspec.example.com.conf', target: '/etc/apache2/sites-available/25-rspec.example.com.conf', @@ -43,7 +43,7 @@ include_examples 'FreeBSD 9' it { - is_expected.to contain_file('apache_rspec.example.com').with( + expect(subject).to contain_file('apache_rspec.example.com').with( ensure: 'present', content: 'foobar', path: '/usr/local/etc/apache24/Vhosts/25-rspec.example.com.conf', @@ -55,7 +55,7 @@ include_examples 'Gentoo' it { - is_expected.to contain_file('apache_rspec.example.com').with( + expect(subject).to contain_file('apache_rspec.example.com').with( ensure: 'present', content: 'foobar', path: '/etc/apache2/vhosts.d/25-rspec.example.com.conf', diff --git a/spec/defines/vhost_fragment_spec.rb b/spec/defines/vhost_fragment_spec.rb index 0352d5c8bb..36aecc8c15 100644 --- a/spec/defines/vhost_fragment_spec.rb +++ b/spec/defines/vhost_fragment_spec.rb @@ -23,9 +23,9 @@ let(:params) { super().merge(content: '# Foo') } it 'creates a vhost concat fragment' do - is_expected.to compile.with_all_deps - is_expected.to contain_concat('15-default-80.conf') - is_expected.to create_concat__fragment('default-myfragment') + expect(subject).to compile.with_all_deps + expect(subject).to contain_concat('15-default-80.conf') + expect(subject).to create_concat__fragment('default-myfragment') .with_target('15-default-80.conf') .with_order(900) .with_content('# Foo') @@ -36,9 +36,9 @@ let(:params) { super().merge(content: '') } it 'does not create a vhost concat fragment' do - is_expected.to compile.with_all_deps - is_expected.to contain_concat('15-default-80.conf') - is_expected.not_to contain_concat__fragment('default-myfragment') + expect(subject).to compile.with_all_deps + expect(subject).to contain_concat('15-default-80.conf') + expect(subject).not_to contain_concat__fragment('default-myfragment') end end end @@ -64,9 +64,9 @@ end it 'creates a vhost concat fragment' do - is_expected.to compile.with_all_deps - is_expected.to contain_concat('custom.conf') - is_expected.to create_concat__fragment('custom-myfragment') + expect(subject).to compile.with_all_deps + expect(subject).to contain_concat('custom.conf') + expect(subject).to create_concat__fragment('custom-myfragment') .with_target('custom.conf') .with_order(900) .with_content('# Foo') @@ -86,9 +86,9 @@ end it 'creates a vhost concat fragment' do - is_expected.to compile.with_all_deps - is_expected.to contain_concat('42-custom.conf') - is_expected.to create_concat__fragment('custom-myfragment') + expect(subject).to compile.with_all_deps + expect(subject).to contain_concat('42-custom.conf') + expect(subject).to create_concat__fragment('custom-myfragment') .with_target('42-custom.conf') .with_order(900) .with_content('# Foo') @@ -106,9 +106,9 @@ end it 'creates a vhost concat fragment' do - is_expected.to compile.with_all_deps - is_expected.to contain_concat('25-custom.conf') - is_expected.to create_concat__fragment('custom-myfragment') + expect(subject).to compile.with_all_deps + expect(subject).to contain_concat('25-custom.conf') + expect(subject).to create_concat__fragment('custom-myfragment') .with_target('25-custom.conf') .with_order(900) .with_content('# Foo') diff --git a/spec/defines/vhost_proxy_spec.rb b/spec/defines/vhost_proxy_spec.rb index 1619a10121..b7b5c75c31 100644 --- a/spec/defines/vhost_proxy_spec.rb +++ b/spec/defines/vhost_proxy_spec.rb @@ -36,9 +36,9 @@ end it 'creates a concat fragment' do - is_expected.to compile.with_all_deps - is_expected.to contain_concat('15-default-80.conf') - is_expected.to create_concat__fragment('default-myproxy-proxy') + expect(subject).to compile.with_all_deps + expect(subject).to contain_concat('15-default-80.conf') + expect(subject).to create_concat__fragment('default-myproxy-proxy') .with_target('15-default-80.conf') .with_order(170) .with_content( diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 9ba566bfa9..64872cac07 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -536,19 +536,19 @@ it { is_expected.to contain_class('apache::mod::ssl') } it { - is_expected.to contain_file('ssl.conf').with( + expect(subject).to contain_file('ssl.conf').with( content: %r{^\s+SSLHonorCipherOrder On$}, ) } it { - is_expected.to contain_file('ssl.conf').with( + expect(subject).to contain_file('ssl.conf').with( content: %r{^\s+SSLPassPhraseDialog builtin$}, ) } it { - is_expected.to contain_file('ssl.conf').with( + expect(subject).to contain_file('ssl.conf').with( content: %r{^\s+SSLSessionCacheTimeout 300$}, ) } @@ -559,8 +559,8 @@ it { is_expected.to contain_file('rspec.example.com_ssl_foo.crl') } it { - is_expected.to contain_file('/var/www/logs').with('ensure' => 'directory', - 'mode' => '0600') + expect(subject).to contain_file('/var/www/logs').with('ensure' => 'directory', + 'mode' => '0600') } it { is_expected.to contain_class('apache::mod::alias') } @@ -582,20 +582,20 @@ it { is_expected.to contain_class('apache::mod::wsgi') } it { - is_expected.to contain_concat('30-rspec.example.com.conf').with('owner' => 'root', - 'mode' => '0644', - 'require' => 'Package[httpd]', - 'notify' => 'Class[Apache::Service]') + expect(subject).to contain_concat('30-rspec.example.com.conf').with('owner' => 'root', + 'mode' => '0644', + 'require' => 'Package[httpd]', + 'notify' => 'Class[Apache::Service]') } if os_facts[:os]['release']['major'].to_i >= 18 && os_facts[:os]['name'] == 'Ubuntu' it { - is_expected.to contain_file('30-rspec.example.com.conf symlink').with('ensure' => 'link', - 'path' => "/etc/#{apache_name}/sites-enabled/30-rspec.example.com.conf") + expect(subject).to contain_file('30-rspec.example.com.conf symlink').with('ensure' => 'link', + 'path' => "/etc/#{apache_name}/sites-enabled/30-rspec.example.com.conf") } end it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header') + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header') .with_content(%r{^\s+LimitRequestFieldSize 8190$}) .with_content(%r{^\s+LimitRequestFields 100$}) .with_content(%r{^\s+LimitRequestLine 8190$}) @@ -605,7 +605,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-docroot') } it { - is_expected.to contain_concat__fragment('rspec.example.com-aliases').with( + expect(subject).to contain_concat__fragment('rspec.example.com-aliases').with( content: %r{^\s+Alias /image "/rspec/image"$}, ) } @@ -614,7 +614,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-fallbackresource') } it { - is_expected.to contain_concat__fragment('rspec.example.com-directories') + expect(subject).to contain_concat__fragment('rspec.example.com-directories') .with_content(%r{^\s+$}) .with_content(%r{^\s+Include\s'/custom/path/includes'$}) .with_content(%r{^\s+Include\s'/custom/path/another_includes'$}) @@ -726,7 +726,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-additional_includes') } it { - is_expected.to contain_concat__fragment('rspec.example.com-logging') + expect(subject).to contain_concat__fragment('rspec.example.com-logging') .with_content(%r{^\s+ErrorLogFormat "\[%t\] \[%l\] %7F: %E: \[client\\ %a\] %M% ,\\ referer\\ %\{Referer\}i"$}) } @@ -737,7 +737,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-error_document') } it { - is_expected.to contain_concat__fragment('rspec.example.com-proxy') + expect(subject).to contain_concat__fragment('rspec.example.com-proxy') .with_content(%r{retry=0}) .with_content(%r{timeout=5}) .with_content(%r{SetEnv force-proxy-request-1.0 1}) @@ -752,7 +752,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-redirect') } it { - is_expected.to contain_concat__fragment('rspec.example.com-rewrite') + expect(subject).to contain_concat__fragment('rspec.example.com-rewrite') .with_content(%r{^\s+RewriteEngine On$}) .with_content(%r{^\s+RewriteOptions Inherit$}) .with_content(%r{^\s+RewriteBase /}) @@ -763,21 +763,21 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-serveralias') } it { - is_expected.to contain_concat__fragment('rspec.example.com-setenv') + expect(subject).to contain_concat__fragment('rspec.example.com-setenv') .with_content(%r{SetEnv FOO=/bin/true}) .with_content(%r{SetEnvIf Request_URI "\\.gif\$" object_is_image=gif}) .with_content(%r{SetEnvIfNoCase REMOTE_ADDR \^127.0.0.1 localhost=true}) } it { - is_expected.to contain_concat__fragment('rspec.example.com-ssl') + expect(subject).to contain_concat__fragment('rspec.example.com-ssl') .with_content(%r{^\s+SSLOpenSSLConfCmd\s+DHParameters "foo.pem"$}) .with_content(%r{^\s+SSLHonorCipherOrder\s+Off$}) .with_content(%r{^\s+SSLUserName\s+SSL_CLIENT_S_DN_CN$}) } it { - is_expected.to contain_concat__fragment('rspec.example.com-sslproxy') + expect(subject).to contain_concat__fragment('rspec.example.com-sslproxy') .with_content(%r{^\s+SSLProxyEngine On$}) .with_content(%r{^\s+SSLProxyCheckPeerCN\s+on$}) .with_content(%r{^\s+SSLProxyCheckPeerName\s+on$}) @@ -790,7 +790,7 @@ it { is_expected.to contain_concat__fragment('rspec.example.com-header') } it { - is_expected.to contain_concat__fragment('rspec.example.com-filters').with( + expect(subject).to contain_concat__fragment('rspec.example.com-filters').with( content: %r{^\s+FilterDeclare COMPRESS$}, ) } @@ -805,18 +805,18 @@ it { is_expected.not_to contain_concat__fragment('rspec.example.com-security') } it { - is_expected.to contain_concat__fragment('rspec.example.com-file_footer') + expect(subject).to contain_concat__fragment('rspec.example.com-file_footer') .with_content(%r{^PassengerPreStart\shttp://localhost/myapp$}) } it { - is_expected.to contain_concat__fragment('rspec.example.com-jk_mounts') + expect(subject).to contain_concat__fragment('rspec.example.com-jk_mounts') .with_content(%r{^\s+JkMount\s+/\*\s+tcnode1$}) .with_content(%r{^\s+JkUnMount\s+/\*\.jpg\s+tcnode1$}) } it { - is_expected.to contain_concat__fragment('rspec.example.com-auth_kerb') + expect(subject).to contain_concat__fragment('rspec.example.com-auth_kerb') .with_content(%r{^\s+KrbMethodNegotiate\soff$}) .with_content(%r{^\s+KrbAuthoritative\soff$}) .with_content(%r{^\s+KrbAuthRealms\sEXAMPLE.ORG\sEXAMPLE.NET$}) @@ -828,26 +828,26 @@ } it { - is_expected.to contain_concat__fragment('rspec.example.com-http_protocol_options').with( + expect(subject).to contain_concat__fragment('rspec.example.com-http_protocol_options').with( content: %r{^\s*HttpProtocolOptions\s+Strict\s+LenientMethods\s+Allow0\.9$}, ) } it { - is_expected.to contain_concat__fragment('rspec.example.com-keepalive_options') + expect(subject).to contain_concat__fragment('rspec.example.com-keepalive_options') .with_content(%r{^\s+KeepAlive\son$}) .with_content(%r{^\s+KeepAliveTimeout\s100$}) .with_content(%r{^\s+MaxKeepAliveRequests\s1000$}) } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header') + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header') .with_content(%r{^\s+Protocols\sh2 http/1.1$}) .with_content(%r{^\s+ProtocolsHonorOrder\sOn$}) } it { - is_expected.to contain_concat__fragment('rspec.example.com-http2') + expect(subject).to contain_concat__fragment('rspec.example.com-http2') .with_content(%r{^\s+H2CopyFiles\sOff$}) .with_content(%r{^\s+H2Direct\sOn$}) .with_content(%r{^\s+H2EarlyHints\sOff$}) @@ -867,7 +867,7 @@ } it { - is_expected.to contain_concat__fragment('rspec.example.com-passenger') + expect(subject).to contain_concat__fragment('rspec.example.com-passenger') .with_content(%r{^\s+PassengerEnabled\sOff$}) .with_content(%r{^\s+PassengerBaseURI\s/app$}) .with_content(%r{^\s+PassengerRuby\s/usr/bin/ruby1\.9\.1$}) @@ -913,7 +913,7 @@ } it { - is_expected.to contain_concat__fragment('rspec.example.com-auth_oidc') + expect(subject).to contain_concat__fragment('rspec.example.com-auth_oidc') .with_content(%r{^\s+OIDCProviderMetadataURL\shttps://login.example.com/\.well-known/openid-configuration$}) .with_content(%r{^\s+OIDCClientID\stest$}) .with_content(%r{^\s+OIDCRedirectURI\shttps://login\.example.com/redirect_uri$}) @@ -926,7 +926,7 @@ it { is_expected.to contain_class('apache::mod::md') } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^MDomain example\.com example\.net auto$}, ) } @@ -1060,13 +1060,13 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName https://www\.example\.com:443$}, ) } it { - is_expected.to contain_concat('25-www.example.com.conf') + expect(subject).to contain_concat('25-www.example.com.conf') } end @@ -1087,13 +1087,13 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName https://www\.example\.com$}, ) } it { - is_expected.to contain_concat('25-www.example.com.conf') + expect(subject).to contain_concat('25-www.example.com.conf') } end @@ -1114,13 +1114,13 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName www\.example\.com:443$}, ) } it { - is_expected.to contain_concat('25-www.example.com.conf') + expect(subject).to contain_concat('25-www.example.com.conf') } end @@ -1141,13 +1141,13 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^\s+ServerName www\.example\.com$}, ) } it { - is_expected.to contain_concat('25-www.example.com.conf') + expect(subject).to contain_concat('25-www.example.com.conf') } end @@ -1167,7 +1167,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[./m]*[./m]*$}, ) } @@ -1194,7 +1194,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[./m]*[./m]*$}, ) } @@ -1221,7 +1221,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[./m]*[./m]*$}, ) } @@ -1252,7 +1252,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[./m]*[./m]*$}, ) } @@ -1277,7 +1277,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{[./m]*[./m]*$}, ) } @@ -1297,13 +1297,13 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-docroot').with( + expect(subject).to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+VirtualDocumentRoot "/var/www/sites/%0"$}, ) } it { - is_expected.not_to contain_concat__fragment('rspec.example.com-docroot').with( + expect(subject).not_to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+DocumentRoot "/var/www/html"$}, ) } @@ -1321,13 +1321,13 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-docroot').with( + expect(subject).to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+VirtualDocumentRoot "/var/www/sites/%0"$}, ) } it { - is_expected.to contain_concat__fragment('rspec.example.com-docroot').with( + expect(subject).to contain_concat__fragment('rspec.example.com-docroot').with( content: %r{^\s+DocumentRoot "/var/www/html"$}, ) } @@ -1344,7 +1344,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-security').with( + expect(subject).to contain_concat__fragment('rspec.example.com-security').with( content: %r{^\s*SecAuditLog "/var/log/#{apache_name}/rspec\.example\.com_security\.log"$}, ) } @@ -1361,7 +1361,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-security').with( + expect(subject).to contain_concat__fragment('rspec.example.com-security').with( content: %r{\s*SecAuditLog "/var/log/#{apache_name}/foo.log"$}, ) } @@ -1379,7 +1379,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-security').with( + expect(subject).to contain_concat__fragment('rspec.example.com-security').with( content: %r{ ^\s+SecAction\ \\\n \s+"id:900110,\\\n @@ -1405,7 +1405,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-security').with( + expect(subject).to contain_concat__fragment('rspec.example.com-security').with( content: %r{ ^\s+SecAction\ \\\n \s+"id:900200,\\\n @@ -1449,7 +1449,7 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-proxy').with_content( + expect(subject).to contain_concat__fragment('rspec.example.com-proxy').with_content( %r{ProxyPassMatch .* http://backend-a/ timeout=300}, ).with_content(%r{## Proxy rules}) } @@ -1514,11 +1514,11 @@ it { is_expected.to contain_file('/var/www/foo') } it { - is_expected.to contain_file('/tmp/logroot').with('ensure' => 'absent') + expect(subject).to contain_file('/tmp/logroot').with('ensure' => 'absent') } it { - is_expected.to contain_concat('25-rspec.example.com.conf').with('ensure' => 'absent') + expect(subject).to contain_concat('25-rspec.example.com.conf').with('ensure' => 'absent') } it { is_expected.to contain_concat__fragment('rspec.example.com-apache-header') } @@ -1762,7 +1762,7 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( + expect(subject).to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog.*my_log_file" combined\s*$}, ) } @@ -1778,7 +1778,7 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( + expect(subject).to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog.*my_log_file" combined\s+env=prod$}, ) } @@ -1797,19 +1797,19 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( + expect(subject).to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog "/tmp/log1"\s+combined\s+env=dev$}, ) } it { - is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( + expect(subject).to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog "/var/log/#{apache_name}/log2"\s+combined\s*$}, ) } it { - is_expected.to contain_concat__fragment('rspec.example.com-access_log').with( + expect(subject).to contain_concat__fragment('rspec.example.com-access_log').with( content: %r{^\s+CustomLog "syslog" "%h %l"\s*$}, ) } @@ -1826,7 +1826,7 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-logging').with( + expect(subject).to contain_concat__fragment('rspec.example.com-logging').with( content: %r{^\s+ErrorLogFormat "\[%t\] \[%l\] %7F: %E: \[client\\ %a\] %M% ,\\ referer\\ %\{Referer\}i"$}, ) } @@ -1847,7 +1847,7 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-logging') + expect(subject).to contain_concat__fragment('rspec.example.com-logging') .with_content(%r{^\s+ErrorLogFormat "\[%\{uc\}t\] \[%-m:%-l\] \[R:%L\] \[C:%\{C\}L\] %7F: %E: %M"$}) .with_content(%r{^\s+ErrorLogFormat request "\[%\{uc\}t\] \[R:%L\] Request %k on C:%\{c\}L pid:%P tid:%T"$}) .with_content(%r{^\s+ErrorLogFormat request "\[%\{uc\}t\] \[R:%L\] UA:'%\+\{User-Agent\}i'"$}) @@ -1893,8 +1893,8 @@ end it { - is_expected.to compile - is_expected.not_to contain_concat__fragment('rspec.example.com-rewrite') + expect(subject).to compile + expect(subject).not_to contain_concat__fragment('rspec.example.com-rewrite') } end @@ -1907,7 +1907,7 @@ end it { - is_expected.not_to contain_concat__fragment('rspec.example.com-rewrite') + expect(subject).not_to contain_concat__fragment('rspec.example.com-rewrite') .with_content(%r{^\s+RewriteOptions Inherit$}) .with_content(%r{^\s+RewriteEngine On$}) .with_content(%r{^\s+RewriteRule \^index\.html\$ welcome.html$}) @@ -1923,7 +1923,7 @@ end it { - is_expected.not_to contain_concat__fragment('rspec.example.com-rewrite') + expect(subject).not_to contain_concat__fragment('rspec.example.com-rewrite') .with_content(%r{^\s+RewriteEngine On$}) .with_content(%r{^\s+RewriteRule \^index\.html\$ welcome.html$}) .without(content: %r{^\s+RewriteOptions Inherit$}) @@ -1996,7 +1996,7 @@ if (os_facts[:os]['family'] == 'RedHat' && os_facts[:os]['release']['major'].to_i > 6) || (os_facts[:os]['name'] == 'SLES' && os_facts[:os]['release']['major'].to_i > 11) it { - is_expected.to contain_concat__fragment('rspec.example.com-directories').with( + expect(subject).to contain_concat__fragment('rspec.example.com-directories').with( content: %r{^\s+Require all granted$}, ) } @@ -2023,7 +2023,7 @@ it { is_expected.to contain_concat('25-rspec.example.com.conf') } it { - is_expected.not_to contain_concat__fragment('rspec.example.com-directories').with( + expect(subject).not_to contain_concat__fragment('rspec.example.com-directories').with( content: %r{^\s+Require all granted$}, ) } @@ -2064,7 +2064,7 @@ it { is_expected.to compile } it { - is_expected.to contain_concat__fragment('rspec.example.com-auth_oidc').with( + expect(subject).to contain_concat__fragment('rspec.example.com-auth_oidc').with( content: %r{^\s+OIDCRedirectURI\s/some/valid/relative/uri$}, ) } @@ -2096,7 +2096,7 @@ end it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-header').with( + expect(subject).to contain_concat__fragment('rspec.example.com-apache-header').with( content: %r{^MDomain rspec.example.com$}, ) } @@ -2112,7 +2112,7 @@ ) it { - is_expected.to contain_concat__fragment('rspec.example.com-apache-userdir') + expect(subject).to contain_concat__fragment('rspec.example.com-apache-userdir') .with(content: %r{^\s+UserDir disabled$}) .with(content: %r{^\s+UUserDir enabled bob$}) } From 40c8edd2660f802fb2f86ab3fd258426d26a1008 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Thu, 20 Apr 2023 13:37:35 +0100 Subject: [PATCH 16/17] (CONT-772) Unsage correct cop group --- .rubocop_todo.yml | 48 +------------------ lib/puppet/functions/apache/pw_hash.rb | 2 +- spec/classes/mod/authnz_ldap_spec.rb | 4 +- spec/classes/mod/authnz_pam_spec.rb | 4 +- .../classes/mod/intercept_form_submit_spec.rb | 4 +- spec/classes/mod/ldap_spec.rb | 4 +- spec/classes/mod/lookup_identity.rb | 4 +- spec/classes/mod/status_spec.rb | 15 +++--- spec/defines/vhost_spec.rb | 4 +- spec/type_aliases/modproxy_spec.rb | 2 + tasks/init.rb | 2 +- 11 files changed, 25 insertions(+), 68 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 02032729a4..14a17e6d77 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -91,7 +91,7 @@ RSpec/FilePath: - 'spec/classes/mod/proxy_wstunnel.rb' # Offense count: 16 -# This cop supports safe autocorrection (--autocorrect). +# This cop supports safe autocorrection. RSpec/LetBeforeExamples: Exclude: - 'spec/classes/mod/auth_kerb_spec.rb' @@ -157,53 +157,7 @@ RSpec/StubbedMock: Exclude: - 'spec/util/apache_mod_platform_compatibility_spec.rb' -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: MinBranchesCount. -Style/CaseLikeIf: - Exclude: - - 'spec/classes/mod/status_spec.rb' - -# Offense count: 12 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/CommentedKeyword: - Exclude: - - 'spec/classes/mod/authnz_ldap_spec.rb' - - 'spec/classes/mod/authnz_pam_spec.rb' - - 'spec/classes/mod/intercept_form_submit_spec.rb' - - 'spec/classes/mod/ldap_spec.rb' - - 'spec/classes/mod/lookup_identity.rb' - - 'spec/defines/vhost_spec.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: always, always_true, never -Style/FrozenStringLiteralComment: - Exclude: - - 'spec/type_aliases/modproxy_spec.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -Style/GlobalStdStream: - Exclude: - - 'tasks/init.rb' - # Offense count: 1 Style/MixinUsage: Exclude: - 'spec/spec_helper.rb' - -# Offense count: 3 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Methods. -Style/RedundantArgument: - Exclude: - - 'spec/classes/mod/status_spec.rb' - -# Offense count: 1 -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: Mode. -Style/StringConcatenation: - Exclude: - - 'lib/puppet/functions/apache/pw_hash.rb' diff --git a/lib/puppet/functions/apache/pw_hash.rb b/lib/puppet/functions/apache/pw_hash.rb index c56e916b9e..6a1630b546 100644 --- a/lib/puppet/functions/apache/pw_hash.rb +++ b/lib/puppet/functions/apache/pw_hash.rb @@ -18,6 +18,6 @@ def apache_pw_hash(password) require 'base64' - '{SHA}' + Base64.strict_encode64(Digest::SHA1.digest(password)) + "{SHA}#{Base64.strict_encode64(Digest::SHA1.digest(password))}" end end diff --git a/spec/classes/mod/authnz_ldap_spec.rb b/spec/classes/mod/authnz_ldap_spec.rb index f76ac9c4b4..f672c4a573 100644 --- a/spec/classes/mod/authnz_ldap_spec.rb +++ b/spec/classes/mod/authnz_ldap_spec.rb @@ -29,7 +29,7 @@ expect(subject).to compile.and_raise_error(%r{parameter 'verify_server_cert' expects a Boolean value, got String}) end end - end # Debian + end context 'default configuration with parameters on a RedHat OS' do on_supported_os.each do |os, os_facts| @@ -81,5 +81,5 @@ end end end - end # Redhat + end end diff --git a/spec/classes/mod/authnz_pam_spec.rb b/spec/classes/mod/authnz_pam_spec.rb index 6fb9a6a697..c97574878e 100644 --- a/spec/classes/mod/authnz_pam_spec.rb +++ b/spec/classes/mod/authnz_pam_spec.rb @@ -12,7 +12,7 @@ it { is_expected.to contain_class('apache') } it { is_expected.to contain_package('libapache2-mod-authnz-pam') } it { is_expected.to contain_apache__mod('authnz_pam') } - end # Debian + end context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -20,6 +20,6 @@ it { is_expected.to contain_class('apache') } it { is_expected.to contain_package('mod_authnz_pam') } it { is_expected.to contain_apache__mod('authnz_pam') } - end # Redhat + end end end diff --git a/spec/classes/mod/intercept_form_submit_spec.rb b/spec/classes/mod/intercept_form_submit_spec.rb index 1618b138e5..2e12c182b3 100644 --- a/spec/classes/mod/intercept_form_submit_spec.rb +++ b/spec/classes/mod/intercept_form_submit_spec.rb @@ -12,7 +12,7 @@ it { is_expected.to contain_class('apache') } it { is_expected.to contain_package('libapache2-mod-intercept-form-submit') } it { is_expected.to contain_apache__mod('intercept_form_submit') } - end # Debian + end context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -20,6 +20,6 @@ it { is_expected.to contain_class('apache') } it { is_expected.to contain_package('mod_intercept_form_submit') } it { is_expected.to contain_apache__mod('intercept_form_submit') } - end # Redhat + end end end diff --git a/spec/classes/mod/ldap_spec.rb b/spec/classes/mod/ldap_spec.rb index 8faa1e0502..15c160d44a 100644 --- a/spec/classes/mod/ldap_spec.rb +++ b/spec/classes/mod/ldap_spec.rb @@ -52,7 +52,7 @@ "\n" it { is_expected.to contain_file('ldap.conf').with_content(%r{#{expected_ldap_path_re}}m) } end - end # Debian + end context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -93,5 +93,5 @@ it { is_expected.to contain_package('httpd24-mod_ldap') } end - end # Redhat + end end diff --git a/spec/classes/mod/lookup_identity.rb b/spec/classes/mod/lookup_identity.rb index 320d1843cc..9cfeaf469d 100644 --- a/spec/classes/mod/lookup_identity.rb +++ b/spec/classes/mod/lookup_identity.rb @@ -12,7 +12,7 @@ it { is_expected.to contain_class('apache') } it { is_expected.to contain_package('libapache2-mod-lookup-identity') } it { is_expected.to contain_apache__mod('lookup_identity') } - end # Debian + end context 'on a RedHat OS' do include_examples 'RedHat 8' @@ -20,6 +20,6 @@ it { is_expected.to contain_class('apache') } it { is_expected.to contain_package('mod_lookup_identity') } it { is_expected.to contain_apache__mod('lookup_identity') } - end # Redhat + end end end diff --git a/spec/classes/mod/status_spec.rb b/spec/classes/mod/status_spec.rb index ce8fd5149b..5e1a52cd2d 100644 --- a/spec/classes/mod/status_spec.rb +++ b/spec/classes/mod/status_spec.rb @@ -3,24 +3,25 @@ require 'spec_helper' def require_directives(requires) - if requires == :undef + case requires + when :undef " Require ip 127.0.0.1 ::1\n" - elsif requires.is_a?(String) + when String if ['', 'unmanaged'].include? requires.downcase '' else " Require #{requires}\n" end - elsif requires.is_a?(Array) - requires.map { |req| " Require #{req}\n" }.join('') - elsif requires.is_a?(Hash) + when Array + requires.map { |req| " Require #{req}\n" }.join + when Hash if requires.key?(:enforce) \ " \n" + \ - requires[:requires].map { |req| " Require #{req}\n" }.join('') + \ + requires[:requires].map { |req| " Require #{req}\n" }.join + \ " \n" else - requires[:requires].map { |req| " Require #{req}\n" }.join('') + requires[:requires].map { |req| " Require #{req}\n" }.join end end end diff --git a/spec/defines/vhost_spec.rb b/spec/defines/vhost_spec.rb index 64872cac07..c267ef936d 100644 --- a/spec/defines/vhost_spec.rb +++ b/spec/defines/vhost_spec.rb @@ -1814,7 +1814,7 @@ ) } end - end # access logs + end describe 'error logs format' do context 'single log format directive as a string' do @@ -1855,7 +1855,7 @@ .with_content(%r{^\s+ErrorLogFormat connection "\[%\{uc\}t\] \[C:%\{c\}L\] local\\ %a remote\\ %A"$}) } end - end # error logs format + end describe 'validation' do let(:params) do diff --git a/spec/type_aliases/modproxy_spec.rb b/spec/type_aliases/modproxy_spec.rb index a655e2517a..ab7c1bcf1a 100644 --- a/spec/type_aliases/modproxy_spec.rb +++ b/spec/type_aliases/modproxy_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'Apache::ModProxyProtocol' do diff --git a/tasks/init.rb b/tasks/init.rb index 50f96ce610..caf5b58843 100755 --- a/tasks/init.rb +++ b/tasks/init.rb @@ -23,7 +23,7 @@ def service(action, service_name) { status: "#{action} successful" } end -params = JSON.parse(STDIN.read) +params = JSON.parse($stdin.read) action = params['action'] service_name = params['service_name'] From 462a98eb38f52d17af3e415810ce401d8dcba677 Mon Sep 17 00:00:00 2001 From: Lukas Audzevicius Date: Fri, 21 Apr 2023 11:02:04 +0100 Subject: [PATCH 17/17] (CONT-772) Manual correct Style/MixinUsage --- .rubocop_todo.yml | 5 ----- spec/spec_helper.rb | 2 +- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 14a17e6d77..7295fd9d68 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -156,8 +156,3 @@ RSpec/RepeatedExampleGroupDescription: RSpec/StubbedMock: Exclude: - 'spec/util/apache_mod_platform_compatibility_spec.rb' - -# Offense count: 1 -Style/MixinUsage: - Exclude: - - 'spec/spec_helper.rb' diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index c6e5525752..1a8b68bde8 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -9,7 +9,7 @@ require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) -include RspecPuppetFacts +include RspecPuppetFacts # rubocop:disable Style/MixinUsage default_facts = { puppetversion: Puppet.version,