diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index 12ed4ff..0000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,6 +0,0 @@ -FROM puppet/pdk:latest - -# [Optional] Uncomment this section to install additional packages. -# RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ -# && apt-get -y install --no-install-recommends - diff --git a/.devcontainer/README.md b/.devcontainer/README.md deleted file mode 100644 index cc4675e..0000000 --- a/.devcontainer/README.md +++ /dev/null @@ -1,34 +0,0 @@ -# devcontainer - - -For format details, see https://aka.ms/devcontainer.json. - -For config options, see the README at: -https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet - -``` json -{ - "name": "Puppet Development Kit (Community)", - "dockerFile": "Dockerfile", - - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": [ - "puppet.puppet-vscode", - "rebornix.Ruby" - ] - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "pdk --version", -} -``` - - - diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index fe7a8b1..0000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "Puppet Development Kit (Community)", - "dockerFile": "Dockerfile", - - "settings": { - "terminal.integrated.profiles.linux": { - "bash": { - "path": "bash", - } - } - }, - - "extensions": [ - "puppet.puppet-vscode", - "rebornix.Ruby" - ] -} diff --git a/.fixtures.yml b/.fixtures.yml index 51549fd..132d9b3 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -5,5 +5,3 @@ fixtures: stdlib: puppetlabs/stdlib apache: puppetlabs/apache mysql: puppetlabs/mysql - symlinks: - "postfixadmin": "#{source_dir}" diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 37a7699..4d9d153 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,3 @@ +--- github: [cirrax] custom: ["https://cirrax.com"] diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 0000000..5697fbd --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,6 @@ +--- +changelog: + categories: + - title: Changes + labels: + - "*" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ce287e3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +--- +name: run VoxBox checks + +env: + VOXBOX: 'ghcr.io/voxpupuli/voxbox:8' + +# yamllint disable-line rule:truthy +on: + pull_request: {} + + +concurrency: + group: ${{ github.ref_name }} + cancel-in-progress: true + +jobs: + build-push: + runs-on: ubuntu-latest + steps: + - name: Setup Podman + run: | + sudo apt update + sudo apt-get -y install podman + podman pull ${VOXBOX} + - name: Checkout Repository + uses: actions/checkout@v4 + - name: run validate + run: | + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} validate + - name: run check + run: | + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} check + - name: run lint + run: | + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} lint + - name: run yamllint + run: | + podman run -it --rm -v $PWD:/repo:Z --entrypoint yamllint ${VOXBOX} . + - name: run rubocop + run: | + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} rubocop + - name: check syntax + run: | + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} strings:validate:reference + - name: run spec tests + run: | + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} fixtures:clean + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} fixtures:prep + podman run -it --rm -v $PWD:/repo:Z ${VOXBOX} spec diff --git a/.github/workflows/pdk.yml b/.github/workflows/pdk.yml deleted file mode 100644 index 4012fa3..0000000 --- a/.github/workflows/pdk.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: PDK - -on: - - 'push' - - 'pull_request' - -jobs: - validate: - runs-on: ubuntu-latest - container: puppet/pdk:latest - outputs: - puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }} - github_action_test_matrix: ${{ steps.get-outputs.outputs.github_action_test_matrix }} - steps: - - name: Install build-essential - run: | - export DEBIAN_FRONTEND=noninteractive; - apt-get --yes update - apt-get --yes install build-essential - - name: Check out repository code - uses: actions/checkout@v3 - - name: run pdk validate - run: pdk validate - - unit-test: - runs-on: ubuntu-latest - container: puppet/pdk:latest - steps: - - name: Install build-essential - run: | - export DEBIAN_FRONTEND=noninteractive; - apt-get --yes update - apt-get --yes install build-essential - - name: Check out repository code - uses: actions/checkout@v3 - - name: run pdk test unit - run: pdk test unit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..82f514c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,26 @@ +--- +name: Create releasenotes + +# yamllint disable-line rule:truthy +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - name: Create release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref_name }} + run: | + gh release create "$tag" \ + --repo="$GITHUB_REPOSITORY" \ + --title="${tag#v}" \ + --generate-notes diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml deleted file mode 100644 index 6d5e786..0000000 --- a/.gitlab-ci.yml +++ /dev/null @@ -1,53 +0,0 @@ ---- -stages: - - syntax - - unit - -default: - cache: - paths: - - vendor/bundle - - before_script: &before_script - - bundle -v - - rm Gemfile.lock || true - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# Set `rubygems_version` in the .sync.yml to set a value" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v - - bundle install --without system_tests --path vendor/bundle --jobs $(nproc) - -validate lint check rubocop-Ruby 2.5.7-Puppet ~> 6: - stage: syntax - image: ruby:2.5.7 - script: - - bundle exec rake validate lint check rubocop - variables: - PUPPET_GEM_VERSION: '~> 6' - -parallel_spec-Ruby 2.5.7-Puppet ~> 6: - stage: unit - image: ruby:2.5.7 - script: - - bundle exec rake parallel_spec - variables: - PUPPET_GEM_VERSION: '~> 6' - -validate lint check rubocop-Ruby 2.7.2-Puppet ~> 7: - stage: syntax - image: ruby:2.7.2 - script: - - bundle exec rake validate lint check rubocop - variables: - PUPPET_GEM_VERSION: '~> 7' - -parallel_spec-Ruby 2.7.2-Puppet ~> 7: - stage: unit - image: ruby:2.7.2 - script: - - bundle exec rake parallel_spec - variables: - PUPPET_GEM_VERSION: '~> 7' - diff --git a/.pdkignore b/.pdkignore deleted file mode 100644 index 84684be..0000000 --- a/.pdkignore +++ /dev/null @@ -1,51 +0,0 @@ -.git/ -.*.sw[op] -.metadata -.yardoc -.yardwarns -*.iml -/.bundle/ -/.idea/ -/.vagrant/ -/coverage/ -/bin/ -/doc/ -/Gemfile.local -/Gemfile.lock -/junit/ -/log/ -/pkg/ -/spec/fixtures/manifests/ -/spec/fixtures/modules/* -/tmp/ -/vendor/ -/.vendor/ -/convert_report.txt -/update_report.txt -.DS_Store -.project -.envrc -/inventory.yaml -/spec/fixtures/litmus_inventory.yaml -.resource_types -.modules -.task_cache.json -.plan_cache.json -.rerun.json -bolt-debug.log -/.fixtures.yml -/Gemfile -/.gitattributes -/.github/ -/.gitignore -/.pdkignore -/.puppet-lint.rc -/Rakefile -/rakelib/ -/.rspec -/..yml -/.yardopts -/spec/ -/.vscode/ -/.sync.yml -/.devcontainer/ diff --git a/.puppet-lint.rc b/.puppet-lint.rc deleted file mode 100644 index 9e15c6e..0000000 --- a/.puppet-lint.rc +++ /dev/null @@ -1,9 +0,0 @@ ---fail-on-warnings ---relative ---no-80chars-check ---no-140chars-check ---no-class_inherits_from_params_class-check ---no-autoloader_layout-check ---no-documentation-check ---no-single_quote_string_with_variables-check ---ignore-paths=.vendor/**/*.pp,.bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp,tests/**/*.pp,types/**/*.pp,vendor/**/*.pp diff --git a/.rubocop.yml b/.rubocop.yml index 21b82b9..74669e1 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,730 +1,7 @@ --- -require: -- rubocop-performance -- rubocop-rspec -AllCops: - NewCops: enable - DisplayCopNames: true - TargetRubyVersion: '2.6' - Include: - - "**/*.rb" - Exclude: - - bin/* - - ".vendor/**/*" - - "**/Gemfile" - - "**/Rakefile" - - pkg/**/* - - spec/fixtures/**/* - - vendor/**/* - - "**/Puppetfile" - - "**/Vagrantfile" - - "**/Guardfile" -Layout/LineLength: - Description: People have wide screens, use them. - Max: 200 -RSpec/BeforeAfterAll: - Description: Beware of using after(:all) as it may cause state to leak between tests. - A necessary evil in acceptance testing. - Exclude: - - spec/acceptance/**/*.rb -RSpec/HookArgument: - Description: Prefer explicit :each argument, matching existing module's style - EnforcedStyle: each -RSpec/DescribeSymbol: - Exclude: - - spec/unit/facter/**/*.rb -Style/BlockDelimiters: - Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to - be consistent then. - EnforcedStyle: braces_for_chaining -Style/ClassAndModuleChildren: - Description: Compact style reduces the required amount of indentation. - EnforcedStyle: compact -Style/EmptyElse: - Description: Enforce against empty else clauses, but allow `nil` for clarity. - EnforcedStyle: empty -Style/FormatString: - Description: Following the main puppet project's style, prefer the % format format. - EnforcedStyle: percent -Style/FormatStringToken: - Description: Following the main puppet project's style, prefer the simpler template - tokens over annotated ones. - EnforcedStyle: template -Style/Lambda: - Description: Prefer the keyword for easier discoverability. - EnforcedStyle: literal -Style/RegexpLiteral: - Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168 - EnforcedStyle: percent_r -Style/TernaryParentheses: - Description: Checks for use of parentheses around ternary conditions. Enforce parentheses - on complex expressions for better readability, but seriously consider breaking - it up. - EnforcedStyle: require_parentheses_when_complex -Style/TrailingCommaInArguments: - Description: Prefer always trailing comma on multiline argument lists. This makes - diffs, and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/TrailingCommaInArrayLiteral: - Description: Prefer always trailing comma on multiline literals. This makes diffs, - and re-ordering nicer. - EnforcedStyleForMultiline: comma -Style/SymbolArray: - Description: Using percent style obscures symbolic intent of array's contents. - EnforcedStyle: brackets -RSpec/MessageSpies: - EnforcedStyle: receive -Style/Documentation: - Exclude: - - lib/puppet/parser/functions/**/* - - spec/**/* -Style/WordArray: - EnforcedStyle: brackets -Performance/AncestorsInclude: - Enabled: true -Performance/BigDecimalWithNumericArgument: - Enabled: true -Performance/BlockGivenWithExplicitBlock: - Enabled: true -Performance/CaseWhenSplat: - Enabled: true -Performance/ConstantRegexp: - Enabled: true -Performance/MethodObjectAsBlock: - Enabled: true -Performance/RedundantSortBlock: - Enabled: true -Performance/RedundantStringChars: - Enabled: true -Performance/ReverseFirst: - Enabled: true -Performance/SortReverse: - Enabled: true -Performance/Squeeze: - Enabled: true -Performance/StringInclude: - Enabled: true -Performance/Sum: - Enabled: true -Style/CollectionMethods: - Enabled: true -Style/MethodCalledOnDoEndBlock: - Enabled: true -Style/StringMethods: - Enabled: true -Bundler/GemFilename: - Enabled: false -Bundler/InsecureProtocolSource: - Enabled: false -Capybara/CurrentPathExpectation: - Enabled: false -Capybara/VisibilityMatcher: - Enabled: false -Gemspec/DuplicatedAssignment: - Enabled: false -Gemspec/OrderedDependencies: - Enabled: false -Gemspec/RequiredRubyVersion: - Enabled: false -Gemspec/RubyVersionGlobalsUsage: - Enabled: false -Layout/ArgumentAlignment: - Enabled: false -Layout/BeginEndAlignment: - Enabled: false -Layout/ClosingHeredocIndentation: - Enabled: false -Layout/EmptyComment: - Enabled: false -Layout/EmptyLineAfterGuardClause: - Enabled: false -Layout/EmptyLinesAroundArguments: - Enabled: false -Layout/EmptyLinesAroundAttributeAccessor: - Enabled: false -Layout/EndOfLine: - Enabled: false -Layout/FirstArgumentIndentation: - Enabled: false -Layout/HashAlignment: - Enabled: false -Layout/HeredocIndentation: - Enabled: false -Layout/LeadingEmptyLines: - Enabled: false -Layout/SpaceAroundMethodCallOperator: - Enabled: false -Layout/SpaceInsideArrayLiteralBrackets: - Enabled: false -Layout/SpaceInsideReferenceBrackets: - Enabled: false -Lint/BigDecimalNew: - Enabled: false -Lint/BooleanSymbol: - Enabled: false -Lint/ConstantDefinitionInBlock: - Enabled: false -Lint/DeprecatedOpenSSLConstant: - Enabled: false -Lint/DisjunctiveAssignmentInConstructor: - Enabled: false -Lint/DuplicateElsifCondition: - Enabled: false -Lint/DuplicateRequire: - Enabled: false -Lint/DuplicateRescueException: - Enabled: false -Lint/EmptyConditionalBody: - Enabled: false -Lint/EmptyFile: - Enabled: false -Lint/ErbNewArguments: - Enabled: false -Lint/FloatComparison: - Enabled: false -Lint/HashCompareByIdentity: - Enabled: false -Lint/IdentityComparison: - Enabled: false -Lint/InterpolationCheck: - Enabled: false -Lint/MissingCopEnableDirective: - Enabled: false -Lint/MixedRegexpCaptureTypes: - Enabled: false -Lint/NestedPercentLiteral: - Enabled: false -Lint/NonDeterministicRequireOrder: - Enabled: false -Lint/OrderedMagicComments: - Enabled: false -Lint/OutOfRangeRegexpRef: - Enabled: false -Lint/RaiseException: - Enabled: false -Lint/RedundantCopEnableDirective: - Enabled: false -Lint/RedundantRequireStatement: - Enabled: false -Lint/RedundantSafeNavigation: - Enabled: false -Lint/RedundantWithIndex: - Enabled: false -Lint/RedundantWithObject: - Enabled: false -Lint/RegexpAsCondition: - Enabled: false -Lint/ReturnInVoidContext: - Enabled: false -Lint/SafeNavigationConsistency: - Enabled: false -Lint/SafeNavigationWithEmpty: - Enabled: false -Lint/SelfAssignment: - Enabled: false -Lint/SendWithMixinArgument: - Enabled: false -Lint/ShadowedArgument: - Enabled: false -Lint/StructNewOverride: - Enabled: false -Lint/ToJSON: - Enabled: false -Lint/TopLevelReturnWithArgument: - Enabled: false -Lint/TrailingCommaInAttributeDeclaration: - Enabled: false -Lint/UnreachableLoop: - Enabled: false -Lint/UriEscapeUnescape: - Enabled: false -Lint/UriRegexp: - Enabled: false -Lint/UselessMethodDefinition: - Enabled: false -Lint/UselessTimes: - Enabled: false -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/BlockNesting: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false -Migration/DepartmentName: - Enabled: false -Naming/AccessorMethodName: - Enabled: false -Naming/BlockParameterName: - Enabled: false -Naming/HeredocDelimiterCase: - Enabled: false -Naming/HeredocDelimiterNaming: - Enabled: false -Naming/MemoizedInstanceVariableName: - Enabled: false -Naming/MethodParameterName: - Enabled: false -Naming/RescuedExceptionsVariableName: - Enabled: false -Naming/VariableNumber: - Enabled: false -Performance/BindCall: - Enabled: false -Performance/DeletePrefix: - Enabled: false -Performance/DeleteSuffix: - Enabled: false -Performance/InefficientHashSearch: - Enabled: false -Performance/UnfreezeString: - Enabled: false -Performance/UriDefaultParser: - Enabled: false -RSpec/Be: - Enabled: false -RSpec/Capybara/FeatureMethods: - Enabled: false -RSpec/ContainExactly: - Enabled: false -RSpec/ContextMethod: - Enabled: false -RSpec/ContextWording: - Enabled: false -RSpec/DescribeClass: - Enabled: false -RSpec/EmptyHook: - Enabled: false -RSpec/EmptyLineAfterExample: - Enabled: false -RSpec/EmptyLineAfterExampleGroup: - Enabled: false -RSpec/EmptyLineAfterHook: - Enabled: false -RSpec/ExampleLength: - Enabled: false -RSpec/ExampleWithoutDescription: - Enabled: false -RSpec/ExpectChange: - Enabled: false -RSpec/ExpectInHook: - Enabled: false -RSpec/FactoryBot/AttributeDefinedStatically: - Enabled: false -RSpec/FactoryBot/CreateList: - Enabled: false -RSpec/FactoryBot/FactoryClassName: - Enabled: false -RSpec/HooksBeforeExamples: - Enabled: false -RSpec/ImplicitBlockExpectation: - Enabled: false -RSpec/ImplicitSubject: - Enabled: false -RSpec/LeakyConstantDeclaration: - Enabled: false -RSpec/LetBeforeExamples: - Enabled: false -RSpec/MatchArray: - Enabled: false -RSpec/MissingExampleGroupArgument: - Enabled: false -RSpec/MultipleExpectations: - Enabled: false -RSpec/MultipleMemoizedHelpers: - Enabled: false -RSpec/MultipleSubjects: - Enabled: false -RSpec/NestedGroups: - Enabled: false -RSpec/PredicateMatcher: - Enabled: false -RSpec/ReceiveCounts: - Enabled: false -RSpec/ReceiveNever: - Enabled: false -RSpec/RepeatedExampleGroupBody: - Enabled: false -RSpec/RepeatedExampleGroupDescription: - Enabled: false -RSpec/RepeatedIncludeExample: - Enabled: false -RSpec/ReturnFromStub: - Enabled: false -RSpec/SharedExamples: - Enabled: false -RSpec/StubbedMock: - Enabled: false -RSpec/UnspecifiedException: - Enabled: false -RSpec/VariableDefinition: - Enabled: false -RSpec/VoidExpect: - Enabled: false -RSpec/Yield: - Enabled: false -Security/Open: - Enabled: false -Style/AccessModifierDeclarations: - Enabled: false -Style/AccessorGrouping: - Enabled: false -Style/BisectedAttrAccessor: - Enabled: false -Style/CaseLikeIf: - Enabled: false -Style/ClassEqualityComparison: - Enabled: false -Style/ColonMethodDefinition: - Enabled: false -Style/CombinableLoops: - Enabled: false -Style/CommentedKeyword: - Enabled: false -Style/Dir: - Enabled: false -Style/DoubleCopDisableDirective: - Enabled: false -Style/EmptyBlockParameter: - Enabled: false -Style/EmptyLambdaParameter: - Enabled: false -Style/Encoding: - Enabled: false -Style/EvalWithLocation: - Enabled: false -Style/ExpandPathArguments: - Enabled: false -Style/ExplicitBlockArgument: - Enabled: false -Style/ExponentialNotation: - Enabled: false -Style/FloatDivision: - Enabled: false -Style/FrozenStringLiteralComment: - Enabled: false -Style/GlobalStdStream: - Enabled: false -Style/HashAsLastArrayItem: - Enabled: false -Style/HashLikeCase: - Enabled: false -Style/HashTransformKeys: - Enabled: false -Style/HashTransformValues: - Enabled: false -Style/IfUnlessModifier: - Enabled: false -Style/KeywordParametersOrder: - Enabled: false -Style/MinMax: - Enabled: false -Style/MixinUsage: - Enabled: false -Style/MultilineWhenThen: - Enabled: false -Style/NegatedUnless: - Enabled: false -Style/NumericPredicate: - Enabled: false -Style/OptionalBooleanParameter: - Enabled: false -Style/OrAssignment: - Enabled: false -Style/RandomWithOffset: - Enabled: false -Style/RedundantAssignment: - Enabled: false -Style/RedundantCondition: - Enabled: false -Style/RedundantConditional: - Enabled: false -Style/RedundantFetchBlock: - Enabled: false -Style/RedundantFileExtensionInRequire: - Enabled: false -Style/RedundantRegexpCharacterClass: - Enabled: false -Style/RedundantRegexpEscape: - Enabled: false -Style/RedundantSelfAssignment: - Enabled: false -Style/RedundantSort: - Enabled: false -Style/RescueStandardError: - Enabled: false -Style/SingleArgumentDig: - Enabled: false -Style/SlicingWithRange: - Enabled: false -Style/SoleNestedConditional: - Enabled: false -Style/StderrPuts: - Enabled: false -Style/StringConcatenation: - Enabled: false -Style/Strip: - Enabled: false -Style/SymbolProc: - Enabled: false -Style/TrailingBodyOnClass: - Enabled: false -Style/TrailingBodyOnMethodDefinition: - Enabled: false -Style/TrailingBodyOnModule: - Enabled: false -Style/TrailingCommaInHashLiteral: - Enabled: false -Style/TrailingMethodEndStatement: - Enabled: false -Style/UnpackFirst: - Enabled: false -Capybara/MatchStyle: - Enabled: false -Capybara/NegationMatcher: - Enabled: false -Capybara/SpecificActions: - Enabled: false -Capybara/SpecificFinders: - Enabled: false -Capybara/SpecificMatcher: - Enabled: false -Gemspec/DeprecatedAttributeAssignment: - Enabled: false -Gemspec/DevelopmentDependencies: - Enabled: false -Gemspec/RequireMFA: - Enabled: false -Layout/LineContinuationLeadingSpace: - Enabled: false -Layout/LineContinuationSpacing: - Enabled: false -Layout/LineEndStringConcatenationIndentation: - Enabled: false -Layout/SpaceBeforeBrackets: - Enabled: false -Lint/AmbiguousAssignment: - Enabled: false -Lint/AmbiguousOperatorPrecedence: - Enabled: false -Lint/AmbiguousRange: - Enabled: false -Lint/ConstantOverwrittenInRescue: - Enabled: false -Lint/DeprecatedConstants: - Enabled: false -Lint/DuplicateBranch: - Enabled: false -Lint/DuplicateMagicComment: - Enabled: false -Lint/DuplicateMatchPattern: - Enabled: false -Lint/DuplicateRegexpCharacterClassElement: - Enabled: false -Lint/EmptyBlock: - Enabled: false -Lint/EmptyClass: - Enabled: false -Lint/EmptyInPattern: - Enabled: false -Lint/IncompatibleIoSelectWithFiberScheduler: - Enabled: false -Lint/LambdaWithoutLiteralBlock: - Enabled: false -Lint/NoReturnInBeginEndBlocks: - Enabled: false -Lint/NonAtomicFileOperation: - Enabled: false -Lint/NumberedParameterAssignment: - Enabled: false -Lint/OrAssignmentToConstant: - Enabled: false -Lint/RedundantDirGlobSort: - Enabled: false -Lint/RefinementImportMethods: - Enabled: false -Lint/RequireRangeParentheses: - Enabled: false -Lint/RequireRelativeSelfPath: - Enabled: false -Lint/SymbolConversion: - Enabled: false -Lint/ToEnumArguments: - Enabled: false -Lint/TripleQuotes: - Enabled: false -Lint/UnexpectedBlockArity: - Enabled: false -Lint/UnmodifiedReduceAccumulator: - Enabled: false -Lint/UselessRescue: - Enabled: false -Lint/UselessRuby2Keywords: - Enabled: false -Metrics/CollectionLiteralLength: - Enabled: false -Naming/BlockForwarding: - Enabled: false -Performance/CollectionLiteralInLoop: - Enabled: false -Performance/ConcurrentMonotonicTime: - Enabled: false -Performance/MapCompact: - Enabled: false -Performance/RedundantEqualityComparisonBlock: - Enabled: false -Performance/RedundantSplitRegexpArgument: - Enabled: false -Performance/StringIdentifierArgument: - Enabled: false -RSpec/BeEq: - Enabled: false -RSpec/BeNil: - Enabled: false -RSpec/ChangeByZero: - Enabled: false -RSpec/ClassCheck: - Enabled: false -RSpec/DuplicatedMetadata: - Enabled: false -RSpec/ExcessiveDocstringSpacing: - Enabled: false -RSpec/FactoryBot/ConsistentParenthesesStyle: - Enabled: false -RSpec/FactoryBot/FactoryNameStyle: - Enabled: false -RSpec/FactoryBot/SyntaxMethods: - Enabled: false -RSpec/IdenticalEqualityAssertion: - Enabled: false -RSpec/NoExpectationExample: - Enabled: false -RSpec/PendingWithoutReason: - Enabled: false -RSpec/Rails/AvoidSetupHook: - Enabled: false -RSpec/Rails/HaveHttpStatus: - Enabled: false -RSpec/Rails/InferredSpecType: - Enabled: false -RSpec/Rails/MinitestAssertions: - Enabled: false -RSpec/Rails/TravelAround: - Enabled: false -RSpec/RedundantAround: - Enabled: false -RSpec/SkipBlockInsideExample: - Enabled: false -RSpec/SortMetadata: - Enabled: false -RSpec/SubjectDeclaration: - Enabled: false -RSpec/VerifiedDoubleReference: - Enabled: false -Security/CompoundHash: - Enabled: false -Security/IoMethods: - Enabled: false -Style/ArgumentsForwarding: - Enabled: false -Style/ArrayIntersect: - Enabled: false -Style/CollectionCompact: - Enabled: false -Style/ComparableClamp: - Enabled: false -Style/ConcatArrayLiterals: - Enabled: false -Style/DataInheritance: - Enabled: false -Style/DirEmpty: - Enabled: false -Style/DocumentDynamicEvalDefinition: - Enabled: false -Style/EmptyHeredoc: - Enabled: false -Style/EndlessMethod: - Enabled: false -Style/EnvHome: - Enabled: false -Style/FetchEnvVar: - Enabled: false -Style/FileEmpty: - Enabled: false -Style/FileRead: - Enabled: false -Style/FileWrite: - Enabled: false -Style/HashConversion: - Enabled: false -Style/HashExcept: - Enabled: false -Style/IfWithBooleanLiteralBranches: - Enabled: false -Style/InPatternThen: - Enabled: false -Style/MagicCommentFormat: - Enabled: false -Style/MapCompactWithConditionalBlock: - Enabled: false -Style/MapToHash: - Enabled: false -Style/MapToSet: - Enabled: false -Style/MinMaxComparison: - Enabled: false -Style/MultilineInPatternThen: - Enabled: false -Style/NegatedIfElseCondition: - Enabled: false -Style/NestedFileDirname: - Enabled: false -Style/NilLambda: - Enabled: false -Style/NumberedParameters: - Enabled: false -Style/NumberedParametersLimit: - Enabled: false -Style/ObjectThen: - Enabled: false -Style/OpenStructUse: - Enabled: false -Style/OperatorMethodCall: - Enabled: false -Style/QuotedSymbols: - Enabled: false -Style/RedundantArgument: - Enabled: false -Style/RedundantConstantBase: - Enabled: false -Style/RedundantDoubleSplatHashBraces: - Enabled: false -Style/RedundantEach: - Enabled: false -Style/RedundantHeredocDelimiterQuotes: - Enabled: false -Style/RedundantInitialize: - Enabled: false -Style/RedundantLineContinuation: - Enabled: false -Style/RedundantSelfAssignmentBranch: - Enabled: false -Style/RedundantStringEscape: - Enabled: false -Style/SelectByRegexp: - Enabled: false -Style/StringChars: - Enabled: false -Style/SwapValues: - Enabled: false +inherit_gem: + voxpupuli-test: rubocop.yml + +Layout/DotPosition: + # blah: dsfsf + EnforcedStyle: leading diff --git a/.sync.yml b/.sync.yml deleted file mode 100644 index eef3bd1..0000000 --- a/.sync.yml +++ /dev/null @@ -1,6 +0,0 @@ - -.travis.yml: - simplecov: true - -spec/spec_helper.rb: - coverage_report: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6630876..0000000 --- a/.travis.yml +++ /dev/null @@ -1,45 +0,0 @@ ---- -os: linux -dist: xenial -language: ruby -cache: bundler -before_install: - - bundle -v - - rm -f Gemfile.lock - - "# Update system gems if requested. This is useful to temporarily workaround troubles in the test runner" - - "# See https://github.com/puppetlabs/pdk-templates/commit/705154d5c437796b821691b707156e1b056d244f for an example of how this was used" - - "# Ignore exit code of SIGPIPE'd yes to not fail with shell's pipefail set" - - '[ -z "$RUBYGEMS_VERSION" ] || (yes || true) | gem update --system $RUBYGEMS_VERSION' - - gem --version - - bundle -v -script: - - 'SIMPLECOV=yes bundle exec rake $CHECK' -bundler_args: --without system_tests -rvm: - - 2.5.7 -stages: - - static - - spec - - acceptance - - - if: tag =~ ^v\d - name: deploy -jobs: - fast_finish: true - include: - - - env: CHECK="validate lint check rubocop" - stage: static - - - env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec - rvm: 2.5.7 - stage: spec - - - env: DEPLOY_TO_FORGE=yes - stage: deploy -branches: - only: - - main - - /^v\d/ -notifications: - email: false diff --git a/.vscode/extensions.json b/.vscode/extensions.json deleted file mode 100644 index 6da8d47..0000000 --- a/.vscode/extensions.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "recommendations": [ - "puppet.puppet-vscode", - "Shopify.ruby-lsp" - ] -} diff --git a/.yamllint b/.yamllint new file mode 100644 index 0000000..4d35faa --- /dev/null +++ b/.yamllint @@ -0,0 +1,11 @@ +--- +extends: default + +ignore: | + bin/ + spec/fixtures/* + +rules: + # 80 chars should be enough, but don't fail if a line is longer + line-length: + max: 140 diff --git a/.yardopts b/.yardopts deleted file mode 100644 index 29c933b..0000000 --- a/.yardopts +++ /dev/null @@ -1 +0,0 @@ ---markup markdown diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a109851 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,126 @@ +# Changelog cirrax-postfixadmin + + +## Version: 1.5.1 (25 September 2025) +* update metadata, rebuild REFERENCE ([822f111](https://github.com/cirrax/puppet-postfixadmin/commit/822f11142e172505fe0a96e802ba2e44972279ad)) +* fixes (lint/rubocop) ([b61fc55](https://github.com/cirrax/puppet-postfixadmin/commit/b61fc555f9dfac3a5ded99228fe965abcaff7eea)) +* remove pdk, go towards openvox ([29d3f75](https://github.com/cirrax/puppet-postfixadmin/commit/29d3f75ad4891dbe544882a3932b57a0b211bd67)) + +## Version: v1.5.0 (25 December 2024) +* [blacksmith] Bump version to 1.5.0 ([2b1626d](https://github.com/cirrax/puppet-postfixadmin/commit/2b1626d0849b72d22fa7d3bfb67da2db9559bc8a)) +* update REFERENCE ([99d60e8](https://github.com/cirrax/puppet-postfixadmin/commit/99d60e8b2f1180835819b801659af7074e94fb3d)) +* update pdk ([de6f1d0](https://github.com/cirrax/puppet-postfixadmin/commit/de6f1d0cedd338cd9b7a305acb39da8c80429cd7)) +* add parameter for mysql db collate/charset ([f7afd1b](https://github.com/cirrax/puppet-postfixadmin/commit/f7afd1b636d05f02e1517eaf875660a45726bfae)) + +## Version: v1.4.0 (7 December 2024) +* [blacksmith] Bump version to 1.4.0 ([4ad3a26](https://github.com/cirrax/puppet-postfixadmin/commit/4ad3a26c1beecf47aae1f60a8dc984faaaefacc6)) +* update REFERENCE ([f1d2ec5](https://github.com/cirrax/puppet-postfixadmin/commit/f1d2ec5a8bc619ce6a219b97581abd8613c00045)) +* fix: do not change dbconfig ([eb1b303](https://github.com/cirrax/puppet-postfixadmin/commit/eb1b30398481ac06515825181eb5aae624f0eebb)) +* add missing datatypes ([5c39d69](https://github.com/cirrax/puppet-postfixadmin/commit/5c39d69f78fddd60c25cc1c2ebaf31db26bff66d)) +* use undef instead of '' for password default in postfixadmin::cli::create_admin ([a8f3ec3](https://github.com/cirrax/puppet-postfixadmin/commit/a8f3ec347e1093c21ffeaf2e684e409d718cf0c0)) +* switch '' for target_domain parameter to undef ([f0a4ca2](https://github.com/cirrax/puppet-postfixadmin/commit/f0a4ca22d58895e3ade7510706c54087f06ad417)) +* postfixadmin::db: make basepath optional ([d03155e](https://github.com/cirrax/puppet-postfixadmin/commit/d03155ed7dbb8e627b7defc45f35d6db5782b014)) +* improce spec test for install ([1982832](https://github.com/cirrax/puppet-postfixadmin/commit/19828326e54613c8ff715e45a9a876ba747291e0)) +* update apache vhost datatypes for newer module versions ([5ffc324](https://github.com/cirrax/puppet-postfixadmin/commit/5ffc324dcd1a6aee867beb88b3944b1e40298dd3)) +* use undef instead of '' for defaults in postfixadmin::queries::dovecot ([925fc54](https://github.com/cirrax/puppet-postfixadmin/commit/925fc54fa852dad95b86ac2fede4796280bff989)) +* add github actions ([0c4c567](https://github.com/cirrax/puppet-postfixadmin/commit/0c4c567cc21580480a0835ee37ae699330fa059b)) +* use forge for fixtures ([7a7b796](https://github.com/cirrax/puppet-postfixadmin/commit/7a7b796fc15399fe78ff7c854662cc217df6fe4e)) +* pdk validate -a ([20dd960](https://github.com/cirrax/puppet-postfixadmin/commit/20dd960b61b80a541b67523ce290a222abfb7df0)) +* update pdk ([bdac646](https://github.com/cirrax/puppet-postfixadmin/commit/bdac6468755ec4dda7f183f0f9e090f960c0ceea)) + +## Version: v1.3.0 (27 February 2022) +* [blacksmith] Bump version to 1.3.0 ([3e4caab](https://github.com/cirrax/puppet-postfixadmin/commit/3e4caabda05543384b04c30fa1144a5e69044705)) +* add doc for postfixadmin_generate_pw ([7e5b6a3](https://github.com/cirrax/puppet-postfixadmin/commit/7e5b6a32aafb00005e86cadb98caa9de8785e4c7)) +* update pdk ([5611fb6](https://github.com/cirrax/puppet-postfixadmin/commit/5611fb69e21893657d160cc588f5f6249e729ee3)) +* fix dict dovecot template ([847bd0c](https://github.com/cirrax/puppet-postfixadmin/commit/847bd0cb934dbd7ffb3b90ee2e95c739c20224b0)) + +## Version: v1.2.9 (18 January 2022) +* [blacksmith] Bump version to 1.2.9 ([aeb2706](https://github.com/cirrax/puppet-postfixadmin/commit/aeb270620c983caebd21e4ce7512ea5925d85826)) +* add additional parameter for db host in configfile ([d64e722](https://github.com/cirrax/puppet-postfixadmin/commit/d64e7227ab3683816431c4b49ca335a569b770bd)) + +## Version: v1.2.8 (4 January 2022) +* [blacksmith] Bump version to 1.2.8 ([6347a60](https://github.com/cirrax/puppet-postfixadmin/commit/6347a6080debb950b6a6372bd4f0199cb7a89dfc)) +* fix creation of superadmin ([8a63653](https://github.com/cirrax/puppet-postfixadmin/commit/8a636536c7350fd41c0dca95a23fddd619db404d)) + +## Version: v1.2.7 (5 December 2021) +* [blacksmith] Bump version to 1.2.7 ([1c239c9](https://github.com/cirrax/puppet-postfixadmin/commit/1c239c99e934a7f03ecd4ce595cc572170982992)) +* update REFERENCE ([f9c44cb](https://github.com/cirrax/puppet-postfixadmin/commit/f9c44cba9eff1d540d2767f3962bf106687e9042)) +* Readme: add remark about Debian bullseye ([c47ad5f](https://github.com/cirrax/puppet-postfixadmin/commit/c47ad5fcb80f30b570afb389011764424f29b87c)) +* update metadata ([7dea4fd](https://github.com/cirrax/puppet-postfixadmin/commit/7dea4fdeae6beb8b2254ec7f2fd408a052d8cb77)) +* remove postfixadmin::params class, add hiera.yaml ([662045a](https://github.com/cirrax/puppet-postfixadmin/commit/662045a8abc12bc4d938b65ce6f15023c4b4dd2b)) +* update pdk ([a567c82](https://github.com/cirrax/puppet-postfixadmin/commit/a567c82b34f5ff9bb67c3c6ed9b5048a4c622a16)) + +## Version: v1.2.6 (28 January 2021) +* [blacksmith] Bump version to 1.2.6 ([31c70c3](https://github.com/cirrax/puppet-postfixadmin/commit/31c70c301e77de6e72b4485e5e534aa8ab1cec18)) +* adapt metadata for puppet 7 ([f90f9d2](https://github.com/cirrax/puppet-postfixadmin/commit/f90f9d2641c5611e90d24a3717b4dab5d8770da2)) +* Update README.md ([21d1856](https://github.com/cirrax/puppet-postfixadmin/commit/21d1856843d26bd8f312338a59744f8f8bf4e97e)) +* Add mysqli db type for Debian Buster compatibility ([8691951](https://github.com/cirrax/puppet-postfixadmin/commit/8691951e1bcbc8afef1f13ee695c7816abc55d09)) +* add parameter for vhost port ([5372b60](https://github.com/cirrax/puppet-postfixadmin/commit/5372b601f3e59a6b0b1b5b2838bea3c0cba15703)) +* update pdk ([b422fd2](https://github.com/cirrax/puppet-postfixadmin/commit/b422fd28bd6f7933d6079f5d01d4124cca5b56fe)) +* Merge pull request #4 from cirrax/dev_cirrax ([b21f2ce](https://github.com/cirrax/puppet-postfixadmin/commit/b21f2ce4cb0545b6963146eb85d03c15db9a5ab6)) +* use strings for module documentation ([f57ccc3](https://github.com/cirrax/puppet-postfixadmin/commit/f57ccc3f684da01558d8e031b297bd5f1b477d1b)) +* update pdk ([cb96448](https://github.com/cirrax/puppet-postfixadmin/commit/cb96448dfdc97a1ff7480b5a2cc7c8577f53f53f)) + +## Version: v1.2.5 (21 August 2019) +* [blacksmith] Bump version to 1.2.5 ([20f1561](https://github.com/cirrax/puppet-postfixadmin/commit/20f1561be43b157c46edbeb3dc8619c8ae80f970)) +* update requirements versions ([df18cfc](https://github.com/cirrax/puppet-postfixadmin/commit/df18cfc84af3697649e116039ffccfb224df25e6)) +* activate coverage report ([8d8b0aa](https://github.com/cirrax/puppet-postfixadmin/commit/8d8b0aa841c24a0d144c3f56f6655ca12644cdae)) +* loop all supported os'es for spec tests ([8445fe2](https://github.com/cirrax/puppet-postfixadmin/commit/8445fe246ad7ac1cee8e227382803dff12d9c482)) +* make rubocop and lint happy ([b36a2fa](https://github.com/cirrax/puppet-postfixadmin/commit/b36a2fac8c76c2507c1da4467e2023a946abc8d0)) +* pdk convert ([160d30f](https://github.com/cirrax/puppet-postfixadmin/commit/160d30fca8d6515aa3ee788dafecbb4578ddbe67)) + +## Version: v1.2.4 (4 April 2019) +* [blacksmith] Bump version to 1.2.4 ([0a606bb](https://github.com/cirrax/puppet-postfixadmin/commit/0a606bbd425f1b4b54be5b54c33e7844c390ade3)) +* allow account as a valid sender address for postfix ([83b81e5](https://github.com/cirrax/puppet-postfixadmin/commit/83b81e5b868bfa86bae240b74c9392c86c5073f0)) + +## Version: v1.2.3 (20 March 2019) +* [blacksmith] Bump version to 1.2.3 ([dc2c13a](https://github.com/cirrax/puppet-postfixadmin/commit/dc2c13ac14ed9ca98859ff35ac0cc8d4c4702449)) +* fix domain creation for inactive domains ([db30393](https://github.com/cirrax/puppet-postfixadmin/commit/db30393312d1fbb43510cd7d9b36b1b16cac801e)) +* fix typo in comment ([2606469](https://github.com/cirrax/puppet-postfixadmin/commit/2606469dd24c5e621b0d15b4e0979c7ba8313899)) + +## Version: v1.2.2 (28 February 2019) +* [blacksmith] Bump version to 1.2.2 ([8a79818](https://github.com/cirrax/puppet-postfixadmin/commit/8a79818c12af809278542522f72d718b98e73307)) +* fix spec tests "Unknown variable: 'mysql::params::exec_path'" ([15e895d](https://github.com/cirrax/puppet-postfixadmin/commit/15e895d8abd231acca65c9792f0e5a9671eb7aa0)) +* fix lint check ([f21fa00](https://github.com/cirrax/puppet-postfixadmin/commit/f21fa004b9574a72b3b8bdd444d53afb59494633)) +* update tests and requirement for puppet 6 ([d619883](https://github.com/cirrax/puppet-postfixadmin/commit/d619883af3c50020987ba9c12d1719501f16ed9a)) +* fix dependencies to dovecot/postfix class ([1a002f9](https://github.com/cirrax/puppet-postfixadmin/commit/1a002f9e6501acd2732d3286555ea3baea4e40fc)) + +## Version: v1.2.1 (25 March 2018) +* [blacksmith] Bump version to 1.2.1 ([1d43a4d](https://github.com/cirrax/puppet-postfixadmin/commit/1d43a4dd576b8977e897b270481b645daa691804)) +* add iterate_query for dovecot ([95d452c](https://github.com/cirrax/puppet-postfixadmin/commit/95d452c8c8e182b6fe72e3d63880a5ca26225da1)) + +## Version: v1.2.0 (20 March 2018) +* [blacksmith] Bump version to 1.2.0 ([d00a405](https://github.com/cirrax/puppet-postfixadmin/commit/d00a40522b0d4d4cafa9f1771c744fd393c7f6ab)) +* add mysql_sender_access query for postfix ([2f4df47](https://github.com/cirrax/puppet-postfixadmin/commit/2f4df479bd31ac1af61d457454704fe39085aa16)) +* add parameter to install additional packages ([0b0b790](https://github.com/cirrax/puppet-postfixadmin/commit/0b0b790ddd9907d484c3f5970d278e77657d9b55)) + +## Version: v1.1.1 (12 March 2018) +* add mysql_virtual_domains_no_srs_maps map ([99b76e0](https://github.com/cirrax/puppet-postfixadmin/commit/99b76e0d242e90388a78f0dc3cf73755aecf3b1a)) + +## Version: v1.1.0 (10 March 2018) +* [blacksmith] Bump version to 1.1.0 ([3b33cb8](https://github.com/cirrax/puppet-postfixadmin/commit/3b33cb8214928332e625c53bfefc85da86a2b0fd)) +* remove travis tests for puppet 3.8 ([0462546](https://github.com/cirrax/puppet-postfixadmin/commit/0462546066141597a1e166032a46f40e9170305a)) +* add spec test for postfixadmin::vhost::apache ([d98c77e](https://github.com/cirrax/puppet-postfixadmin/commit/d98c77ecb434ad5ef49b8842e10b3ee3f3dc9ed9)) +* change parameter $type to $vhosttype ([34b0bae](https://github.com/cirrax/puppet-postfixadmin/commit/34b0bae35b613bc3aee95a45477eda2bdbefa2e0)) +* change parameter name $type to $dbtype ([f6784f2](https://github.com/cirrax/puppet-postfixadmin/commit/f6784f27b3a31406772facb9d346e89f5e77ec2c)) +* fix vhost spec tests ([cd1e1c3](https://github.com/cirrax/puppet-postfixadmin/commit/cd1e1c3c4ed1f40e4f9a3706ce6cb054a412eddd)) +* change comment in php ([6c3ab1f](https://github.com/cirrax/puppet-postfixadmin/commit/6c3ab1f6cde5f9f974a46287c71261368a6dadee)) +* manage dbconfig.inc ([cfbdc48](https://github.com/cirrax/puppet-postfixadmin/commit/cfbdc48afdbe20bc4bbac08a5750ae6a3efa4a85)) +* add sendmail parameter on admin creation ([9887af4](https://github.com/cirrax/puppet-postfixadmin/commit/9887af452effe642cc778341dd96db7734b1d50d)) +* use integers for cli/create_domain ([3ced964](https://github.com/cirrax/puppet-postfixadmin/commit/3ced9643f84164a4641884ffae3dba89035b24d5)) +* add type for parameters ([6b43ab7](https://github.com/cirrax/puppet-postfixadmin/commit/6b43ab7caf786ea7e4a43489472bca92a76839f5)) +* add define to create domain with cli ([e22396a](https://github.com/cirrax/puppet-postfixadmin/commit/e22396a078b9739226d9ecc5f888c9ea509695a4)) +* do not use special caracters to generate password ([c9758af](https://github.com/cirrax/puppet-postfixadmin/commit/c9758afb54e2d398dc3c4b9bad9a370d8d1130a9)) +* remove double comment ([845ffb7](https://github.com/cirrax/puppet-postfixadmin/commit/845ffb7fb23ea17e4d04a5d5718e92e1361951cb)) +* fix typo in metadata.json ([3b765e8](https://github.com/cirrax/puppet-postfixadmin/commit/3b765e87c13542f6ae4af99bea685112491dea87)) + +## Version: v1.0.3 (17 February 2018) +* [blacksmith] Bump version to 1.0.3 ([eecef06](https://github.com/cirrax/puppet-postfixadmin/commit/eecef06630bab906ec6bfb0f1e8c0412fb061dbd)) +* need puppet version 4 (or future parser ...) ([9c8bd77](https://github.com/cirrax/puppet-postfixadmin/commit/9c8bd774f7ed2946f4a01d097e410c35d48b630b)) +* add authors to README ([9b76d26](https://github.com/cirrax/puppet-postfixadmin/commit/9b76d26dc30cbeecfe3edc2114d7371b1a1ae397)) +* fix README ([8b0f221](https://github.com/cirrax/puppet-postfixadmin/commit/8b0f221287f9e50a9053ea367beb89e1690c8c78)) + +## Version: v1.0.2 (9 February 2018) +* [blacksmith] Bump version to 1.0.2 ([90733a2](https://github.com/cirrax/puppet-postfixadmin/commit/90733a2a1bfd3a7ab6944585525f4881de176446)) +* add .gitignore ([05875d0](https://github.com/cirrax/puppet-postfixadmin/commit/05875d01aba0d629d207d26b8dca24756d221fe4)) +* add blacksmith to Rakefile ([83d6a0f](https://github.com/cirrax/puppet-postfixadmin/commit/83d6a0fd9984053c4b0fc5bb0d7539d1cab86b4a)) \ No newline at end of file diff --git a/Gemfile b/Gemfile deleted file mode 100644 index dc6cbe0..0000000 --- a/Gemfile +++ /dev/null @@ -1,81 +0,0 @@ -source ENV['GEM_SOURCE'] || 'https://rubygems.org' - -def location_for(place_or_version, fake_version = nil) - git_url_regex = %r{\A(?(https?|git)[:@][^#]*)(#(?.*))?} - file_url_regex = %r{\Afile:\/\/(?.*)} - - if place_or_version && (git_url = place_or_version.match(git_url_regex)) - [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact - elsif place_or_version && (file_url = place_or_version.match(file_url_regex)) - ['>= 0', { path: File.expand_path(file_url[:path]), require: false }] - else - [place_or_version, { require: false }] - end -end - -group :development do - gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.3.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.5.1', require: false if Gem::Requirement.create(['>= 3.0.0', '< 3.0.5']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.1', require: false if Gem::Requirement.create(['>= 3.1.0', '< 3.1.3']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "json", '= 2.6.3', require: false if Gem::Requirement.create(['>= 3.2.0', '< 4.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "racc", '~> 1.4.0', require: false if Gem::Requirement.create(['>= 2.7.0', '< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "deep_merge", '~> 1.2.2', require: false - gem "voxpupuli-puppet-lint-plugins", '~> 5.0', require: false - gem "facterdb", '~> 2.1', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "facterdb", '~> 3.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "metadata-json-lint", '~> 4.0', require: false - gem "json-schema", '< 5.1.1', require: false - gem "rspec-puppet-facts", '~> 4.0', require: false if Gem::Requirement.create(['< 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "rspec-puppet-facts", '~> 5.0', require: false if Gem::Requirement.create(['>= 3.0.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup)) - gem "dependency_checker", '~> 1.0.0', require: false - gem "parallel_tests", '= 3.12.1', require: false - gem "pry", '~> 0.10', require: false - gem "simplecov-console", '~> 0.9', require: false - gem "puppet-debugger", '~> 1.0', require: false - gem "rubocop", '~> 1.50.0', require: false - gem "rubocop-performance", '= 1.16.0', require: false - gem "rubocop-rspec", '= 2.19.0', require: false - gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] -end -group :development, :release_prep do - gem "puppet-strings", '~> 4.0', require: false - gem "puppetlabs_spec_helper", '~> 8.0', require: false - gem "puppet-blacksmith", '~> 7.0', require: false -end -group :system_tests do - gem "puppet_litmus", '~> 1.0', require: false, platforms: [:ruby, :x64_mingw] - gem "CFPropertyList", '< 3.0.7', require: false, platforms: [:mswin, :mingw, :x64_mingw] - gem "serverspec", '~> 2.41', require: false -end - -puppet_version = ENV['PUPPET_GEM_VERSION'] -facter_version = ENV['FACTER_GEM_VERSION'] -hiera_version = ENV['HIERA_GEM_VERSION'] - -gems = {} - -gems['puppet'] = location_for(puppet_version) - -# If facter or hiera versions have been specified via the environment -# variables - -gems['facter'] = location_for(facter_version) if facter_version -gems['hiera'] = location_for(hiera_version) if hiera_version - -gems.each do |gem_name, gem_params| - gem gem_name, *gem_params -end - -# Evaluate Gemfile.local and ~/.gemfile if they exist -extra_gemfiles = [ - "#{__FILE__}.local", - File.join(Dir.home, '.gemfile'), -] - -extra_gemfiles.each do |gemfile| - if File.file?(gemfile) && File.readable?(gemfile) - eval(File.read(gemfile), binding) - end -end -# vim: syntax=ruby diff --git a/README.md b/README.md index 9f489cf..9e7e359 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,5 @@ # postfixadmin puppet module -[![Build Status](https://travis-ci.org/cirrax/puppet-postfixadmin.svg?branch=master)](https://travis-ci.org/cirrax/puppet-postfixadmin) -[![Puppet Forge](https://img.shields.io/puppetforge/v/cirrax/postfixadmin.svg?style=flat-square)](https://forge.puppetlabs.com/cirrax/postfixadmin) -[![Puppet Forge](https://img.shields.io/puppetforge/dt/cirrax/postfixadmin.svg?style=flat-square)](https://forge.puppet.com/cirrax/postfixadmin) -[![Puppet Forge](https://img.shields.io/puppetforge/e/cirrax/postfixadmin.svg?style=flat-square)](https://forge.puppet.com/cirrax/postfixadmin) -[![Puppet Forge](https://img.shields.io/puppetforge/f/cirrax/postfixadmin.svg?style=flat-square)](https://forge.puppet.com/cirrax/postfixadmin) #### Table of Contents @@ -22,7 +17,7 @@ It assumes, you are using hiera to configure. Just include the postfixadmin class and add some hiera definitions.... -Details about the configuration possibilities are documented in the classes or in +Details about the configuration possibilities are documented in the classes or in the [REFERENCE](https://github.com/cirrax/puppet-postfixadmin/blob/master/REFERENCE.md) file. ### Remark for Debian bullseye (11) @@ -57,7 +52,7 @@ postfixadmin::admins: #send_mail: true # does not work out of the box, needs a mailer installed -postfixadmin::domains: +postfixadmin::domains: example.com: domain: 'example.com' diff --git a/REFERENCE.md b/REFERENCE.md index 278d2aa..f506be8 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1124,5 +1124,5 @@ computes a random password string computes a random password string -Returns: `String` a random password st +Returns: `String` a random password diff --git a/Rakefile b/Rakefile index 31b5930..6426026 100644 --- a/Rakefile +++ b/Rakefile @@ -1,18 +1,40 @@ -# frozen_string_literal: true +begin + require 'voxpupuli/test/rake' +rescue LoadError + begin + require 'puppetlabs_spec_helper/rake_tasks' + rescue LoadError + end +end -require 'bundler' -require 'puppet_litmus/rake_tasks' if Gem.loaded_specs.key? 'puppet_litmus' -require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-syntax/tasks/puppet-syntax' -require 'puppet-strings/tasks' if Gem.loaded_specs.key? 'puppet-strings' +require 'puppet_blacksmith/rake_tasks' -PuppetLint.configuration.send('disable_relative') -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.send('disable_140chars') -PuppetLint.configuration.send('disable_class_inherits_from_params_class') -PuppetLint.configuration.send('disable_autoloader_layout') -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_single_quote_string_with_variables') -PuppetLint.configuration.fail_on_warnings = true -PuppetLint.configuration.ignore_paths = [".vendor/**/*.pp", ".bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp", "tests/**/*.pp", "types/**/*.pp", "vendor/**/*.pp"] +desc 'run autocorrection tasks' +task :fix do + puts "--------\nrunning: rake lint_fix" + Rake::Task["lint_fix"].invoke + puts "--------\nrunning: rake rubocop:autocorrect" + Rake::Task["rubocop:autocorrect"].invoke +end +Rake::Task["test"].clear +desc 'run several tests in one run' +task :test do + puts "--------\nrunning: rake validate" + Rake::Task["validate"].invoke + puts "--------\nrunning: rake check" + Rake::Task["check"].invoke + puts "--------\nrunning: rake lint" + Rake::Task["lint"].invoke + puts "--------\nrunning: yamllint" + fail unless system('yamllint .') + puts "--------\nrunning: rake rubocop" + Rake::Task["rubocop"].invoke + puts "--------\nrunning: rake strings:validate:reference" + Rake::Task["strings:validate:reference"].invoke +end + +# flag out some things we never use +Rake::Task["strings:gh_pages:update"].clear + +# vim: syntax=ruby diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index a70c01e..0000000 --- a/appveyor.yml +++ /dev/null @@ -1,49 +0,0 @@ ---- -version: 1.1.x.{build} -skip_branch_with_pr: true -branches: - only: - - main - - release -skip_commits: - message: /^\(?doc\)?.*/ -clone_depth: 10 -init: - - SET - - 'mkdir C:\ProgramData\PuppetLabs\code && exit 0' - - 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0' - - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0' - - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0' -environment: - matrix: - - - RUBY_VERSION: 25-x64 - CHECK: validate lint check rubocop - - - PUPPET_GEM_VERSION: ~> 6.0 - RUBY_VERSION: 25 - CHECK: parallel_spec - - - PUPPET_GEM_VERSION: ~> 6.0 - RUBY_VERSION: 25-x64 - CHECK: parallel_spec -matrix: - fast_finish: true -install: - - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH% - - bundle install --jobs 4 --retry 2 --without system_tests - - type Gemfile.lock -build: off -test_script: - - bundle exec puppet -V - - ruby -v - - gem -v - - bundle -v - - bundle exec rake %CHECK% -notifications: - - provider: Email - to: - - nobody@nowhere.com - on_build_success: false - on_build_failure: false - on_build_status_changed: false diff --git a/data/common.yaml b/data/common.yaml index 8d01f0c..0a34d18 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -1,4 +1,2 @@ --- {} # postfixadmin module: common.yaml -# - diff --git a/lib/puppet/parser/functions/postfixadmin_generate_pw.rb b/lib/puppet/parser/functions/postfixadmin_generate_pw.rb index 32afe23..0b22c0e 100644 --- a/lib/puppet/parser/functions/postfixadmin_generate_pw.rb +++ b/lib/puppet/parser/functions/postfixadmin_generate_pw.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + module Puppet::Parser::Functions newfunction(:postfixadmin_generate_pw, type: :rvalue, doc: <<-DOC) do |_args| @summary computes a random password string @return [String] a random password string - DOC + DOC charset = (0..9).to_a + ('A'..'Z').to_a + ('a'..'z').to_a (0...10).map { charset.to_a[rand(charset.size)] }.join end diff --git a/metadata.json b/metadata.json index c2c3418..07cee8e 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "cirrax-postfixadmin", - "version": "1.5.0", + "version": "1.5.1", "author": "Cirrax GmbH", "summary": "A module to configure postfixadmin", "license": "GPL-3.0", @@ -10,19 +10,19 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 3.2.0 < 9.0.0" + "version_requirement": ">= 3.2.0 < 10.0.0" }, { "name": "puppetlabs/concat", - "version_requirement": ">= 2.0.0 < 8.0.0" + "version_requirement": ">= 2.0.0 < 10.0.0" }, { "name": "puppetlabs/apache", - "version_requirement": ">= 8.0.0 < 13.0.0" + "version_requirement": ">= 8.0.0 < 14.0.0" }, { "name": "puppetlabs/mysql", - "version_requirement": ">= 4.0.0 < 13.0.0" + "version_requirement": ">= 4.0.0 < 17.0.0" } ], "operatingsystem_support": [ @@ -32,7 +32,9 @@ "8", "9", "10", - "11" + "11", + "12", + "13" ] }, { @@ -41,8 +43,8 @@ ], "requirements": [ { - "name": "puppet", - "version_requirement": ">=4.0.0 < 8.0.0" + "name": "openvox", + "version_requirement": ">=8.0.0 < 9.0.0" } ], "tags": [ @@ -52,8 +54,5 @@ "mta", "email", "dovecot" - ], - "pdk-version": "3.4.0", - "template-url": "https://github.com/puppetlabs/pdk-templates#main", - "template-ref": "heads/main-0-gd5f5ac1" + ] } diff --git a/pdk.yaml b/pdk.yaml deleted file mode 100644 index 4bef4bd..0000000 --- a/pdk.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -ignore: [] diff --git a/spec/classes/cli_params_spec.rb b/spec/classes/cli_params_spec.rb index 7b55501..2be4657 100644 --- a/spec/classes/cli_params_spec.rb +++ b/spec/classes/cli_params_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::cli::params' do diff --git a/spec/classes/config_spec.rb b/spec/classes/config_spec.rb index 50311af..6beb8dc 100644 --- a/spec/classes/config_spec.rb +++ b/spec/classes/config_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::config' do @@ -19,6 +21,7 @@ .with_mode(params[:mode]) } end + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } @@ -37,7 +40,7 @@ config_file: '/tmp/test', owner: 'someone', group: 'somegroup', - mode: '4242', + mode: '4242' ) end diff --git a/spec/classes/db_mysql_spec.rb b/spec/classes/db_mysql_spec.rb index 2aa6546..b4d5362 100644 --- a/spec/classes/db_mysql_spec.rb +++ b/spec/classes/db_mysql_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::db::mysql' do @@ -32,13 +34,13 @@ it_behaves_like 'postfixadmin::db::mysql shared examples' end - context 'with non defaults' do + context 'with non defaults' do let :params do default_params.merge( dbname: 'mydb', dbuser: 'myuser', dbpass: 'secret-password', - host: 'myhost', + host: 'myhost' ) end diff --git a/spec/classes/db_spec.rb b/spec/classes/db_spec.rb index 504b01b..9643331 100644 --- a/spec/classes/db_spec.rb +++ b/spec/classes/db_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::db' do @@ -19,6 +21,7 @@ is_expected.to contain_class('postfixadmin::db::mysql') } end + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } @@ -40,7 +43,7 @@ context 'without dbconfig file' do let :params do default_params.merge( - dbconfig_inc: '', + dbconfig_inc: '' ) end diff --git a/spec/classes/fix_debian_bug_spec.rb b/spec/classes/fix_debian_bug_spec.rb index a580e18..aae412f 100644 --- a/spec/classes/fix_debian_bug_spec.rb +++ b/spec/classes/fix_debian_bug_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::fix_debian_bug' do diff --git a/spec/classes/install_spec.rb b/spec/classes/install_spec.rb index d91519c..a9229fa 100644 --- a/spec/classes/install_spec.rb +++ b/spec/classes/install_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::install' do @@ -41,7 +43,7 @@ let :params do default_params.merge( package_name: 'somepackage', - packages: ['additional', 'packages'], + packages: %w[additional packages] ) end diff --git a/spec/classes/postfixadmin_spec.rb b/spec/classes/postfixadmin_spec.rb index 1482416..ce837b8 100644 --- a/spec/classes/postfixadmin_spec.rb +++ b/spec/classes/postfixadmin_spec.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true require 'spec_helper' diff --git a/spec/classes/queries_dovecot_spec.rb b/spec/classes/queries_dovecot_spec.rb index 05be786..417ea5f 100644 --- a/spec/classes/queries_dovecot_spec.rb +++ b/spec/classes/queries_dovecot_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::queries::dovecot' do @@ -27,19 +29,20 @@ } it { - is_expected.to contain_file(params[:dir] + '/mysql_dovecot-sql.conf.ext') + is_expected.to contain_file("#{params[:dir]}/mysql_dovecot-sql.conf.ext") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } it { - is_expected.to contain_file(params[:dir] + '/mysql_dovecot-dict-quota.conf.ext') + is_expected.to contain_file("#{params[:dir]}/mysql_dovecot-dict-quota.conf.ext") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } end + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } @@ -52,14 +55,15 @@ it_behaves_like 'postfixadmin::queries::dovecot shared examples' it { - is_expected.to contain_file(params[:dir] + '/mysql_dovecot-sql.conf.ext') + is_expected.to contain_file("#{params[:dir]}/mysql_dovecot-sql.conf.ext") .with_content(%r{dbname=postfixadmin}) .with_content(%r{user=postfixadmin}) .with_content(%r{password=CHANGEME}) .with_content(%r{host=localhost}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_dovecot-dict-quota.conf.ext') + is_expected.to contain_file("#{params[:dir]}/mysql_dovecot-dict-quota.conf.ext") .with_content(%r{dbname=postfixadmin}) .with_content(%r{user=postfixadmin}) .with_content(%r{password=CHANGEME}) @@ -73,7 +77,7 @@ dir: '/tmp', owner: 'someone', group: 'somegroup', - mode: '4242', + mode: '4242' ) end @@ -86,20 +90,21 @@ dbname: 'mydb', dbuser: 'myuser', dbpass: 'secret-password', - host: 'myhost', + host: 'myhost' ) end it_behaves_like 'postfixadmin::queries::dovecot shared examples' it { - is_expected.to contain_file(params[:dir] + '/mysql_dovecot-sql.conf.ext') + is_expected.to contain_file("#{params[:dir]}/mysql_dovecot-sql.conf.ext") .with_content(%r{dbname=mydb}) .with_content(%r{user=myuser}) .with_content(%r{password=secret-password}) .with_content(%r{host=myhost}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_dovecot-dict-quota.conf.ext') + is_expected.to contain_file("#{params[:dir]}/mysql_dovecot-dict-quota.conf.ext") .with_content(%r{dbname=mydb}) .with_content(%r{user=myuser}) .with_content(%r{password=secret-password}) diff --git a/spec/classes/queries_postfix_spec.rb b/spec/classes/queries_postfix_spec.rb index 1abc7e5..a7c53d6 100644 --- a/spec/classes/queries_postfix_spec.rb +++ b/spec/classes/queries_postfix_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::queries::postfix' do @@ -24,49 +26,56 @@ } it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_catchall_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_catchall_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_mailbox_limit_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_mailbox_limit_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_domains_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_domains_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_mailbox_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_mailbox_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_mailbox_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_mailbox_maps.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_sender_access.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_sender_access.cf") .with_owner(params[:owner]) .with_group(params[:group]) .with_mode(params[:mode]) @@ -84,56 +93,63 @@ it_behaves_like 'postfixadmin::queries::postfix shared examples' it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_catchall_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_catchall_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_mailbox_limit_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_mailbox_limit_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_domains_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_domains_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_mailbox_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_mailbox_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_mailbox_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_mailbox_maps.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) .with_content(%r{^hosts = localhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_sender_access.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_sender_access.cf") .with_content(%r{^dbname = postfixadmin$}) .with_content(%r{^user = postfixadmin$}) .with_content(%r{^password = CHANGEME$}) @@ -147,7 +163,7 @@ dir: '/tmp', owner: 'someone', group: 'somegroup', - mode: '4242', + mode: '4242' ) end @@ -160,62 +176,69 @@ dbname: 'mydb', dbuser: 'myuser', dbpass: 'secret-password', - hosts: ['myhost'], + hosts: ['myhost'] ) end it_behaves_like 'postfixadmin::queries::postfix shared examples' it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_catchall_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_catchall_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_mailbox_limit_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_mailbox_limit_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_domains_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_domains_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_mailbox_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_mailbox_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_virtual_alias_domain_mailbox_maps.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_virtual_alias_domain_mailbox_maps.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) .with_content(%r{^hosts = myhost$}) } + it { - is_expected.to contain_file(params[:dir] + '/mysql_sender_access.cf') + is_expected.to contain_file("#{params[:dir]}/mysql_sender_access.cf") .with_content(%r{^dbname = mydb$}) .with_content(%r{^user = myuser$}) .with_content(%r{^password = secret-password$}) diff --git a/spec/classes/vhost_apache_spec.rb b/spec/classes/vhost_apache_spec.rb index 88b38e7..2e37d1b 100644 --- a/spec/classes/vhost_apache_spec.rb +++ b/spec/classes/vhost_apache_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::vhost::apache' do diff --git a/spec/classes/vhost_spec.rb b/spec/classes/vhost_spec.rb index fc1cdf2..b9318ce 100644 --- a/spec/classes/vhost_spec.rb +++ b/spec/classes/vhost_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::vhost' do diff --git a/spec/default_facts.yml b/spec/default_facts.yml deleted file mode 100644 index 3346c39..0000000 --- a/spec/default_facts.yml +++ /dev/null @@ -1,9 +0,0 @@ -# Use default_module_facts.yml for module specific facts. -# -# Facts specified here will override the values provided by rspec-puppet-facts. ---- -networking: - ip: "172.16.254.254" - ip6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" - mac: "AA:AA:AA:AA:AA:AA" -is_pe: false diff --git a/spec/defines/cli_create_admin_spec.rb b/spec/defines/cli_create_admin_spec.rb index a738413..7a13228 100644 --- a/spec/defines/cli_create_admin_spec.rb +++ b/spec/defines/cli_create_admin_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::cli::create_admin' do @@ -12,7 +14,7 @@ it { is_expected.to contain_class('postfixadmin::cli::params') } it { - is_expected.to contain_exec('postfixadmin create_admin ' + params[:admin]) + is_expected.to contain_exec("postfixadmin create_admin #{params[:admin]}") .with_command(%r{ admin add }) .with_unless(%r{ admin view }) } @@ -31,7 +33,7 @@ it_behaves_like 'postfixadmin::cli::create_admin shared examples' it { - is_expected.to contain_exec('postfixadmin create_admin ' + params[:admin]) + is_expected.to contain_exec("postfixadmin create_admin #{params[:admin]}") .with_command(%r{ mytitle }) .without_command(%r{--superadmin}) .with_unless(%r{ mytitle|}) @@ -43,13 +45,13 @@ let :params do default_params.merge( admin: 'someotheradmin', - password: 'secret', + password: 'secret' ) end it_behaves_like 'postfixadmin::cli::create_admin shared examples' it { - is_expected.to contain_exec('postfixadmin create_admin ' + params[:admin]) + is_expected.to contain_exec("postfixadmin create_admin #{params[:admin]}") .with_command(%r{ someotheradmin }) .with_command(%r{ --password secret --password2 secret}) .with_unless(%r{ someotheradmin|}) @@ -60,14 +62,14 @@ let(:title) { 'mytitle' } let :params do default_params.merge( - superadmin: true, + superadmin: true ) end it_behaves_like 'postfixadmin::cli::create_admin shared examples' it { - is_expected.to contain_exec('postfixadmin create_admin ' + params[:admin]) + is_expected.to contain_exec("postfixadmin create_admin #{params[:admin]}") .with_command(%r{--superadmin}) } end diff --git a/spec/defines/cli_create_aliasdomain_spec.rb b/spec/defines/cli_create_aliasdomain_spec.rb index 6fa9224..fc8adf5 100644 --- a/spec/defines/cli_create_aliasdomain_spec.rb +++ b/spec/defines/cli_create_aliasdomain_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::cli::create_aliasdomain' do @@ -12,11 +14,12 @@ it { is_expected.to contain_class('postfixadmin::cli::params') } it { - is_expected.to contain_exec('postfixadmin create_aliasdomain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_aliasdomain #{params[:domain]}") .with_command(%r{ aliasdomain add }) .with_unless(%r{ aliasdomain view }) } end + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } @@ -25,14 +28,14 @@ let(:title) { 'mytitle.ch' } let :params do default_params.merge( - target_domain: 'mytarget.ch', + target_domain: 'mytarget.ch' ) end it_behaves_like 'postfixadmin::cli::create_aliasdomain shared examples' it { - is_expected.to contain_exec('postfixadmin create_aliasdomain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_aliasdomain #{params[:domain]}") .with_command(%r{ mytitle.ch }) .with_command(%r{ --target-domain mytarget.ch }) .with_unless(%r{ mytitle.ch|}) @@ -49,14 +52,14 @@ let :params do default_params.merge( domain: 'somewhere.ch', - target_domain: 'mytarget.ch', + target_domain: 'mytarget.ch' ) end it_behaves_like 'postfixadmin::cli::create_aliasdomain shared examples' it { - is_expected.to contain_exec('postfixadmin create_aliasdomain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_aliasdomain #{params[:domain]}") .with_command(%r{ somewhere.ch }) .with_command(%r{ --target-domain mytarget.ch }) .with_unless(%r{ somewhere.ch|}) @@ -68,7 +71,7 @@ let :params do default_params.merge( target_domain: 'mytarget.ch', - create_domain: false, + create_domain: false ) end diff --git a/spec/defines/cli_create_domain_spec.rb b/spec/defines/cli_create_domain_spec.rb index dd12e7a..ea6f95e 100644 --- a/spec/defines/cli_create_domain_spec.rb +++ b/spec/defines/cli_create_domain_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::cli::create_domain' do @@ -11,11 +13,12 @@ it { is_expected.to contain_class('postfixadmin::cli::params') } it { - is_expected.to contain_exec('postfixadmin create_domain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_domain #{params[:domain]}") .with_command(%r{ domain add }) .with_unless(%r{ domain view }) } end + on_supported_os.each do |os, os_facts| context "on #{os}" do let(:facts) { os_facts } @@ -25,14 +28,14 @@ let :params do default_params.merge( description: title, - domain: title, + domain: title ) end it_behaves_like 'postfixadmin::cli::create_domain shared examples' it { - is_expected.to contain_exec('postfixadmin create_domain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_domain #{params[:domain]}") .with_command(%r{ --description 'mytitle.ch' }) .with_command(%r{ mytitle.ch }) .with_command(%r{ --default-aliases|}) @@ -49,13 +52,13 @@ let :params do default_params.merge( domain: title, - default_aliases: false, + default_aliases: false ) end it_behaves_like 'postfixadmin::cli::create_domain shared examples' it { - is_expected.to contain_exec('postfixadmin create_domain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_domain #{params[:domain]}") .with_command(%r{ mytitle.ch }) .without_command(%r{--default-aliases}) } @@ -66,13 +69,13 @@ let :params do default_params.merge( domain: 'blah.ch', - description: 'Beschreibung', + description: 'Beschreibung' ) end it_behaves_like 'postfixadmin::cli::create_domain shared examples' it { - is_expected.to contain_exec('postfixadmin create_domain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_domain #{params[:domain]}") .with_command(%r{ --description 'Beschreibung' }) .with_command(%r{ blah.ch }) .with_unless(%r{ blah.ch|}) @@ -88,13 +91,13 @@ aliases: 11, mailboxes: 22, quota: 33, - maxquota: 44, + maxquota: 44 ) end it_behaves_like 'postfixadmin::cli::create_domain shared examples' it { - is_expected.to contain_exec('postfixadmin create_domain ' + params[:domain]) + is_expected.to contain_exec("postfixadmin create_domain #{params[:domain]}") .with_command(%r{ --aliases 11 }) .with_command(%r{ --mailboxes 22 }) .with_command(%r{ --quota 33 }) diff --git a/spec/defines/domain_spec.rb b/spec/defines/domain_spec.rb index 1bb79b7..6062f2f 100644 --- a/spec/defines/domain_spec.rb +++ b/spec/defines/domain_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' describe 'postfixadmin::domain' do @@ -10,6 +12,7 @@ shared_examples 'postfixadmin::domain shared examples' do it { is_expected.to compile.with_all_deps } end + context 'with defaults' do let(:title) { 'mytitle.ch' } let :params do @@ -30,7 +33,7 @@ let(:title) { 'mytitle.ch' } let :params do default_params.merge( - target_domain: 'mytarget.ch', + target_domain: 'mytarget.ch' ) end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index ae7c1f6..dfe83eb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,75 +1,6 @@ # frozen_string_literal: true -RSpec.configure do |c| - c.mock_with :rspec -end +require 'rspec/core' +require 'voxpupuli/test/spec_helper' -require 'puppetlabs_spec_helper/module_spec_helper' -require 'rspec-puppet-facts' - -require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb')) - -include RspecPuppetFacts - -default_facts = { - puppetversion: Puppet.version, - facterversion: Facter.version, -} - -default_fact_files = [ - File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')), - File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')), -] - -default_fact_files.each do |f| - next unless File.exist?(f) && File.readable?(f) && File.size?(f) - - begin - require 'deep_merge' - default_facts.deep_merge!(YAML.safe_load(File.read(f), permitted_classes: [], permitted_symbols: [], aliases: true)) - rescue StandardError => e - RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}" - end -end - -# read default_facts and merge them over what is provided by facterdb -default_facts.each do |fact, value| - add_custom_fact fact, value, merge_facts: true -end - -RSpec.configure do |c| - c.default_facts = default_facts - c.before :each do - # set to strictest setting for testing - # by default Puppet runs at warning level - Puppet.settings[:strict] = :warning - Puppet.settings[:strict_variables] = true - end - c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT'] - c.after(:suite) do - RSpec::Puppet::Coverage.report!(0) - end - - # Filter backtrace noise - backtrace_exclusion_patterns = [ - %r{spec_helper}, - %r{gems}, - ] - - if c.respond_to?(:backtrace_exclusion_patterns) - c.backtrace_exclusion_patterns = backtrace_exclusion_patterns - elsif c.respond_to?(:backtrace_clean_patterns) - c.backtrace_clean_patterns = backtrace_exclusion_patterns - end -end - -# Ensures that a module is defined -# @param module_name Name of the module -def ensure_module_defined(module_name) - module_name.split('::').reduce(Object) do |last_module, next_module| - last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false) - last_module.const_get(next_module, false) - end -end - -# 'spec_overrides' from sync.yml will appear below this line +Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f }