diff --git a/.devcontainer/README.md b/.devcontainer/README.md new file mode 100644 index 00000000..cc4675e5 --- /dev/null +++ b/.devcontainer/README.md @@ -0,0 +1,34 @@ +# 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 index f1a55dc3..fe7a8b12 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,23 +1,17 @@ -// 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 { "name": "Puppet Development Kit (Community)", "dockerFile": "Dockerfile", - // Set *default* container specific settings.json values on container create. "settings": { - "terminal.integrated.shell.linux": "/bin/bash" + "terminal.integrated.profiles.linux": { + "bash": { + "path": "bash", + } + } }, - // Add the IDs of extensions you want installed when the container is created. "extensions": [ "puppet.puppet-vscode", "rebornix.Ruby" ] - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - // "forwardPorts": [], - - // Use 'postCreateCommand' to run commands after the container is created. - // "postCreateCommand": "pdk --version", } diff --git a/.github/workflows/auto_release.yml b/.github/workflows/auto_release.yml index c25a80dc..f4aed440 100644 --- a/.github/workflows/auto_release.yml +++ b/.github/workflows/auto_release.yml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-20.04 steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -25,7 +26,6 @@ jobs: run: | echo STEP_ID="auto-release" >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: "Checkout Source" if: ${{ github.repository_owner == 'puppetlabs' }} uses: actions/checkout@v2 @@ -83,7 +83,7 @@ jobs: run: | echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" - + - name: "Honeycomb: Record finish step" if: ${{ always() }} run: | diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 865578cf..42816e7d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -4,18 +4,21 @@ on: schedule: - cron: '0 0 * * *' + env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests jobs: setup_matrix: + if: ${{ github.repository_owner == 'puppetlabs' }} name: "Setup Test Matrix" runs-on: ubuntu-20.04 outputs: matrix: ${{ steps.get-matrix.outputs.matrix }} steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -27,7 +30,6 @@ jobs: run: | echo STEP_ID=setup-environment >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 if: ${{ github.repository_owner == 'puppetlabs' }} @@ -45,29 +47,27 @@ jobs: echo ::group::bundler environment buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: - + - name: "Honeycomb: Record Setup Environment time" if: ${{ github.repository_owner == 'puppetlabs' }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Setup Acceptance Test Matrix id: get-matrix if: ${{ github.repository_owner == 'puppetlabs' }} run: | if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then - buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 else echo "::set-output name=matrix::{}" fi - + - name: "Honeycomb: Record Setup Test Matrix time" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' - Acceptance: name: "${{matrix.platforms.label}}, ${{matrix.collection}}" needs: @@ -187,7 +187,7 @@ jobs: buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' slack-workflow-status: - if: always() + if: ${{ github.repository_owner == 'puppetlabs' }} name: Post Workflow Status To Slack needs: - Acceptance @@ -200,5 +200,5 @@ jobs: repo_token: ${{ secrets.GITHUB_TOKEN }} slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }} # Optional Input - channel: '#team-ia-bots' + channel: '#team-cat-bots' name: 'GABot' diff --git a/.github/workflows/pr_test.yml b/.github/workflows/pr_test.yml index e37a1534..fd310e65 100644 --- a/.github/workflows/pr_test.yml +++ b/.github/workflows/pr_test.yml @@ -2,7 +2,9 @@ name: "PR Testing" on: [pull_request] + env: + HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests @@ -14,6 +16,7 @@ jobs: matrix: ${{ steps.get-matrix.outputs.matrix }} steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -25,7 +28,6 @@ jobs: run: | echo STEP_ID=setup-environment >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 if: ${{ github.repository_owner == 'puppetlabs' }} @@ -43,14 +45,13 @@ jobs: echo ::group::bundler environment buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: - + - name: "Honeycomb: Record Setup Environment time" if: ${{ github.repository_owner == 'puppetlabs' }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Run validation steps run: | bundle exec rake validate @@ -60,16 +61,15 @@ jobs: id: get-matrix run: | if [ '${{ github.repository_owner }}' == 'puppetlabs' ]; then - buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 + buildevents cmd $TRACE_ID $STEP_ID matrix_from_metadata -- bundle exec matrix_from_metadata_v2 else echo "::set-output name=matrix::{}" fi - + - name: "Honeycomb: Record Setup Test Matrix time" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' - Acceptance: name: "${{matrix.platforms.label}}, ${{matrix.collection}}" needs: @@ -89,7 +89,7 @@ jobs: echo 'platform=${{ matrix.platforms.image }}' >> $BUILDEVENT_FILE echo 'collection=${{ matrix.collection }}' >> $BUILDEVENT_FILE echo 'label=${{ matrix.platforms.label }}' >> $BUILDEVENT_FILE - + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -102,7 +102,6 @@ jobs: run: | echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-1 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 @@ -117,14 +116,13 @@ jobs: echo ::group::bundler environment buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: - + - name: "Honeycomb: Record Setup Environment time" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-2 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Provision test environment run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:provision ${{ matrix.platforms.image }}' -- bundle exec rake 'litmus:provision[${{matrix.platforms.provider}},${{ matrix.platforms.image }}]' @@ -150,7 +148,7 @@ jobs: - name: Install module run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_module' -- bundle exec rake 'litmus:install_module' - + - name: "Honeycomb: Record deployment times" if: ${{ always() }} run: | @@ -159,18 +157,16 @@ jobs: echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-3 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV echo ::endgroup:: - - name: Run acceptance tests run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:acceptance:parallel' -- bundle exec rake 'litmus:acceptance:parallel' - + - name: "Honeycomb: Record acceptance testing times" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Run acceptance tests' echo STEP_ID=${{ matrix.platforms.image }}-${{ matrix.collection }}-4 >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Remove test environment if: ${{ always() }} continue-on-error: true @@ -182,7 +178,7 @@ jobs: echo echo ::endgroup:: fi - + - name: "Honeycomb: Record removal times" if: ${{ always() }} run: | diff --git a/.github/workflows/spec.yml b/.github/workflows/spec.yml index 7da4f3dd..6c1ae10d 100644 --- a/.github/workflows/spec.yml +++ b/.github/workflows/spec.yml @@ -6,6 +6,7 @@ on: workflow_dispatch: pull_request: + env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests @@ -18,6 +19,7 @@ jobs: spec_matrix: ${{ steps.get-matrix.outputs.spec_matrix }} steps: + - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: @@ -29,7 +31,6 @@ jobs: run: | echo STEP_ID=setup-environment >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Checkout Source uses: actions/checkout@v2 if: ${{ github.repository_owner == 'puppetlabs' }} @@ -47,14 +48,12 @@ jobs: echo ::group::bundler environment buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: - - name: "Honeycomb: Record Setup Environment time" if: ${{ github.repository_owner == 'puppetlabs' }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Environment' echo STEP_ID=Setup-Acceptance-Test-Matrix >> $GITHUB_ENV echo STEP_START=$(date +%s) >> $GITHUB_ENV - - name: Run Static & Syntax Tests if: ${{ github.repository_owner == 'puppetlabs' }} run: | @@ -68,12 +67,10 @@ jobs: else echo "::set-output name=spec_matrix::{}" fi - - name: "Honeycomb: Record Setup Test Matrix time" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Setup Test Matrix' - Spec: name: "Spec Tests (Puppet: ${{matrix.puppet_version}}, Ruby Ver: ${{matrix.ruby_version}})" needs: @@ -96,7 +93,6 @@ jobs: - run: | echo 'puppet_version=${{ env.SANITIZED_PUPPET_VERSION }}' >> $BUILDEVENT_FILE - - name: "Honeycomb: Start first step" run: | echo "STEP_ID=${{ env.SANITIZED_PUPPET_VERSION }}-spec" >> $GITHUB_ENV @@ -109,7 +105,6 @@ jobs: dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} matrix-key: ${{ env.SANITIZED_PUPPET_VERSION }} - - name: Checkout Source uses: actions/checkout@v2 @@ -125,6 +120,7 @@ jobs: buildevents cmd $TRACE_ID $STEP_ID 'bundle env' -- bundle env echo ::endgroup:: + - name: Run parallel_spec tests run: | buildevents cmd $TRACE_ID $STEP_ID 'rake parallel_spec Puppet ${{ matrix.puppet_version }}, Ruby ${{ matrix.ruby_version }}' -- bundle exec rake parallel_spec diff --git a/.puppet-lint.rc b/.puppet-lint.rc index 7c98ce78..ac388955 100644 --- a/.puppet-lint.rc +++ b/.puppet-lint.rc @@ -1,2 +1,9 @@ --relative +--no-parameter_types-check +--no-parameter_documentation-check +--no-topscope_variable-check +--no-top_scope_facts-check +--no-relative_classname_inclusion-check +--no-legacy_facts-check +--no-selector_inside_resource-check --ignore-paths=examples/*.pp,vendor/**/*.pp,bundle/**/*.pp,pkg/**/*.pp,spec/**/*.pp diff --git a/.rubocop.yml b/.rubocop.yml index 8f782e74..31e8248f 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -4,7 +4,7 @@ require: - rubocop-rspec AllCops: DisplayCopNames: true - TargetRubyVersion: '2.4' + TargetRubyVersion: '2.5' Include: - "**/*.rb" Exclude: diff --git a/.sync.yml b/.sync.yml index be68fec5..ca8b5c56 100644 --- a/.sync.yml +++ b/.sync.yml @@ -31,6 +31,14 @@ Rakefile: - bundle/**/*.pp - pkg/**/*.pp - spec/**/*.pp + extra_disabled_lint_checks: + - parameter_types + - parameter_documentation + - topscope_variable + - top_scope_facts + - relative_classname_inclusion + - legacy_facts + - selector_inside_resource Gemfile: optional: ":development": diff --git a/Gemfile b/Gemfile index 31bd27e9..f356f89e 100644 --- a/Gemfile +++ b/Gemfile @@ -24,6 +24,7 @@ group :development do gem "puppet-module-posix-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:ruby] gem "puppet-module-win-default-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "puppet-module-win-dev-r#{minor_version}", '~> 1.0', require: false, platforms: [:mswin, :mingw, :x64_mingw] + gem "voxpupuli-puppet-lint-plugins", '>= 3.0', require: false, platforms: [:ruby] gem "rspec-retry", '= 0.4.5', require: false, platforms: [:ruby] gem "github_changelog_generator", require: false end diff --git a/Rakefile b/Rakefile index c839a830..07dece66 100644 --- a/Rakefile +++ b/Rakefile @@ -42,6 +42,13 @@ def changelog_future_release end PuppetLint.configuration.send('disable_relative') +PuppetLint.configuration.send('disable_parameter_types') +PuppetLint.configuration.send('disable_parameter_documentation') +PuppetLint.configuration.send('disable_topscope_variable') +PuppetLint.configuration.send('disable_top_scope_facts') +PuppetLint.configuration.send('disable_relative_classname_inclusion') +PuppetLint.configuration.send('disable_legacy_facts') +PuppetLint.configuration.send('disable_selector_inside_resource') PuppetLint.configuration.ignore_paths = ["examples/*.pp", "vendor/**/*.pp", "bundle/**/*.pp", "pkg/**/*.pp", "spec/**/*.pp"] diff --git a/manifests/config/context.pp b/manifests/config/context.pp index 7ccba2c8..0ebc0fb0 100644 --- a/manifests/config/context.pp +++ b/manifests/config/context.pp @@ -27,7 +27,6 @@ incl => "${_catalina_base}/conf/context.xml", changes => $changes, show_diff => $show_diff, - } } } diff --git a/manifests/config/context/environment.pp b/manifests/config/context/environment.pp index d98bf853..b80caba5 100644 --- a/manifests/config/context/environment.pp +++ b/manifests/config/context/environment.pp @@ -82,13 +82,13 @@ } $changes = delete_undef_values(flatten([ - $set_name, - $set_type, - $set_value, - $set_override, - $set_description, - $set_additional_attributes, - $rm_attributes_to_remove, + $set_name, + $set_type, + $set_value, + $set_override, + $set_description, + $set_additional_attributes, + $rm_attributes_to_remove, ])) } diff --git a/manifests/config/context/manager.pp b/manifests/config/context/manager.pp index ce8eaafc..256ba144 100644 --- a/manifests/config/context/manager.pp +++ b/manifests/config/context/manager.pp @@ -43,7 +43,7 @@ if ! empty($additional_attributes) { $set_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), - "set ${base_path}/#attribute/"), "'") + "set ${base_path}/#attribute/"), "'") } else { $set_additional_attributes = undef } @@ -55,9 +55,9 @@ } $changes = delete_undef_values(flatten([ - $set_name, - $set_additional_attributes, - $rm_attributes_to_remove, + $set_name, + $set_additional_attributes, + $rm_attributes_to_remove, ])) } diff --git a/manifests/config/context/parameter.pp b/manifests/config/context/parameter.pp index adf126ad..dfaf032b 100644 --- a/manifests/config/context/parameter.pp +++ b/manifests/config/context/parameter.pp @@ -32,7 +32,6 @@ $changes = "rm ${base_path}" } else { - if empty($value) { fail('$value must be specified') } @@ -54,10 +53,10 @@ } $changes = delete_undef_values(flatten([ - $set_name, - $set_value, - $set_override, - $set_description, + $set_name, + $set_value, + $set_override, + $set_description, ])) } diff --git a/manifests/config/context/resource.pp b/manifests/config/context/resource.pp index 7eb0936a..e8b50799 100644 --- a/manifests/config/context/resource.pp +++ b/manifests/config/context/resource.pp @@ -60,12 +60,11 @@ $rm_attributes_to_remove = undef } - $changes = delete_undef_values(flatten([ - $set_name, - $set_type, - $set_additional_attributes, - $rm_attributes_to_remove, + $set_name, + $set_type, + $set_additional_attributes, + $rm_attributes_to_remove, ])) } diff --git a/manifests/config/context/resourcelink.pp b/manifests/config/context/resourcelink.pp index fca6cb9b..1f666872 100644 --- a/manifests/config/context/resourcelink.pp +++ b/manifests/config/context/resourcelink.pp @@ -54,10 +54,10 @@ } $augeaschanges = delete_undef_values(flatten([ - $set_name, - $set_type, - $set_additional_attributes, - $rm_attributes_to_remove, + $set_name, + $set_type, + $set_additional_attributes, + $rm_attributes_to_remove, ])) } diff --git a/manifests/config/context/valve.pp b/manifests/config/context/valve.pp index 60a0bb43..8482ce11 100644 --- a/manifests/config/context/valve.pp +++ b/manifests/config/context/valve.pp @@ -82,9 +82,9 @@ } if $_name !~ Undef { - $attributes = {'className' => $_class_name, 'name' => $_name} + $additional_attributes + $attributes = { 'className' => $_class_name, 'name' => $_name } + $additional_attributes } else { - $attributes = {'className' => $_class_name} + $additional_attributes + $attributes = { 'className' => $_class_name } + $additional_attributes } $augeas_filter = $_uniqueness_attributes.map |$attr| { @@ -109,9 +109,9 @@ } $changes = delete_undef_values(flatten([ - $defnode_valve, - $set_attributes, - $rm_attributes, + $defnode_valve, + $set_attributes, + $rm_attributes, ])) } diff --git a/manifests/config/server/connector.pp b/manifests/config/server/connector.pp index e8ae9c56..445a1c87 100644 --- a/manifests/config/server/connector.pp +++ b/manifests/config/server/connector.pp @@ -92,11 +92,11 @@ } $changes = delete_undef_values(flatten([ - $__purge_connectors, - $_port, - $_protocol_change, - $_additional_attributes, - $_attributes_to_remove, + $__purge_connectors, + $_port, + $_protocol_change, + $_additional_attributes, + $_attributes_to_remove, ])) } diff --git a/manifests/config/server/engine.pp b/manifests/config/server/engine.pp index 553fad85..9d78ddc5 100644 --- a/manifests/config/server/engine.pp +++ b/manifests/config/server/engine.pp @@ -103,12 +103,12 @@ } $changes = delete_undef_values([ - $_name_change, - $_default_host, - $_background_processor_delay, - $_class_name, - $_jvm_route, - $_start_stop_threads, + $_name_change, + $_default_host, + $_background_processor_delay, + $_class_name, + $_jvm_route, + $_start_stop_threads, ]) augeas { "${_catalina_base}-${parent_service}-engine": diff --git a/manifests/config/server/globalnamingresource.pp b/manifests/config/server/globalnamingresource.pp index baa4fd73..f0969bd9 100644 --- a/manifests/config/server/globalnamingresource.pp +++ b/manifests/config/server/globalnamingresource.pp @@ -64,8 +64,8 @@ } $changes = delete_undef_values(flatten([ - $set_additional_attributes, - $rm_attributes_to_remove, + $set_additional_attributes, + $rm_attributes_to_remove, ])) # (MODULES-3353) This should use $set_name in $changes like diff --git a/manifests/config/server/host.pp b/manifests/config/server/host.pp index 4c686f7d..1557d5f6 100644 --- a/manifests/config/server/host.pp +++ b/manifests/config/server/host.pp @@ -86,12 +86,13 @@ } $changes = delete_undef_values(flatten([ - $_host_name_change, - $_app_base, - $_additional_attributes, - $_attributes_to_remove, - $_clear_aliases, - $_add_aliases])) + $_host_name_change, + $_app_base, + $_additional_attributes, + $_attributes_to_remove, + $_clear_aliases, + $_add_aliases, + ])) } augeas { "${_catalina_base}-${parent_service}-host-${name}": diff --git a/manifests/config/server/realm.pp b/manifests/config/server/realm.pp index 03e83ad3..eed00b90 100644 --- a/manifests/config/server/realm.pp +++ b/manifests/config/server/realm.pp @@ -99,14 +99,13 @@ if $realm_ensure == 'absent' { $changes = "rm ${path}[${path_expression}]" } else { - # This will create the node if there are no matches $_class_name = "set ${path}[${path_expression}]/#attribute/className '${class_name}'" $puppet_name = "set ${path}[${path_expression}]/#attribute/puppetName '${name}'" if ! empty($additional_attributes) { $_additional_attributes = suffix(prefix(join_keys_to_values($additional_attributes, " '"), - "set ${path}[${path_expression}]/#attribute/"), "'") + "set ${path}[${path_expression}]/#attribute/"), "'") } else { $_additional_attributes = undef } @@ -117,11 +116,12 @@ } $changes = delete_undef_values(flatten([ - $__purge_realms, - $puppet_name, - $_class_name, - $_additional_attributes, - $_attributes_to_remove ])) + $__purge_realms, + $puppet_name, + $_class_name, + $_additional_attributes, + $_attributes_to_remove, + ])) } augeas { "${_catalina_base}-${parent_service}-${parent_engine}-${parent_host}-${parent_realm}-realm-${name}": @@ -130,5 +130,4 @@ changes => $changes, show_diff => $show_diff, } - } diff --git a/manifests/config/server/resources.pp b/manifests/config/server/resources.pp index 6a023e0f..b8f05d51 100644 --- a/manifests/config/server/resources.pp +++ b/manifests/config/server/resources.pp @@ -85,7 +85,7 @@ } else { $_container = [ "set ${parent} ''", - "set ${path} #empty" + "set ${path} #empty", ] if ! empty($additional_attributes) { diff --git a/manifests/config/server/tomcat_users.pp b/manifests/config/server/tomcat_users.pp index 5ac8a4c6..e4636fb3 100644 --- a/manifests/config/server/tomcat_users.pp +++ b/manifests/config/server/tomcat_users.pp @@ -36,7 +36,6 @@ Array $roles = [], Boolean $show_diff = true, ) { - if versioncmp($::augeasversion, '1.0.0') < 0 { fail('Server configurations require Augeas >= 1.0.0') } @@ -69,13 +68,13 @@ if $manage_file { ensure_resource('file', $_file, { - ensure => file, - path => $_file, - replace => false, - content => '', - owner => $_owner, - group => $_group, - mode => '0640', + ensure => file, + path => $_file, + replace => false, + content => '', + owner => $_owner, + group => $_group, + mode => '0640', }) File[$_file] -> Augeas["${catalina_base}-tomcat_users-${element}-${_element_name}-${name}"] } @@ -107,5 +106,4 @@ changes => $changes, show_diff => $show_diff, } - } diff --git a/manifests/config/server/valve.pp b/manifests/config/server/valve.pp index 92772c10..94728532 100644 --- a/manifests/config/server/valve.pp +++ b/manifests/config/server/valve.pp @@ -60,7 +60,7 @@ $_uniqueness_attributes = $uniqueness_attributes } - $attributes = {'className' => $_class_name} + $additional_attributes + $attributes = { 'className' => $_class_name } + $additional_attributes $augeas_filter = $_uniqueness_attributes.map |$attr| { "[#attribute/${attr}='${attributes[$attr]}']" @@ -100,9 +100,9 @@ } $changes = delete_undef_values(flatten([ - $defnode_valve, - $set_attributes, - $rm_attributes, + $defnode_valve, + $set_attributes, + $rm_attributes, ])) } diff --git a/manifests/init.pp b/manifests/init.pp index 2d09e5db..83223dbe 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,11 +33,12 @@ Boolean $manage_base = true, Boolean $manage_properties = true, ) { - case $::osfamily { 'windows','Solaris','Darwin': { fail("Unsupported osfamily: ${::osfamily}") } - default: { } + default: { + # Empty + } } } diff --git a/manifests/install.pp b/manifests/install.pp index c95dbcec..90ba5107 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -50,7 +50,6 @@ $manage_home = undef, Optional[Array[String]] $remove_default_webapps = undef, - # package options $package_ensure = undef, $package_name = undef, @@ -67,13 +66,13 @@ if $install_from_source { if $_manage_user { ensure_resource('user', $_user, { - ensure => present, - gid => $_group, + ensure => present, + gid => $_group, }) } if $_manage_group { ensure_resource('group', $_group, { - ensure => present, + ensure => present, }) } tomcat::install::source { $name: @@ -96,7 +95,7 @@ if $remove_default_webapps { $remove_default_webapps.each |$folder| { - file{"remove ${folder}" : + file { "remove ${folder}" : ensure => absent, path => "${catalina_home}/webapps/${folder}", recurse => true, @@ -105,7 +104,7 @@ require => $install_from_source ? { true => Resource['tomcat::install::source', $name], default => Resource['tomcat::install::package', $package_name] - } + }, } } } diff --git a/manifests/instance.pp b/manifests/instance.pp index 5aed9fff..9f8240ef 100644 --- a/manifests/instance.pp +++ b/manifests/instance.pp @@ -122,9 +122,9 @@ # it must exist. tomcat::install::source will take care of creating base. if $_catalina_base != $_catalina_home and $_manage_base { ensure_resource('file',$_catalina_home, { - ensure => directory, - owner => $_user, - group => $_group, + ensure => directory, + owner => $_user, + group => $_group, }) } # XXX This is for backwards compatibility. Declare a tomcat install, but install @@ -148,13 +148,13 @@ if $_catalina_home != $_catalina_base { if $_manage_user { ensure_resource('user', $_user, { - ensure => present, - gid => $_group, + ensure => present, + gid => $_group, }) } if $_manage_group { ensure_resource('group', $_group, { - ensure => present, + ensure => present, }) } diff --git a/manifests/war.pp b/manifests/war.pp index df69d0ed..0329678a 100644 --- a/manifests/war.pp +++ b/manifests/war.pp @@ -21,7 +21,7 @@ # @param group # The 'group' owner of the tomcat war file. # -define tomcat::war( +define tomcat::war ( $catalina_base = undef, $app_base = undef, $deployment_path = undef, diff --git a/metadata.json b/metadata.json index 1d87ce18..b544f980 100644 --- a/metadata.json +++ b/metadata.json @@ -93,6 +93,6 @@ } ], "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", - "template-ref": "heads/main-0-gb4d80a6", - "pdk-version": "2.2.0" + "template-ref": "2.5.0-0-g806810b", + "pdk-version": "2.4.0" }