pax_global_header00006660000000000000000000000064143714444460014525gustar00rootroot0000000000000052 comment=16a813fa20802c59445dd1549413792724ea5cfa puppetlabs-concat-7.3.1/000077500000000000000000000000001437144444600151615ustar00rootroot00000000000000puppetlabs-concat-7.3.1/.devcontainer/000077500000000000000000000000001437144444600177205ustar00rootroot00000000000000puppetlabs-concat-7.3.1/.devcontainer/Dockerfile000066400000000000000000000003521437144444600217120ustar00rootroot00000000000000FROM 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 puppetlabs-concat-7.3.1/.devcontainer/README.md000066400000000000000000000015231437144444600212000ustar00rootroot00000000000000# devcontainer For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: https://github.com/microsoft/vscode-dev-containers/tree/v0.140.1/containers/puppet ``` json { "name": "Puppet Development Kit (Community)", "dockerFile": "Dockerfile", // Set *default* container specific settings.json values on container create. "settings": { "terminal.integrated.profiles.linux": { "bash": { "path": "bash", } } }, // Add the IDs of extensions you want installed when the container is created. "extensions": [ "puppet.puppet-vscode", "rebornix.Ruby" ], // Use 'forwardPorts' to make a list of ports inside the container available locally. "forwardPorts": [], // Use 'postCreateCommand' to run commands after the container is created. "postCreateCommand": "pdk --version", } ``` puppetlabs-concat-7.3.1/.devcontainer/devcontainer.json000066400000000000000000000003701437144444600232740ustar00rootroot00000000000000{ "name": "Puppet Development Kit (Community)", "dockerFile": "Dockerfile", "settings": { "terminal.integrated.profiles.linux": { "bash": { "path": "bash" } } }, "extensions": [ "puppet.puppet-vscode", "rebornix.Ruby" ] } puppetlabs-concat-7.3.1/.fixtures.yml000066400000000000000000000005171437144444600176360ustar00rootroot00000000000000fixtures: repositories: facts: 'https://github.com/puppetlabs/puppetlabs-facts.git' provision: 'https://github.com/puppetlabs/provision.git' puppet_agent: 'https://github.com/puppetlabs/puppetlabs-puppet_agent.git' stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git' symlinks: concat: '#{source_dir}' puppetlabs-concat-7.3.1/.gitattributes000066400000000000000000000000761437144444600200570ustar00rootroot00000000000000*.rb eol=lf *.erb eol=lf *.pp eol=lf *.sh eol=lf *.epp eol=lf puppetlabs-concat-7.3.1/.github/000077500000000000000000000000001437144444600165215ustar00rootroot00000000000000puppetlabs-concat-7.3.1/.github/workflows/000077500000000000000000000000001437144444600205565ustar00rootroot00000000000000puppetlabs-concat-7.3.1/.github/workflows/auto_release.yml000066400000000000000000000070111437144444600237500ustar00rootroot00000000000000name: "Auto release" on: workflow_dispatch: env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: auto_release: name: "Automatic release prep" runs-on: ubuntu-20.04 steps: - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} - name: "Honeycomb: start first step" 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 with: fetch-depth: 0 persist-credentials: false - name: "PDK Release prep" uses: docker://puppet/pdk:2.6.1.0 with: args: 'release prep --force' env: CHANGELOG_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: "Get Version" if: ${{ github.repository_owner == 'puppetlabs' }} id: gv run: | echo "::set-output name=ver::$(jq --raw-output .version metadata.json)" - name: "Check if a release is necessary" if: ${{ github.repository_owner == 'puppetlabs' }} id: check run: | git diff --quiet CHANGELOG.md && echo "::set-output name=release::false" || echo "::set-output name=release::true" - name: "Commit changes" if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} run: | git config --local user.email "${{ github.repository_owner }}@users.noreply.github.com" git config --local user.name "GitHub Action" git add . git commit -m "Release prep v${{ steps.gv.outputs.ver }}" - name: Create Pull Request id: cpr uses: puppetlabs/peter-evans-create-pull-request@v3 if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} with: token: ${{ secrets.GITHUB_TOKEN }} commit-message: "Release prep v${{ steps.gv.outputs.ver }}" branch: "release-prep" delete-branch: true title: "Release prep v${{ steps.gv.outputs.ver }}" body: | Automated release-prep through [pdk-templates](https://github.com/puppetlabs/pdk-templates/blob/main/moduleroot/.github/workflows/auto_release.yml.erb) from commit ${{ github.sha }}. Please verify before merging: - [ ] last [nightly](https://github.com/${{ github.repository }}/actions/workflows/nightly.yml) run is green - [ ] [Changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) is readable and has no unlabeled pull requests - [ ] Ensure the [changelog](https://github.com/${{ github.repository }}/blob/release-prep/CHANGELOG.md) version and [metadata](https://github.com/${{ github.repository }}/blob/release-prep/metadata.json) version match labels: "maintenance" - name: PR outputs if: ${{ github.repository_owner == 'puppetlabs' && steps.check.outputs.release == 'true' }} 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: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Finished auto release workflow' puppetlabs-concat-7.3.1/.github/workflows/labeller.yml000066400000000000000000000006561437144444600230720ustar00rootroot00000000000000name: community-labeller on: issues: types: - opened pull_request_target: types: - opened jobs: label: runs-on: ubuntu-latest steps: - uses: puppetlabs/community-labeller@v0 name: Label issues or pull requests with: label_name: community label_color: '5319e7' org_membership: puppetlabs token: ${{ secrets.IAC_COMMUNITY_LABELER }} puppetlabs-concat-7.3.1/.github/workflows/mend.yml000066400000000000000000000003561437144444600222300ustar00rootroot00000000000000name: "mend" on: pull_request: branches: - "main" schedule: - cron: "0 0 * * *" workflow_dispatch: jobs: mend: uses: "puppetlabs/cat-github-actions/.github/workflows/mend_ruby.yml@main" secrets: "inherit" puppetlabs-concat-7.3.1/.github/workflows/nightly.yml000066400000000000000000000155651437144444600227730ustar00rootroot00000000000000name: "nightly" 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: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} - name: "Honeycomb: Start first step" 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' }} - name: Activate Ruby 2.7 uses: ruby/setup-ruby@v1 if: ${{ github.repository_owner == 'puppetlabs' }} with: ruby-version: "2.7" bundler-cache: true - name: Print bundle environment if: ${{ github.repository_owner == 'puppetlabs' }} run: | 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 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: - setup_matrix runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} env: BUILDEVENT_FILE: '../buildevents.txt' steps: - run: | 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: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }} - name: "Honeycomb: start first step" 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 - name: Activate Ruby 2.7 uses: ruby/setup-ruby@v1 with: ruby-version: "2.7" bundler-cache: true - name: Print bundle environment run: | 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 }}]' echo ::group::=== REQUEST === cat request.json || true echo echo ::endgroup:: echo ::group::=== INVENTORY === if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; then FILE='spec/fixtures/litmus_inventory.yaml' elif [ -f 'inventory.yaml' ]; then FILE='inventory.yaml' fi sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true echo ::endgroup:: - name: Install agent run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' - 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: | echo ::group::honeycomb step buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system' 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 run: | if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down' echo ::group::=== REQUEST === cat request.json || true echo echo ::endgroup:: fi - name: "Honeycomb: Record removal times" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' slack-workflow-status: if: ${{ github.repository_owner == 'puppetlabs' }} name: Post Workflow Status To Slack needs: - Acceptance runs-on: ubuntu-20.04 steps: - name: Slack Workflow Notification uses: puppetlabs/Gamesight-slack-workflow-status@pdk-templates-v1 with: # Required Input repo_token: ${{ secrets.GITHUB_TOKEN }} slack_webhook_url: ${{ secrets.SLACK_WEBHOOK }} # Optional Input channel: '#team-cat-bots' name: 'GABot' puppetlabs-concat-7.3.1/.github/workflows/pr_test.yml000066400000000000000000000146311437144444600227660ustar00rootroot00000000000000name: "PR Testing" on: [pull_request] env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests jobs: setup_matrix: 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: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} - name: "Honeycomb: Start first step" 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' }} - name: Activate Ruby 2.7 uses: ruby/setup-ruby@v1 if: ${{ github.repository_owner == 'puppetlabs' }} with: ruby-version: "2.7" bundler-cache: true - name: Print bundle environment if: ${{ github.repository_owner == 'puppetlabs' }} run: | 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 if: ${{ github.repository_owner == 'puppetlabs' }} - name: Setup Acceptance Test Matrix 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 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: - setup_matrix if: ${{ needs.setup_matrix.outputs.matrix != '{}' }} runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: ${{fromJson(needs.setup_matrix.outputs.matrix)}} env: BUILDEVENT_FILE: '../buildevents.txt' steps: - run: | 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: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} matrix-key: ${{ matrix.platforms.label }}-${{ matrix.collection }} - name: "Honeycomb: start first step" 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 - name: Activate Ruby 2.7 uses: ruby/setup-ruby@v1 with: ruby-version: "2.7" bundler-cache: true - name: Print bundle environment run: | 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 }}]' echo ::group::=== REQUEST === cat request.json || true echo echo ::endgroup:: echo ::group::=== INVENTORY === if [ -f 'spec/fixtures/litmus_inventory.yaml' ]; then FILE='spec/fixtures/litmus_inventory.yaml' elif [ -f 'inventory.yaml' ]; then FILE='inventory.yaml' fi sed -e 's/password: .*/password: "[redacted]"/' < $FILE || true echo ::endgroup:: - name: Install agent run: | buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:install_agent ${{ matrix.collection }}' -- bundle exec rake 'litmus:install_agent[${{ matrix.collection }}]' - 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: | echo ::group::honeycomb step buildevents step $TRACE_ID $STEP_ID $STEP_START 'Deploy test system' 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 run: | if [[ -f inventory.yaml || -f spec/fixtures/litmus_inventory.yaml ]]; then buildevents cmd $TRACE_ID $STEP_ID 'rake litmus:tear_down' -- bundle exec rake 'litmus:tear_down' echo ::group::=== REQUEST === cat request.json || true echo echo ::endgroup:: fi - name: "Honeycomb: Record removal times" if: ${{ always() }} run: | buildevents step $TRACE_ID $STEP_ID $STEP_START 'Remove test environment' puppetlabs-concat-7.3.1/.github/workflows/release.yml000066400000000000000000000022731437144444600227250ustar00rootroot00000000000000name: "Publish module" on: workflow_dispatch: jobs: create-github-release: name: Deploy GitHub Release runs-on: ubuntu-20.04 steps: - name: Checkout code uses: actions/checkout@v2 with: ref: ${{ github.ref }} clean: true fetch-depth: 0 - name: Get Version id: gv run: | echo "::set-output name=ver::$(jq --raw-output .version metadata.json)" - name: Create Release uses: actions/create-release@v1 id: create_release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: "v${{ steps.gv.outputs.ver }}" draft: false prerelease: false deploy-forge: name: Deploy to Forge runs-on: ubuntu-20.04 steps: - name: Checkout code uses: actions/checkout@v2 with: ref: ${{ github.ref }} clean: true - name: "PDK Build" uses: docker://puppet/pdk:nightly with: args: 'build' - name: "Push to Forge" uses: docker://puppet/pdk:nightly with: args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force' puppetlabs-concat-7.3.1/.github/workflows/spec.yml000066400000000000000000000105471437144444600222420ustar00rootroot00000000000000name: "Spec Tests" on: schedule: - cron: '0 0 * * *' workflow_dispatch: pull_request: env: HONEYCOMB_WRITEKEY: 7f3c63a70eecc61d635917de46bea4e6 HONEYCOMB_DATASET: litmus tests jobs: setup_matrix: name: "Setup Test Matrix" runs-on: ubuntu-20.04 outputs: spec_matrix: ${{ steps.get-matrix.outputs.spec_matrix }} steps: - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} - name: "Honeycomb: Start first step" 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' }} - name: Activate Ruby 2.7 uses: ruby/setup-ruby@v1 if: ${{ github.repository_owner == 'puppetlabs' }} with: ruby-version: "2.7" bundler-cache: true - name: Print bundle environment if: ${{ github.repository_owner == 'puppetlabs' }} run: | 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: | buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop - name: Setup Spec Test Matrix 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 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: - setup_matrix if: ${{ needs.setup_matrix.outputs.spec_matrix != '{}' }} runs-on: ubuntu-20.04 strategy: fail-fast: false matrix: ${{fromJson(needs.setup_matrix.outputs.spec_matrix)}} env: BUILDEVENT_FILE: '../buildevents.txt' PUPPET_GEM_VERSION: ${{ matrix.puppet_version }} FACTER_GEM_VERSION: 'https://github.com/puppetlabs/facter#main' steps: - run: | echo "SANITIZED_PUPPET_VERSION=$(echo '${{ matrix.puppet_version }}' | sed 's/~> //g')" >> $GITHUB_ENV - 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 echo STEP_START=$(date +%s) >> $GITHUB_ENV - name: "Honeycomb: Start recording" uses: puppetlabs/kvrhdn-gha-buildevents@pdk-templates-v1 with: apikey: ${{ env.HONEYCOMB_WRITEKEY }} dataset: ${{ env.HONEYCOMB_DATASET }} job-status: ${{ job.status }} matrix-key: ${{ env.SANITIZED_PUPPET_VERSION }} - name: Checkout Source uses: actions/checkout@v2 - name: "Activate Ruby ${{ matrix.ruby_version }}" uses: ruby/setup-ruby@v1 with: ruby-version: ${{matrix.ruby_version}} bundler-cache: true - name: Print bundle environment run: | echo ::group::bundler environment 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 puppetlabs-concat-7.3.1/.gitignore000066400000000000000000000005171437144444600171540ustar00rootroot00000000000000.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/ /convert_report.txt /update_report.txt .DS_Store .project .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml puppetlabs-concat-7.3.1/.gitpod.Dockerfile000066400000000000000000000022751437144444600205240ustar00rootroot00000000000000FROM gitpod/workspace-full RUN sudo wget https://apt.puppet.com/puppet-tools-release-bionic.deb && \ wget https://apt.puppetlabs.com/puppet6-release-bionic.deb && \ sudo dpkg -i puppet6-release-bionic.deb && \ sudo dpkg -i puppet-tools-release-bionic.deb && \ sudo apt-get update && \ sudo apt-get install -y pdk zsh puppet-agent && \ sudo apt-get clean && \ sudo rm -rf /var/lib/apt/lists/* RUN sudo usermod -s $(which zsh) gitpod && \ sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" && \ echo "plugins=(git gitignore github gem pip bundler python ruby docker docker-compose)" >> /home/gitpod/.zshrc && \ echo 'PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/puppetlabs/bin:/opt/puppetlabs/puppet/bin"' >> /home/gitpod/.zshrc && \ sudo /opt/puppetlabs/puppet/bin/gem install puppet-debugger hub -N && \ mkdir -p /home/gitpod/.config/puppet && \ /opt/puppetlabs/puppet/bin/ruby -r yaml -e "puts ({'disabled' => true}).to_yaml" > /home/gitpod/.config/puppet/analytics.yml RUN rm -f puppet6-release-bionic.deb puppet-tools-release-bionic.deb ENTRYPOINT /usr/bin/zsh puppetlabs-concat-7.3.1/.gitpod.yml000066400000000000000000000002301437144444600172430ustar00rootroot00000000000000image: file: .gitpod.Dockerfile tasks: - init: pdk bundle install vscode: extensions: - puppet.puppet-vscode@1.2.0:f5iEPbmOj6FoFTOV6q8LTg== puppetlabs-concat-7.3.1/.pdkignore000066400000000000000000000010731437144444600171450ustar00rootroot00000000000000.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/ /convert_report.txt /update_report.txt .DS_Store .project .envrc /inventory.yaml /spec/fixtures/litmus_inventory.yaml /appveyor.yml /.editorconfig /.fixtures.yml /Gemfile /.gitattributes /.gitignore /.gitlab-ci.yml /.pdkignore /.puppet-lint.rc /Rakefile /rakelib/ /.rspec /.rubocop.yml /.travis.yml /.yardopts /spec/ /.vscode/ /.sync.yml /.devcontainer/ puppetlabs-concat-7.3.1/.puppet-lint.rc000066400000000000000000000000131437144444600200400ustar00rootroot00000000000000--relative puppetlabs-concat-7.3.1/.rspec000066400000000000000000000000371437144444600162760ustar00rootroot00000000000000--color --format documentation puppetlabs-concat-7.3.1/.rubocop.yml000066400000000000000000000277301437144444600174440ustar00rootroot00000000000000--- require: - rubocop-performance - rubocop-rspec AllCops: DisplayCopNames: true TargetRubyVersion: '2.5' 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/InsecureProtocolSource: Enabled: false Gemspec/DuplicatedAssignment: Enabled: false Gemspec/OrderedDependencies: Enabled: false Gemspec/RequiredRubyVersion: Enabled: false Gemspec/RubyVersionGlobalsUsage: Enabled: false Layout/ArgumentAlignment: Enabled: false Layout/BeginEndAlignment: Enabled: false Layout/ClosingHeredocIndentation: Enabled: false Layout/EmptyComment: Enabled: false Layout/EmptyLineAfterGuardClause: Enabled: false Layout/EmptyLinesAroundArguments: Enabled: false Layout/EmptyLinesAroundAttributeAccessor: Enabled: false Layout/EndOfLine: Enabled: false Layout/FirstArgumentIndentation: Enabled: false Layout/HashAlignment: Enabled: false Layout/HeredocIndentation: Enabled: false Layout/LeadingEmptyLines: Enabled: false Layout/SpaceAroundMethodCallOperator: Enabled: false Layout/SpaceInsideArrayLiteralBrackets: Enabled: false Layout/SpaceInsideReferenceBrackets: Enabled: false Lint/BigDecimalNew: Enabled: false Lint/BooleanSymbol: Enabled: false Lint/ConstantDefinitionInBlock: Enabled: false Lint/DeprecatedOpenSSLConstant: Enabled: false Lint/DisjunctiveAssignmentInConstructor: Enabled: false Lint/DuplicateElsifCondition: Enabled: false Lint/DuplicateRequire: Enabled: false Lint/DuplicateRescueException: Enabled: false Lint/EmptyConditionalBody: Enabled: false Lint/EmptyFile: Enabled: false Lint/ErbNewArguments: Enabled: false Lint/FloatComparison: Enabled: false Lint/HashCompareByIdentity: Enabled: false Lint/IdentityComparison: Enabled: false Lint/InterpolationCheck: Enabled: false Lint/MissingCopEnableDirective: Enabled: false Lint/MixedRegexpCaptureTypes: Enabled: false Lint/NestedPercentLiteral: Enabled: false Lint/NonDeterministicRequireOrder: Enabled: false Lint/OrderedMagicComments: Enabled: false Lint/OutOfRangeRegexpRef: Enabled: false Lint/RaiseException: Enabled: false Lint/RedundantCopEnableDirective: Enabled: false Lint/RedundantRequireStatement: Enabled: false Lint/RedundantSafeNavigation: Enabled: false Lint/RedundantWithIndex: Enabled: false Lint/RedundantWithObject: Enabled: false Lint/RegexpAsCondition: Enabled: false Lint/ReturnInVoidContext: Enabled: false Lint/SafeNavigationConsistency: Enabled: false Lint/SafeNavigationWithEmpty: Enabled: false Lint/SelfAssignment: Enabled: false Lint/SendWithMixinArgument: Enabled: false Lint/ShadowedArgument: Enabled: false Lint/StructNewOverride: Enabled: false Lint/ToJSON: Enabled: false Lint/TopLevelReturnWithArgument: Enabled: false Lint/TrailingCommaInAttributeDeclaration: Enabled: false Lint/UnreachableLoop: Enabled: false Lint/UriEscapeUnescape: Enabled: false Lint/UriRegexp: Enabled: false Lint/UselessMethodDefinition: Enabled: false Lint/UselessTimes: Enabled: false Metrics/AbcSize: Enabled: false Metrics/BlockLength: Enabled: false Metrics/BlockNesting: Enabled: false Metrics/ClassLength: Enabled: false Metrics/CyclomaticComplexity: Enabled: false Metrics/MethodLength: Enabled: false Metrics/ModuleLength: Enabled: false Metrics/ParameterLists: Enabled: false Metrics/PerceivedComplexity: Enabled: false Migration/DepartmentName: Enabled: false Naming/AccessorMethodName: Enabled: false Naming/BlockParameterName: Enabled: false Naming/HeredocDelimiterCase: Enabled: false Naming/HeredocDelimiterNaming: Enabled: false Naming/MemoizedInstanceVariableName: Enabled: false Naming/MethodParameterName: Enabled: false Naming/RescuedExceptionsVariableName: Enabled: false Naming/VariableNumber: Enabled: false Performance/BindCall: Enabled: false Performance/DeletePrefix: Enabled: false Performance/DeleteSuffix: Enabled: false Performance/InefficientHashSearch: Enabled: false Performance/UnfreezeString: Enabled: false Performance/UriDefaultParser: Enabled: false RSpec/Be: Enabled: false RSpec/Capybara/CurrentPathExpectation: Enabled: false RSpec/Capybara/FeatureMethods: Enabled: false RSpec/Capybara/VisibilityMatcher: Enabled: false RSpec/ContextMethod: Enabled: false RSpec/ContextWording: Enabled: false RSpec/DescribeClass: Enabled: false RSpec/EmptyHook: Enabled: false RSpec/EmptyLineAfterExample: Enabled: false RSpec/EmptyLineAfterExampleGroup: Enabled: false RSpec/EmptyLineAfterHook: Enabled: false RSpec/ExampleLength: Enabled: false RSpec/ExampleWithoutDescription: Enabled: false RSpec/ExpectChange: Enabled: false RSpec/ExpectInHook: Enabled: false RSpec/FactoryBot/AttributeDefinedStatically: Enabled: false RSpec/FactoryBot/CreateList: Enabled: false RSpec/FactoryBot/FactoryClassName: Enabled: false RSpec/HooksBeforeExamples: Enabled: false RSpec/ImplicitBlockExpectation: Enabled: false RSpec/ImplicitSubject: Enabled: false RSpec/LeakyConstantDeclaration: Enabled: false RSpec/LetBeforeExamples: Enabled: false RSpec/MissingExampleGroupArgument: Enabled: false RSpec/MultipleExpectations: Enabled: false RSpec/MultipleMemoizedHelpers: Enabled: false RSpec/MultipleSubjects: Enabled: false RSpec/NestedGroups: Enabled: false RSpec/PredicateMatcher: Enabled: false RSpec/ReceiveCounts: Enabled: false RSpec/ReceiveNever: Enabled: false RSpec/RepeatedExampleGroupBody: Enabled: false RSpec/RepeatedExampleGroupDescription: Enabled: false RSpec/RepeatedIncludeExample: Enabled: false RSpec/ReturnFromStub: Enabled: false RSpec/SharedExamples: Enabled: false RSpec/StubbedMock: Enabled: false RSpec/UnspecifiedException: Enabled: false RSpec/VariableDefinition: Enabled: false RSpec/VoidExpect: Enabled: false RSpec/Yield: Enabled: false Security/Open: Enabled: false Style/AccessModifierDeclarations: Enabled: false Style/AccessorGrouping: Enabled: false Style/AsciiComments: Enabled: false Style/BisectedAttrAccessor: Enabled: false Style/CaseLikeIf: Enabled: false Style/ClassEqualityComparison: Enabled: false Style/ColonMethodDefinition: Enabled: false Style/CombinableLoops: Enabled: false Style/CommentedKeyword: Enabled: false Style/Dir: Enabled: false Style/DoubleCopDisableDirective: Enabled: false Style/EmptyBlockParameter: Enabled: false Style/EmptyLambdaParameter: Enabled: false Style/Encoding: Enabled: false Style/EvalWithLocation: Enabled: false Style/ExpandPathArguments: Enabled: false Style/ExplicitBlockArgument: Enabled: false Style/ExponentialNotation: Enabled: false Style/FloatDivision: Enabled: false Style/FrozenStringLiteralComment: Enabled: false Style/GlobalStdStream: Enabled: false Style/HashAsLastArrayItem: Enabled: false Style/HashLikeCase: Enabled: false Style/HashTransformKeys: Enabled: false Style/HashTransformValues: Enabled: false Style/IfUnlessModifier: Enabled: false Style/KeywordParametersOrder: Enabled: false Style/MinMax: Enabled: false Style/MixinUsage: Enabled: false Style/MultilineWhenThen: Enabled: false Style/NegatedUnless: Enabled: false Style/NumericPredicate: Enabled: false Style/OptionalBooleanParameter: Enabled: false Style/OrAssignment: Enabled: false Style/RandomWithOffset: Enabled: false Style/RedundantAssignment: Enabled: false Style/RedundantCondition: Enabled: false Style/RedundantConditional: Enabled: false Style/RedundantFetchBlock: Enabled: false Style/RedundantFileExtensionInRequire: Enabled: false Style/RedundantRegexpCharacterClass: Enabled: false Style/RedundantRegexpEscape: Enabled: false Style/RedundantSelfAssignment: Enabled: false Style/RedundantSort: Enabled: false Style/RescueStandardError: Enabled: false Style/SingleArgumentDig: Enabled: false Style/SlicingWithRange: Enabled: false Style/SoleNestedConditional: Enabled: false Style/StderrPuts: Enabled: false Style/StringConcatenation: Enabled: false Style/Strip: Enabled: false Style/SymbolProc: Enabled: false Style/TrailingBodyOnClass: Enabled: false Style/TrailingBodyOnMethodDefinition: Enabled: false Style/TrailingBodyOnModule: Enabled: false Style/TrailingCommaInHashLiteral: Enabled: false Style/TrailingMethodEndStatement: Enabled: false Style/UnpackFirst: Enabled: false Lint/DuplicateBranch: Enabled: false Lint/DuplicateRegexpCharacterClassElement: Enabled: false Lint/EmptyBlock: Enabled: false Lint/EmptyClass: Enabled: false Lint/NoReturnInBeginEndBlocks: Enabled: false Lint/ToEnumArguments: Enabled: false Lint/UnexpectedBlockArity: Enabled: false Lint/UnmodifiedReduceAccumulator: Enabled: false Performance/CollectionLiteralInLoop: Enabled: false Style/ArgumentsForwarding: Enabled: false Style/CollectionCompact: Enabled: false Style/DocumentDynamicEvalDefinition: Enabled: false Style/NegatedIfElseCondition: Enabled: false Style/NilLambda: Enabled: false Style/RedundantArgument: Enabled: false Style/SwapValues: Enabled: false puppetlabs-concat-7.3.1/.sync.yml000066400000000000000000000013011437144444600167310ustar00rootroot00000000000000--- ".gitlab-ci.yml": delete: true appveyor.yml: delete: true Gemfile: optional: ":development": - gem: github_changelog_generator version: '= 1.15.2' spec/spec_helper.rb: mock_with: ":rspec" coverage_report: true .gitpod.Dockerfile: unmanaged: false .gitpod.yml: unmanaged: false .github/workflows/nightly.yml: unmanaged: false .github/workflows/pr_test.yml: unmanaged: false .github/workflows/spec.yml: checks: 'syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop' unmanaged: false .github/workflows/release.yml: unmanaged: false .github/workflows/auto_release.yml: unmanaged: false .travis.yml: delete: true puppetlabs-concat-7.3.1/.vscode/000077500000000000000000000000001437144444600165225ustar00rootroot00000000000000puppetlabs-concat-7.3.1/.vscode/extensions.json000066400000000000000000000001171437144444600216130ustar00rootroot00000000000000{ "recommendations": [ "puppet.puppet-vscode", "rebornix.Ruby" ] } puppetlabs-concat-7.3.1/.yardopts000066400000000000000000000000221437144444600170210ustar00rootroot00000000000000--markup markdown puppetlabs-concat-7.3.1/CHANGELOG.md000066400000000000000000000642751437144444600170100ustar00rootroot00000000000000# Change log All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org). ## [v7.3.1](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.3.1) (2023-02-10) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.3.0...v7.3.1) ### Fixed - pdksync - \(CONT-189\) Remove support for RedHat6 / OracleLinux6 / Scientific6 [\#747](https://github.com/puppetlabs/puppetlabs-concat/pull/747) ([david22swan](https://github.com/david22swan)) - pdksync - \(CONT-130\) Dropping Support for Debian 9 [\#744](https://github.com/puppetlabs/puppetlabs-concat/pull/744) ([jordanbreen28](https://github.com/jordanbreen28)) ## [v7.3.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.3.0) (2022-10-03) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.2.0...v7.3.0) ### Added - pdksync - \(GH-cat-11\) Certify Support for Ubuntu 22.04 [\#739](https://github.com/puppetlabs/puppetlabs-concat/pull/739) ([david22swan](https://github.com/david22swan)) - \(GH-cat-12\) Add Support for Redhat 9 [\#738](https://github.com/puppetlabs/puppetlabs-concat/pull/738) ([david22swan](https://github.com/david22swan)) ### Fixed - \(MAINT\) Drop support for Solaris 10, Windows \(7, 8.1\), Windows Server 2008 R2 and AIX \(5.3, 6.1\) [\#741](https://github.com/puppetlabs/puppetlabs-concat/pull/741) ([jordanbreen28](https://github.com/jordanbreen28)) ## [v7.2.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.2.0) (2022-05-16) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.1.1...v7.2.0) ### Added - pdksync - \(FM-8922\) - Add Support for Windows 2022 [\#725](https://github.com/puppetlabs/puppetlabs-concat/pull/725) ([david22swan](https://github.com/david22swan)) - pdksync - \(IAC-1753\) - Add Support for AlmaLinux 8 [\#720](https://github.com/puppetlabs/puppetlabs-concat/pull/720) ([david22swan](https://github.com/david22swan)) - pdksync - \(IAC-1751\) - Add Support for Rocky 8 [\#719](https://github.com/puppetlabs/puppetlabs-concat/pull/719) ([david22swan](https://github.com/david22swan)) ### Fixed - pdksync - \(GH-iac-334\) Remove Support for Ubuntu 14.04 [\#729](https://github.com/puppetlabs/puppetlabs-concat/pull/729) ([david22swan](https://github.com/david22swan)) - pdksync - \(GH-iac-334\) Remove Support for Ubuntu 16.04 [\#728](https://github.com/puppetlabs/puppetlabs-concat/pull/728) ([david22swan](https://github.com/david22swan)) - pdksync - \(IAC-1787\) Remove Support for CentOS 6 [\#723](https://github.com/puppetlabs/puppetlabs-concat/pull/723) ([david22swan](https://github.com/david22swan)) - pdksync - \(IAC-1598\) - Remove Support for Debian 8 [\#718](https://github.com/puppetlabs/puppetlabs-concat/pull/718) ([david22swan](https://github.com/david22swan)) ## [v7.1.1](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.1.1) (2021-08-25) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.1.0...v7.1.1) ### Fixed - \(maint\) Allow stdlib 8.0.0 [\#716](https://github.com/puppetlabs/puppetlabs-concat/pull/716) ([smortex](https://github.com/smortex)) ## [v7.1.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.1.0) (2021-08-23) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.0.2...v7.1.0) ### Added - pdksync - \(IAC-1709\) - Add Support for Debian 11 [\#713](https://github.com/puppetlabs/puppetlabs-concat/pull/713) ([david22swan](https://github.com/david22swan)) ## [v7.0.2](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.0.2) (2021-06-21) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.0.1...v7.0.2) ### Fixed - fix merge nil hashes [\#708](https://github.com/puppetlabs/puppetlabs-concat/pull/708) ([thde](https://github.com/thde)) - Do not modify metaparams in place [\#705](https://github.com/puppetlabs/puppetlabs-concat/pull/705) ([ekohl](https://github.com/ekohl)) ## [v7.0.1](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.0.1) (2021-03-29) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v7.0.0...v7.0.1) ### Fixed - \(IAC-1497\) remove unsupported `translate` dependency [\#693](https://github.com/puppetlabs/puppetlabs-concat/pull/693) ([DavidS](https://github.com/DavidS)) ## [v7.0.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v7.0.0) (2021-03-01) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v6.4.0...v7.0.0) ### Changed - pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0 [\#685](https://github.com/puppetlabs/puppetlabs-concat/pull/685) ([carabasdaniel](https://github.com/carabasdaniel)) ## [v6.4.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v6.4.0) (2020-12-14) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v6.3.0...v6.4.0) ### Added - pdksync - \(feat\) Add support for Puppet 7 [\#672](https://github.com/puppetlabs/puppetlabs-concat/pull/672) ([daianamezdrea](https://github.com/daianamezdrea)) ## [v6.3.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v6.3.0) (2020-11-30) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v6.2.0...v6.3.0) ### Added - \(IAC-746\) - Add ubuntu 20.04 support [\#644](https://github.com/puppetlabs/puppetlabs-concat/pull/644) ([david22swan](https://github.com/david22swan)) - Add support for Deferred function in concat fragment [\#627](https://github.com/puppetlabs/puppetlabs-concat/pull/627) ([baurmatt](https://github.com/baurmatt)) ### Fixed - \(MODULES-9711\) Consistently manage concat with no fragments [\#661](https://github.com/puppetlabs/puppetlabs-concat/pull/661) ([seanmil](https://github.com/seanmil)) - \(IAC-981\) - Removal of inappropriate terminology [\#659](https://github.com/puppetlabs/puppetlabs-concat/pull/659) ([david22swan](https://github.com/david22swan)) ## [v6.2.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v6.2.0) (2020-01-21) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v6.1.0...v6.2.0) ### Added - pdksync - \(FM-8581\) - Debian 10 added to travis and provision file refactored [\#624](https://github.com/puppetlabs/puppetlabs-concat/pull/624) ([david22swan](https://github.com/david22swan)) - \(FM-8698\) - Addition of Support for CentOS 8 [\#615](https://github.com/puppetlabs/puppetlabs-concat/pull/615) ([david22swan](https://github.com/david22swan)) - FM-8398 - support Debian10 [\#599](https://github.com/puppetlabs/puppetlabs-concat/pull/599) ([lionce](https://github.com/lionce)) ### Fixed - Fix newline handling at the end of fragments [\#623](https://github.com/puppetlabs/puppetlabs-concat/pull/623) ([SimonPe](https://github.com/SimonPe)) ## [v6.1.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v6.1.0) (2019-07-23) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/v6.0.0...v6.1.0) ### Added - FM-8049 - add redhat8 support [\#584](https://github.com/puppetlabs/puppetlabs-concat/pull/584) ([lionce](https://github.com/lionce)) ### Fixed - \(MODULES-9479\) Fix nested array merge behavior [\#593](https://github.com/puppetlabs/puppetlabs-concat/pull/593) ([seanmil](https://github.com/seanmil)) - \(FM-8317\) Updated regex to allow for windows paths with \'s [\#591](https://github.com/puppetlabs/puppetlabs-concat/pull/591) ([pgrant87](https://github.com/pgrant87)) - \(bugfix\) allow private keys in ssh testing [\#585](https://github.com/puppetlabs/puppetlabs-concat/pull/585) ([tphoney](https://github.com/tphoney)) ## [v6.0.0](https://github.com/puppetlabs/puppetlabs-concat/tree/v6.0.0) (2019-05-21) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/5.3.0...v6.0.0) ### Changed - pdksync - \(MODULES-8444\) - Raise lower Puppet bound [\#575](https://github.com/puppetlabs/puppetlabs-concat/pull/575) ([david22swan](https://github.com/david22swan)) ### Added - \(FM-7606\) enable litmus for concat [\#577](https://github.com/puppetlabs/puppetlabs-concat/pull/577) ([tphoney](https://github.com/tphoney)) ### Fixed - \(FM-8073\) litmus block support [\#580](https://github.com/puppetlabs/puppetlabs-concat/pull/580) ([tphoney](https://github.com/tphoney)) ## [5.3.0](https://github.com/puppetlabs/puppetlabs-concat/tree/5.3.0) (2019-02-20) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/5.2.0...5.3.0) ### Added - \(MODULES-8138\) - Addition of support for SLES 15 [\#545](https://github.com/puppetlabs/puppetlabs-concat/pull/545) ([david22swan](https://github.com/david22swan)) ### Fixed - \(FM-7725\) - Remove OSX testing/support for concat [\#561](https://github.com/puppetlabs/puppetlabs-concat/pull/561) ([lionce](https://github.com/lionce)) - pdksync - \(FM-7655\) Fix rubygems-update for ruby \< 2.3 [\#550](https://github.com/puppetlabs/puppetlabs-concat/pull/550) ([tphoney](https://github.com/tphoney)) ## [5.2.0](https://github.com/puppetlabs/puppetlabs-concat/tree/5.2.0) (2018-12-10) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/5.1.0...5.2.0) ### Added - \(FM-7339\) - Add i18n implementation [\#537](https://github.com/puppetlabs/puppetlabs-concat/pull/537) ([eimlav](https://github.com/eimlav)) - \(FM-7341\) - Added REFERENCE.md and updated documentation [\#536](https://github.com/puppetlabs/puppetlabs-concat/pull/536) ([eimlav](https://github.com/eimlav)) - \(MODULES-5124\) Add support for JSON arrays [\#519](https://github.com/puppetlabs/puppetlabs-concat/pull/519) ([johanfleury](https://github.com/johanfleury)) ### Fixed - \(FM-7581\) - Fix CI failures for Windows 2016 and 10 Enterprise [\#540](https://github.com/puppetlabs/puppetlabs-concat/pull/540) ([eimlav](https://github.com/eimlav)) - \(MODULES-8287\) - Fix fomat=\>'yaml' allowing only hashes [\#535](https://github.com/puppetlabs/puppetlabs-concat/pull/535) ([eimlav](https://github.com/eimlav)) - \(FM-7513\) - Removing Windows 2016-core from our support matrix [\#534](https://github.com/puppetlabs/puppetlabs-concat/pull/534) ([pmcmaw](https://github.com/pmcmaw)) - \(MODULES-8088\) - newline\_spec.rb test expectation update [\#531](https://github.com/puppetlabs/puppetlabs-concat/pull/531) ([lionce](https://github.com/lionce)) - \(MODULES-7717\) ensure\_newline uses unix line ending on windows [\#517](https://github.com/puppetlabs/puppetlabs-concat/pull/517) ([tkishel](https://github.com/tkishel)) ## [5.1.0](https://github.com/puppetlabs/puppetlabs-concat/tree/5.1.0) (2018-10-03) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/5.0.0...5.1.0) ### Added - pdksync - \(FM-7392\) - Puppet 6 Testing Changes [\#525](https://github.com/puppetlabs/puppetlabs-concat/pull/525) ([pmcmaw](https://github.com/pmcmaw)) - pdksync - \(MODULES-6805\) metadata.json shows support for puppet 6 [\#524](https://github.com/puppetlabs/puppetlabs-concat/pull/524) ([tphoney](https://github.com/tphoney)) - pdksync - \(MODULES-7658\) use beaker4 in puppet-module-gems [\#518](https://github.com/puppetlabs/puppetlabs-concat/pull/518) ([tphoney](https://github.com/tphoney)) ## [5.0.0](https://github.com/puppetlabs/puppetlabs-concat/tree/5.0.0) (2018-08-24) [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/4.2.1...5.0.0) ### Changed - \[FM-6954\] Removal of scientific linux 5 and debian 7 [\#508](https://github.com/puppetlabs/puppetlabs-concat/pull/508) ([david22swan](https://github.com/david22swan)) ### Added - \(FM-7206\) Update concat to support Ubuntu 18.04 [\#510](https://github.com/puppetlabs/puppetlabs-concat/pull/510) ([david22swan](https://github.com/david22swan)) ### Fixed - Handle concat\_file source when not an array [\#493](https://github.com/puppetlabs/puppetlabs-concat/pull/493) ([vicinus](https://github.com/vicinus)) ## 4.2.1 [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/4.2.0...4.2.1) ### Fixed - \(MODULES-6817\) noop =\> false for concat\_file [\#492](https://github.com/puppetlabs/puppetlabs-concat/pull/492) ([hunner](https://github.com/hunner)) ## Supported Release 4.2.0 ### Summary This release introduces the conversion of the module to use PDK 1.3.2, along with the addition of rubocop with associated fixes. #### Changed - All changes in this release are for enabling rubocop, alongside the module then being converted over to the PDK. ## Supported Releases 4.1.1 ### Summary This release is to update the formatting of the module, rubocop having been run for all ruby files and been set to run automatically on all future commits. #### Changed - Rubocop has been implemented. - SLES 10, Windows 2003 R2 and OSX 10.9 removed as supported. - OSX 10.10 and 10.11 added as supported. ## Supported Releases 4.1.0 ### Summary This release is a rollup of changes. The most notable change being the addition of the 'format' attribute which allows output in JSON and YAML formats, and the 'force' attribute which if true forces a merge of duplicate keys for these formats. #### Features - Format and force attributes added. - Deprecated is_string in favour of puppet language. - End of Life Ubuntu releases removed as supported. - Debian 9 added and Debian 6 removed as supported. #### Bugfixes - (MODULES-4359) Fix native types so they can be used directly. - Update to tests to handle errors containing quote marks. - Update to tests to follow rspec-puppet pattern. ## Supported Releases 4.0.1 ### Summary This is a small release that updates regex in a test due to changes made in Puppet. #### Bugfixes - (MODULES-5085) Ensure that replace test handles qoutes in change message ## Supported Releases 3.0.0 & 4.0.0 ### Summary This double release adds new Puppet 4 data types. The 3.0.0 release is fully backwards compatible to existing Puppet 4 configurations and provides you with [deprecation warnings](https://github.com/puppetlabs/puppetlabs-stdlib#deprecation) for every argument that will not work as expected with the final 4.0.0 release. See the [stdlib docs](https://github.com/puppetlabs/puppetlabs-stdlib#validate_legacy) for an in-depth discussion of this. If you're still running Puppet 3, remain on the latest puppetlabs-concat 2.x release for now, and see the documentation to [upgrade to Puppet 4](https://docs.puppet.com/puppet/4.6/reference/upgrade_major_pre.html). #### Added - puppet-strings documentation - Puppet 4 data types and deprecation warnings #### Changed - stdlib dependency changed to 4.13.1 - supported Puppet version changed to 4.7. ## Supported Release 2.2.1 ### Summary This is a backwards compatible bugfix release. #### Bugfixes - (MODULES-4350) Makes :path the namevar for concat_file - (MODULES-4351) Prevents the :order parameter from accepting arbitrary values in concat_file - (MODULES-4352) Restricts the :replace parameter to values accepted by file - (MODULES-4474) Drops auto requirement of fragments - (MODULES-3900) Improves error messages in concat::fragment - Uses the whole fragment title when sorting ## Supported Release 2.2.0 ### Summary This release includes support for Debian 8 and Ubuntu 16.04 in addition to numerous bugfixes. #### Features - Adds Debian 8 support - Adds Ubuntu 16.04 support #### Bugfixes - Fixes the stdlib lower dependency. - (MODULES-3027) Fixes escaping the '*' character in tag creation. - (MODULES-3097) Fixes fragment sorting by alpha - Correctly propagates 'validate_cmd' parameter to generated file resource - Correctly escapes disallowed characters in fragment tag creation - (MODULES-3332) Correct the target path validation - (MODULES-3463) Properly passes metaparams to generated resource ## Supported Release 2.1.0 ### Summary This is a re-release of concat as a resource type. This release also includes new features and bugfixes on top of the previously YANKED 2.0.1 release. #### Features - Adds the show_diff property. - Adds the selinux related file params. - Allows integer UID/GID values to be passed into `$owner` and `$group` #### Bugfixes - Adds a workaround to PUP-1963: generated resources never receiving dependency edges. - Fixes occassional failure to find directory environment. ## Supported Release 1.2.5 ### Summary Small release for support of newer PE versions. This increments the version of PE in the metadata.json file. ## 2015-07-21 - Supported Release 1.2.4 ### Summary This release includes some ruby path and lint fixes. #### Bugfixes - Use correct ruby path with PE and AIO - Lint fixes - Use correct ruby path on FreeBSD - Test fixes ## 2015-06-02 - Supported Release 2.0.1 [YANKED] ### Summary This is a bugfix release. #### Bugfixes - Fixes dependency graphing with concurrent modification of the same file. - Fixes handling fragment target. - Fixes the defaulted force behavior to handle empty concats correctly. ## 2015-06-02 - Supported Release 1.2.3 ### Summary This release includes a README fix to document correct behavior of fragment target parameter. #### Bugfixes - README Fix to correctly document how a fragment $target param should work. ## 2015-05-12 - Supported Release 2.0.0 [YANKED] ### Summary This is a major release. Includes re-implementation of concat to use native Type and Providers, resulting in significantly improved performance and testability. Also includes a bugfix to alpha ordering of fragments. #### Features - Re-implementation of concat to use native Type and Providers. #### Bugfixes - Fixes a bug in alpha ordering of fragments. ## 2015-05-12 - Supported Release 1.2.2 ### Summary This release includes a bugfix. #### Bugfixes - Fixes a bug introduced by MODULES-1700, in handling default retrieval of fragment backup parameter. ## 2015-04-14 - Supported Release 1.2.1 ### Summary This release includes bugfixes, test improvements, and a rewritten README. #### Bugfixes - Verifies existence of $is_pe before using it. - Adds validation for $order param to not allow restricted characters. - Sets the group id on Fragments for versions of Facter that contain the $gid fact. - Sets the script group to 0 if the script is owned by root. - Explicitly sets script and concat directories to the same owner and group. - Re-adds support for fragment backup, so that static compiler can work with filebucket (MODULES-1700). ## 2015-02-17 - Supported Release 1.2.0 ### Summary This release includes a number of bugfixes and adds support for running a validation command when using puppet >= 3.5.0. #### Features - Support running a validation command for Puppet >= 3.5.0 #### Bugfixes - Reset poisoned defaults from Exec - Use concatfragments.rb on AIX since it doesn't support print0 - Make sure ruby is in the path for PE (MODULES-1456) - Fix missing method for check_is_owned_by for windows (MODULES-1764) - Fix sort by numeric ## 2014-10-28 - Supported Release 1.1.2 ### Summary This release includes bugfixes and test improvements. The module was tested against SLES10 and SLES12 and found to work against those platforms with no module improvements. Metadata was updated to include those as supported platforms. #### Bugfixes - newline didn't work for Windows and Solaris. This has been fixed. - Install certs on Windows for acceptance tests - Update tests to work with strict variables (no module updates were required) - Update tests to work on Windows - Fix typo in CHANGELOG.md ## 2014-09-10 - Supported Release 1.1.1 ### Summary This is a bugfix release, and the first supported release of the 1.1.x series. #### Bugfixes - Make the `$order` parameter default to a string and be validated as an integer or a string - Use the ruby script on Solaris to not break Sol10 support - Add quotes to the ruby script location for Windows - Fix typos in README.md - Make regex in concat::setup case-insensitive to make it work on Windows - Make sure concat fragments are always replaced - Fix validation to allow `$backup` to be a boolean - Remove dependency on stdlib 4.x - Fix for lack of idempotency with `ensure => 'absent'` - Fix tests and spec_helper - Synchronized files for more consistency across modules via modulesync ## 2014-05-14 - Release 1.1.0 ### Summary This release is primarily a bugfix release since 1.1.0-rc1. #### Features - Improved testing, with tests moved to beaker #### Bugfixes - No longer attempts to set fragment owner and mode on Windows - Fix numeric sorting - Fix incorrect quoting - Fix newlines ## 2014-01-03 - Release 1.1.0-rc1 ### Summary This release of concat was 90% written by Joshua Hoblitt, and the module team would like to thank him for the huge amount of work he put into this release. This module deprecates a bunch of old parameters and usage patterns, modernizes much of the manifest code, simplifies a whole bunch of logic and makes improvements to almost all parts of the module. The other major feature is windows support, courtesy of luisfdez, with an alternative version of the concat bash script in ruby. We've attempted to ensure that there are no backwards incompatible changes, all users of 1.0.0 should be able to use 1.1.0 without any failures, but you may find deprecation warnings and we'll be aggressively moving for a 2.0 to remove those too. For further information on deprecations, please read: https://github.com/puppetlabs/puppetlabs-concat/blob/main/README.md#api-deprecations #### Removed - Puppet 0.24 support. - Filebucket backup of all file resources except the target concatenated file. - Default owner/user/group values. - Purging of long unused /usr/local/bin/concatfragments.sh ### Features - Windows support via a ruby version of the concat bash script. - Huge amount of acceptance testing work added. - Documentation (README) completely rewritten. - New parameters in concat: - `ensure`: Controls if the file should be present/absent at all. - Remove requirement to include concat::setup in manifests. - Made `gnu` parameter deprecated. - Added parameter validation. ### Bugfixes - Ensure concat::setup runs before concat::fragment in all cases. - Pluginsync references updated for modern Puppet. - Fix incorrect group parameter. - Use $owner instead of $id to avoid confusion with $::id - Compatibility fixes for Puppet 2.7/ruby 1.8.7 - Use LC_ALL=C instead of LANG=C - Always exec the concatfragments script as root when running as root. - Syntax and other cleanup changes. ## 2014-06-25 - Supported Release 1.0.4 ### Summary This release has test fixes. #### Features - Added test support for OSX. #### Bugfixes #### Known bugs * Not supported on Windows. ## 2014-06-04 - Release 1.0.3 ### Summary This release adds compatibility for PE3.3 and fixes tests. #### Features - Added test support for Ubuntu Trusty. #### Bugfixes #### Known bugs *Not supported on Windows. ## 2014-03-04 - Supported Release 1.0.2 ### Summary This is a supported release. No functional changes were made from 1.0.1. #### Features - Huge amount of tests backported from 1.1. - Documentation rewrite. #### Bugfixes #### Known Bugs * Not supported on Windows. ## 2014-02-12 - 1.0.1 ### Summary Minor bugfixes for sorting of fragments and ordering of resources. #### Bugfixes - LANG => C replaced with LC_ALL => C to reduce spurious recreation of fragments. - Corrected pluginsync documentation. - Ensure concat::setup always runs before fragments. ## 2013-08-09 - 1.0.0 ### Summary Many new features and bugfixes in this release, and if you're a heavy concat user you should test carefully before upgrading. The features should all be backwards compatible but only light testing has been done from our side before this release. #### Features - New parameters in concat: - `replace`: specify if concat should replace existing files. - `ensure_newline`: controls if fragments should contain a newline at the end. - Improved README documentation. - Add rspec:system tests (rake spec:system to test concat) #### Bugfixes - Gracefully handle \n in a fragment resource name. - Adding more helpful message for 'pluginsync = true' - Allow passing `source` and `content` directly to file resource, rather than defining resource defaults. - Added -r flag to read so that filenames with \ will be read correctly. - sort always uses LANG=C. - Allow WARNMSG to contain/start with '#'. - Replace while-read pattern with for-do in order to support Solaris. #### CHANGELOG: - 2010/02/19 - initial release - 2010/03/12 - add support for 0.24.8 and newer - make the location of sort configurable - add the ability to add shell comment based warnings to top of files - add the ablity to create empty files - 2010/04/05 - fix parsing of WARN and change code style to match rest of the code - Better and safer boolean handling for warn and force - Don't use hard coded paths in the shell script, set PATH top of the script - Use file{} to copy the result and make all fragments owned by root. This means we can chnage the ownership/group of the resulting file at any time. - You can specify ensure => "/some/other/file" in concat::fragment to include the contents of a symlink into the final file. - 2010/04/16 - Add more cleaning of the fragment name - removing / from the $name - 2010/05/22 - Improve documentation and show the use of ensure => - 2010/07/14 - Add support for setting the filebucket behavior of files - 2010/10/04 - Make the warning message configurable - 2010/12/03 - Add flags to make concat work better on Solaris - thanks Jonathan Boyett - 2011/02/03 - Make the shell script more portable and add a config option for root group - 2011/06/21 - Make base dir root readable only for security - 2011/06/23 - Set base directory using a fact instead of hardcoding it - 2011/06/23 - Support operating as non privileged user - 2011/06/23 - Support dash instead of bash or sh - 2011/07/11 - Better solaris support - 2011/12/05 - Use fully qualified variables - 2011/12/13 - Improve Nexenta support - 2012/04/11 - Do not use any GNU specific extensions in the shell script - 2012/03/24 - Comply to community style guides - 2012/05/23 - Better errors when basedir isnt set - 2012/05/31 - Add spec tests - 2012/07/11 - Include concat::setup in concat improving UX - 2012/08/14 - Puppet Lint improvements - 2012/08/30 - The target path can be different from the $name - 2012/08/30 - More Puppet Lint cleanup - 2012/09/04 - RELEASE 0.2.0 - 2012/12/12 - Added (file) $replace parameter to concat \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)* puppetlabs-concat-7.3.1/CODEOWNERS000066400000000000000000000000761437144444600165570ustar00rootroot00000000000000# Setting ownership to the modules team * @puppetlabs/modules puppetlabs-concat-7.3.1/CONTRIBUTING.md000066400000000000000000000003231437144444600174100ustar00rootroot00000000000000# Contributing to Puppet modules Check out our [Contributing to Supported Modules Blog Post](https://puppetlabs.github.io/iac/docs/contributing_to_a_module.html) to find all the information that you will need. puppetlabs-concat-7.3.1/Gemfile000066400000000000000000000067371437144444600164710ustar00rootroot00000000000000source 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 "voxpupuli-puppet-lint-plugins", '~> 3.1', require: false gem "facterdb", '~> 1.18', require: false gem "metadata-json-lint", '>= 2.0.2', '< 4.0.0', require: false gem "puppetlabs_spec_helper", '>= 3.0.0', '< 5.0.0', require: false gem "rspec-puppet-facts", '~> 2.0', require: false gem "codecov", '~> 0.2', require: false gem "dependency_checker", '~> 0.2', require: false gem "parallel_tests", '~> 3.4', require: false gem "pry", '~> 0.10', require: false gem "simplecov-console", '~> 0.5', require: false gem "puppet-debugger", '~> 1.0', require: false gem "rubocop", '= 1.6.1', require: false gem "rubocop-performance", '= 1.9.1', require: false gem "rubocop-rspec", '= 2.0.1', require: false gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw] gem "github_changelog_generator", '= 1.15.2', require: false end group :system_tests do gem "puppet_litmus", '< 1.0.0', require: false, platforms: [:ruby] 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 puppetlabs-concat-7.3.1/HISTORY.md000066400000000000000000000345701437144444600166550ustar00rootroot00000000000000## 4.2.1 [Full Changelog](https://github.com/puppetlabs/puppetlabs-concat/compare/4.2.0...4.2.1) ### Fixed - \(MODULES-6817\) noop =\> false for concat\_file [\#492](https://github.com/puppetlabs/puppetlabs-concat/pull/492) ([hunner](https://github.com/hunner)) ## Supported Release 4.2.0 ### Summary This release introduces the conversion of the module to use PDK 1.3.2, along with the addition of rubocop with associated fixes. #### Changed - All changes in this release are for enabling rubocop, alongside the module then being converted over to the PDK. ## Supported Releases 4.1.1 ### Summary This release is to update the formatting of the module, rubocop having been run for all ruby files and been set to run automatically on all future commits. #### Changed - Rubocop has been implemented. - SLES 10, Windows 2003 R2 and OSX 10.9 removed as supported. - OSX 10.10 and 10.11 added as supported. ## Supported Releases 4.1.0 ### Summary This release is a rollup of changes. The most notable change being the addition of the 'format' attribute which allows output in JSON and YAML formats, and the 'force' attribute which if true forces a merge of duplicate keys for these formats. #### Features - Format and force attributes added. - Deprecated is_string in favour of puppet language. - End of Life Ubuntu releases removed as supported. - Debian 9 added and Debian 6 removed as supported. #### Bugfixes - (MODULES-4359) Fix native types so they can be used directly. - Update to tests to handle errors containing quote marks. - Update to tests to follow rspec-puppet pattern. ## Supported Releases 4.0.1 ### Summary This is a small release that updates regex in a test due to changes made in Puppet. #### Bugfixes - (MODULES-5085) Ensure that replace test handles qoutes in change message ## Supported Releases 3.0.0 & 4.0.0 ### Summary This double release adds new Puppet 4 data types. The 3.0.0 release is fully backwards compatible to existing Puppet 4 configurations and provides you with [deprecation warnings](https://github.com/puppetlabs/puppetlabs-stdlib#deprecation) for every argument that will not work as expected with the final 4.0.0 release. See the [stdlib docs](https://github.com/puppetlabs/puppetlabs-stdlib#validate_legacy) for an in-depth discussion of this. If you're still running Puppet 3, remain on the latest puppetlabs-concat 2.x release for now, and see the documentation to [upgrade to Puppet 4](https://docs.puppet.com/puppet/4.6/reference/upgrade_major_pre.html). #### Added - puppet-strings documentation - Puppet 4 data types and deprecation warnings #### Changed - stdlib dependency changed to 4.13.1 - supported Puppet version changed to 4.7. ## Supported Release 2.2.1 ### Summary This is a backwards compatible bugfix release. #### Bugfixes - (MODULES-4350) Makes :path the namevar for concat_file - (MODULES-4351) Prevents the :order parameter from accepting arbitrary values in concat_file - (MODULES-4352) Restricts the :replace parameter to values accepted by file - (MODULES-4474) Drops auto requirement of fragments - (MODULES-3900) Improves error messages in concat::fragment - Uses the whole fragment title when sorting ## Supported Release 2.2.0 ### Summary This release includes support for Debian 8 and Ubuntu 16.04 in addition to numerous bugfixes. #### Features - Adds Debian 8 support - Adds Ubuntu 16.04 support #### Bugfixes - Fixes the stdlib lower dependency. - (MODULES-3027) Fixes escaping the '*' character in tag creation. - (MODULES-3097) Fixes fragment sorting by alpha - Correctly propagates 'validate_cmd' parameter to generated file resource - Correctly escapes disallowed characters in fragment tag creation - (MODULES-3332) Correct the target path validation - (MODULES-3463) Properly passes metaparams to generated resource ## Supported Release 2.1.0 ### Summary This is a re-release of concat as a resource type. This release also includes new features and bugfixes on top of the previously YANKED 2.0.1 release. #### Features - Adds the show_diff property. - Adds the selinux related file params. - Allows integer UID/GID values to be passed into `$owner` and `$group` #### Bugfixes - Adds a workaround to PUP-1963: generated resources never receiving dependency edges. - Fixes occassional failure to find directory environment. ## Supported Release 1.2.5 ### Summary Small release for support of newer PE versions. This increments the version of PE in the metadata.json file. ## 2015-07-21 - Supported Release 1.2.4 ### Summary This release includes some ruby path and lint fixes. #### Bugfixes - Use correct ruby path with PE and AIO - Lint fixes - Use correct ruby path on FreeBSD - Test fixes ## 2015-06-02 - Supported Release 2.0.1 [YANKED] ### Summary This is a bugfix release. #### Bugfixes - Fixes dependency graphing with concurrent modification of the same file. - Fixes handling fragment target. - Fixes the defaulted force behavior to handle empty concats correctly. ## 2015-06-02 - Supported Release 1.2.3 ### Summary This release includes a README fix to document correct behavior of fragment target parameter. #### Bugfixes - README Fix to correctly document how a fragment $target param should work. ## 2015-05-12 - Supported Release 2.0.0 [YANKED] ### Summary This is a major release. Includes re-implementation of concat to use native Type and Providers, resulting in significantly improved performance and testability. Also includes a bugfix to alpha ordering of fragments. #### Features - Re-implementation of concat to use native Type and Providers. #### Bugfixes - Fixes a bug in alpha ordering of fragments. ## 2015-05-12 - Supported Release 1.2.2 ### Summary This release includes a bugfix. #### Bugfixes - Fixes a bug introduced by MODULES-1700, in handling default retrieval of fragment backup parameter. ## 2015-04-14 - Supported Release 1.2.1 ### Summary This release includes bugfixes, test improvements, and a rewritten README. #### Bugfixes - Verifies existence of $is_pe before using it. - Adds validation for $order param to not allow restricted characters. - Sets the group id on Fragments for versions of Facter that contain the $gid fact. - Sets the script group to 0 if the script is owned by root. - Explicitly sets script and concat directories to the same owner and group. - Re-adds support for fragment backup, so that static compiler can work with filebucket (MODULES-1700). ## 2015-02-17 - Supported Release 1.2.0 ### Summary This release includes a number of bugfixes and adds support for running a validation command when using puppet >= 3.5.0. #### Features - Support running a validation command for Puppet >= 3.5.0 #### Bugfixes - Reset poisoned defaults from Exec - Use concatfragments.rb on AIX since it doesn't support print0 - Make sure ruby is in the path for PE (MODULES-1456) - Fix missing method for check_is_owned_by for windows (MODULES-1764) - Fix sort by numeric ## 2014-10-28 - Supported Release 1.1.2 ### Summary This release includes bugfixes and test improvements. The module was tested against SLES10 and SLES12 and found to work against those platforms with no module improvements. Metadata was updated to include those as supported platforms. #### Bugfixes - newline didn't work for Windows and Solaris. This has been fixed. - Install certs on Windows for acceptance tests - Update tests to work with strict variables (no module updates were required) - Update tests to work on Windows - Fix typo in CHANGELOG.md ## 2014-09-10 - Supported Release 1.1.1 ### Summary This is a bugfix release, and the first supported release of the 1.1.x series. #### Bugfixes - Make the `$order` parameter default to a string and be validated as an integer or a string - Use the ruby script on Solaris to not break Sol10 support - Add quotes to the ruby script location for Windows - Fix typos in README.md - Make regex in concat::setup case-insensitive to make it work on Windows - Make sure concat fragments are always replaced - Fix validation to allow `$backup` to be a boolean - Remove dependency on stdlib 4.x - Fix for lack of idempotency with `ensure => 'absent'` - Fix tests and spec_helper - Synchronized files for more consistency across modules via modulesync ## 2014-05-14 - Release 1.1.0 ### Summary This release is primarily a bugfix release since 1.1.0-rc1. #### Features - Improved testing, with tests moved to beaker #### Bugfixes - No longer attempts to set fragment owner and mode on Windows - Fix numeric sorting - Fix incorrect quoting - Fix newlines ## 2014-01-03 - Release 1.1.0-rc1 ### Summary This release of concat was 90% written by Joshua Hoblitt, and the module team would like to thank him for the huge amount of work he put into this release. This module deprecates a bunch of old parameters and usage patterns, modernizes much of the manifest code, simplifies a whole bunch of logic and makes improvements to almost all parts of the module. The other major feature is windows support, courtesy of luisfdez, with an alternative version of the concat bash script in ruby. We've attempted to ensure that there are no backwards incompatible changes, all users of 1.0.0 should be able to use 1.1.0 without any failures, but you may find deprecation warnings and we'll be aggressively moving for a 2.0 to remove those too. For further information on deprecations, please read: https://github.com/puppetlabs/puppetlabs-concat/blob/main/README.md#api-deprecations #### Removed - Puppet 0.24 support. - Filebucket backup of all file resources except the target concatenated file. - Default owner/user/group values. - Purging of long unused /usr/local/bin/concatfragments.sh ### Features - Windows support via a ruby version of the concat bash script. - Huge amount of acceptance testing work added. - Documentation (README) completely rewritten. - New parameters in concat: - `ensure`: Controls if the file should be present/absent at all. - Remove requirement to include concat::setup in manifests. - Made `gnu` parameter deprecated. - Added parameter validation. ### Bugfixes - Ensure concat::setup runs before concat::fragment in all cases. - Pluginsync references updated for modern Puppet. - Fix incorrect group parameter. - Use $owner instead of $id to avoid confusion with $::id - Compatibility fixes for Puppet 2.7/ruby 1.8.7 - Use LC_ALL=C instead of LANG=C - Always exec the concatfragments script as root when running as root. - Syntax and other cleanup changes. ## 2014-06-25 - Supported Release 1.0.4 ### Summary This release has test fixes. #### Features - Added test support for OSX. #### Bugfixes #### Known bugs * Not supported on Windows. ## 2014-06-04 - Release 1.0.3 ### Summary This release adds compatibility for PE3.3 and fixes tests. #### Features - Added test support for Ubuntu Trusty. #### Bugfixes #### Known bugs *Not supported on Windows. ## 2014-03-04 - Supported Release 1.0.2 ### Summary This is a supported release. No functional changes were made from 1.0.1. #### Features - Huge amount of tests backported from 1.1. - Documentation rewrite. #### Bugfixes #### Known Bugs * Not supported on Windows. ## 2014-02-12 - 1.0.1 ### Summary Minor bugfixes for sorting of fragments and ordering of resources. #### Bugfixes - LANG => C replaced with LC_ALL => C to reduce spurious recreation of fragments. - Corrected pluginsync documentation. - Ensure concat::setup always runs before fragments. ## 2013-08-09 - 1.0.0 ### Summary Many new features and bugfixes in this release, and if you're a heavy concat user you should test carefully before upgrading. The features should all be backwards compatible but only light testing has been done from our side before this release. #### Features - New parameters in concat: - `replace`: specify if concat should replace existing files. - `ensure_newline`: controls if fragments should contain a newline at the end. - Improved README documentation. - Add rspec:system tests (rake spec:system to test concat) #### Bugfixes - Gracefully handle \n in a fragment resource name. - Adding more helpful message for 'pluginsync = true' - Allow passing `source` and `content` directly to file resource, rather than defining resource defaults. - Added -r flag to read so that filenames with \ will be read correctly. - sort always uses LANG=C. - Allow WARNMSG to contain/start with '#'. - Replace while-read pattern with for-do in order to support Solaris. #### CHANGELOG: - 2010/02/19 - initial release - 2010/03/12 - add support for 0.24.8 and newer - make the location of sort configurable - add the ability to add shell comment based warnings to top of files - add the ablity to create empty files - 2010/04/05 - fix parsing of WARN and change code style to match rest of the code - Better and safer boolean handling for warn and force - Don't use hard coded paths in the shell script, set PATH top of the script - Use file{} to copy the result and make all fragments owned by root. This means we can chnage the ownership/group of the resulting file at any time. - You can specify ensure => "/some/other/file" in concat::fragment to include the contents of a symlink into the final file. - 2010/04/16 - Add more cleaning of the fragment name - removing / from the $name - 2010/05/22 - Improve documentation and show the use of ensure => - 2010/07/14 - Add support for setting the filebucket behavior of files - 2010/10/04 - Make the warning message configurable - 2010/12/03 - Add flags to make concat work better on Solaris - thanks Jonathan Boyett - 2011/02/03 - Make the shell script more portable and add a config option for root group - 2011/06/21 - Make base dir root readable only for security - 2011/06/23 - Set base directory using a fact instead of hardcoding it - 2011/06/23 - Support operating as non privileged user - 2011/06/23 - Support dash instead of bash or sh - 2011/07/11 - Better solaris support - 2011/12/05 - Use fully qualified variables - 2011/12/13 - Improve Nexenta support - 2012/04/11 - Do not use any GNU specific extensions in the shell script - 2012/03/24 - Comply to community style guides - 2012/05/23 - Better errors when basedir isnt set - 2012/05/31 - Add spec tests - 2012/07/11 - Include concat::setup in concat improving UX - 2012/08/14 - Puppet Lint improvements - 2012/08/30 - The target path can be different from the $name - 2012/08/30 - More Puppet Lint cleanup - 2012/09/04 - RELEASE 0.2.0 - 2012/12/12 - Added (file) $replace parameter to concat puppetlabs-concat-7.3.1/LICENSE000066400000000000000000000261361437144444600161760ustar00rootroot00000000000000 Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. "Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. "Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." "Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives. Copyright [yyyy] [name of copyright owner] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. puppetlabs-concat-7.3.1/NOTICE000066400000000000000000000011131437144444600160610ustar00rootroot00000000000000Puppet Module - puppetlabs-concat Copyright 2018 Puppet, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.puppetlabs-concat-7.3.1/README.md000066400000000000000000000127421437144444600164460ustar00rootroot00000000000000# concat #### Table of Contents 1. [Overview](#overview) 2. [Module Description - What the module does and why it is useful](#module-description) * [Beginning with concat](#beginning-with-concat) 4. [Usage - Configuration options and additional functionality](#usage) 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference) * [Removed functionality](#removed-functionality) 6. [Limitations - OS compatibility, etc.](#limitations) 7. [Development - Guide for contributing to the module](#development) ## Overview The concat module lets you construct files from multiple ordered fragments of text. ## Module Description The concat module lets you gather `concat::fragment` resources from your other modules and order them into a coherent file through a single `concat` resource. ### Beginning with concat To start using concat you need to create: * A concat{} resource for the final file. * One or more concat::fragment{}s. A minimal example might be: ~~~ concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target => '/tmp/file', content => 'test contents', order => '01' } ~~~ ## Usage ### Maintain a list of the major modules on a node To maintain an motd file that lists the modules on one of your nodes, first create a class to frame up the file: ~~~ class motd { $motd = '/etc/motd' concat { $motd: owner => 'root', group => 'root', mode => '0644' } concat::fragment { 'motd_header': target => $motd, content => "\nPuppet modules on this server:\n\n", order => '01' } # let local users add to the motd by creating a file called # /etc/motd.local concat::fragment { 'motd_local': target => $motd, source => '/etc/motd.local', order => '15' } } # let other modules register themselves in the motd define motd::register ( $content = "", $order = '10', ) { if $content == "" { $body = $name } else { $body = $content } concat::fragment { "motd_fragment_$name": target => '/etc/motd', order => $order, content => " -- $body\n" } } ~~~ Then, in the declarations for each module on the node, add `motd::register{ 'Apache': }` to register the module in the motd. ~~~ class apache { include apache::install, apache::config, apache::service motd::register { 'Apache': } } ~~~ These two steps populate the /etc/motd file with a list of the installed and registered modules, which stays updated even if you just remove the registered modules' `include` lines. System administrators can append text to the list by writing to /etc/motd.local. When you're finished, the motd file will look something like this: ~~~ Puppet modules on this server: -- Apache -- MySQL ~~~ ## Reference See [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-concat/blob/main/REFERENCE.md) ### Removed functionality The following functionality existed in previous versions of the concat module, but was removed in version 2.0.0: Parameters removed from `concat::fragment`: * `gnu` * `backup` * `group` * `mode` * `owner` The `concat::setup` class has also been removed. Prior to concat version 2.0.0, if you set the `warn` parameter to a string value of `true`, `false`, 'yes', 'no', 'on', or 'off', the module translated the string to the corresponding boolean value. In concat version 2.0.0 and newer, the `warn_header` parameter treats those values the same as other strings and uses them as the content of your header message. To avoid that, pass the `true` and `false` values as booleans instead of strings. ## Limitations This module has been tested on [all PE-supported platforms](https://forge.puppetlabs.com/supported#compat-matrix), and no issues have been identified. For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-concat/blob/main/metadata.json) ## Development Acceptance tests for this module leverage [puppet_litmus](https://github.com/puppetlabs/puppet_litmus). To run the acceptance tests follow the instructions [here](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module). You can also find a tutorial and walkthrough of using Litmus and the PDK on [YouTube](https://www.youtube.com/watch?v=FYfR7ZEGHoE). If you run into an issue with this module, or if you would like to request a feature, please [file a ticket](https://tickets.puppetlabs.com/browse/MODULES/). Every Monday the Puppet IA Content Team has [office hours](https://puppet.com/community/office-hours) in the [Puppet Community Slack](http://slack.puppet.com/), alternating between an EMEA friendly time (1300 UTC) and an Americas friendly time (0900 Pacific, 1700 UTC). If you have problems getting this module up and running, please [contact Support](http://puppetlabs.com/services/customer-support). If you submit a change to this module, be sure to regenerate the reference documentation as follows: ```bash puppet strings generate --format markdown --out REFERENCE.md ``` ### Contributors Richard Pijnenburg ([@Richardp82](http://twitter.com/richardp82)) Joshua Hoblitt ([@jhoblitt](http://twitter.com/jhoblitt)) [More contributors](https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors). puppetlabs-concat-7.3.1/REFERENCE.md000066400000000000000000000361551437144444600170130ustar00rootroot00000000000000# Reference ## Table of Contents ### Defined types * [`concat`](#concat): Manages a file, compiled from one or more text fragments. * [`concat::fragment`](#concat--fragment): Manages a fragment of text to be compiled into a file. ### Resource types * [`concat_file`](#concat_file): Generates a file with content from fragments sharing a common unique tag. * [`concat_fragment`](#concat_fragment): Manages the fragment. ## Defined types ### `concat` Manages a file, compiled from one or more text fragments. #### Examples ##### ```puppet concat { '/tmp/concat': ensure => present, owner => 'root', group => 'root', mode => '0644', } ``` #### Parameters The following parameters are available in the `concat` defined type: * [`backup`](#-concat--backup) * [`ensure`](#-concat--ensure) * [`ensure_newline`](#-concat--ensure_newline) * [`format`](#-concat--format) * [`force`](#-concat--force) * [`group`](#-concat--group) * [`mode`](#-concat--mode) * [`order`](#-concat--order) * [`owner`](#-concat--owner) * [`path`](#-concat--path) * [`replace`](#-concat--replace) * [`selinux_ignore_defaults`](#-concat--selinux_ignore_defaults) * [`selrange`](#-concat--selrange) * [`selrole`](#-concat--selrole) * [`seltype`](#-concat--seltype) * [`seluser`](#-concat--seluser) * [`show_diff`](#-concat--show_diff) * [`validate_cmd`](#-concat--validate_cmd) * [`warn`](#-concat--warn) ##### `backup` Data type: `Variant[Boolean, String]` Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's native file resource for execution. Valid options: true, false, or a string representing either a target filebucket or a filename extension beginning with ".". Default value: `'puppet'` ##### `ensure` Data type: `Enum['present', 'absent']` Specifies whether the destination file should exist. Setting to 'absent' tells Puppet to delete the destination file if it exists, and negates the effect of any other parameters. Default value: `'present'` ##### `ensure_newline` Data type: `Boolean` Specifies whether to add a line break at the end of each fragment that doesn't already end in one. Default value: `false` ##### `format` Data type: `Optional[String]` Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'. Default value: `'plain'` ##### `force` Data type: `Optional[Boolean]` Specifies whether to merge data structures, keeping the values with higher order. Used when format is specified as a value other than 'plain'. Default value: `false` ##### `group` Data type: `Optional[Variant[String, Integer]]` Specifies a permissions group for the destination file. Valid options: a string containing a group name or integer containing a gid. Default value: `undef` ##### `mode` Data type: `String` Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation. Default value: `'0644'` ##### `order` Data type: `Enum['alpha','numeric']` Specifies a method for sorting your fragments by name within the destination file. You can override this setting for individual fragments by adjusting the order parameter in their concat::fragment declarations. Default value: `'alpha'` ##### `owner` Data type: `Optional[Variant[String, Integer]]` Specifies the owner of the destination file. Valid options: a string containing a username or integer containing a uid. Default value: `undef` ##### `path` Data type: `Stdlib::Absolutepath` Specifies a destination file for the combined fragments. Default value: `$name` ##### `replace` Data type: `Boolean` Specifies whether to overwrite the destination file if it already exists. Default value: `true` ##### `selinux_ignore_defaults` Data type: `Optional[Boolean]` See the file type's selinux_ignore_defaults documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults Default value: `undef` ##### `selrange` Data type: `Optional[String]` See the file type's selrange documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange Default value: `undef` ##### `selrole` Data type: `Optional[String]` See the file type's selrole documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole Default value: `undef` ##### `seltype` Data type: `Optional[String]` See the file type's seltype documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype Default value: `undef` ##### `seluser` Data type: `Optional[String]` See the file type's seluser documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser Default value: `undef` ##### `show_diff` Data type: `Boolean` Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure reporting methods. Default value: `true` ##### `validate_cmd` Data type: `Optional[String]` Specifies a validation command to apply to the destination file. Default value: `undef` ##### `warn` Data type: `Variant[Boolean, String]` Specifies whether to add a header message at the top of the destination file. Valid options: the booleans true and false, or a string to serve as the header. If you set 'warn' to true, concat adds the following line with an order of 0: `# This file is managed by Puppet. DO NOT EDIT.` Before 2.0.0, this parameter would add a newline at the end of the warn message. To improve flexibilty, this was removed. Please add it explicitly if you need it. Default value: `false` ### `concat::fragment` Manages a fragment of text to be compiled into a file. #### Parameters The following parameters are available in the `concat::fragment` defined type: * [`content`](#-concat--fragment--content) * [`order`](#-concat--fragment--order) * [`source`](#-concat--fragment--source) * [`target`](#-concat--fragment--target) ##### `content` Data type: `Optional[Any]` Supplies the content of the fragment. Note: You must supply either a content parameter or a source parameter. Allows a String or a Deferred function which returns a String. Default value: `undef` ##### `order` Data type: `Variant[String, Integer]` Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. The string option is recommended. Default value: `'10'` ##### `source` Data type: `Optional[Variant[String, Array]]` Specifies a file to read into the content of the fragment. Note: You must supply either a content parameter or a source parameter. Valid options: a string or an array, containing one or more Puppet URLs. Default value: `undef` ##### `target` Data type: `String` Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource. ## Resource types ### `concat_file` Generates a file with content from fragments sharing a common unique tag. #### Examples ##### ```puppet Concat_fragment <<| tag == 'unique_tag' |>> concat_file { '/tmp/file': tag => 'unique_tag', # Optional. Default to undef path => '/tmp/file', # Optional. If given it overrides the resource name owner => 'root', # Optional. Default to undef group => 'root', # Optional. Default to undef mode => '0644' # Optional. Default to undef order => 'numeric' # Optional, Default to 'numeric' ensure_newline => false # Optional, Defaults to false } ``` #### Properties The following properties are available in the `concat_file` type. ##### `ensure` Valid values: `present`, `absent` Specifies whether the destination file should exist. Setting to 'absent' tells Puppet to delete the destination file if it exists, and negates the effect of any other parameters. Default value: `present` #### Parameters The following parameters are available in the `concat_file` type. * [`backup`](#-concat_file--backup) * [`ensure_newline`](#-concat_file--ensure_newline) * [`force`](#-concat_file--force) * [`format`](#-concat_file--format) * [`group`](#-concat_file--group) * [`mode`](#-concat_file--mode) * [`order`](#-concat_file--order) * [`owner`](#-concat_file--owner) * [`path`](#-concat_file--path) * [`replace`](#-concat_file--replace) * [`selinux_ignore_defaults`](#-concat_file--selinux_ignore_defaults) * [`selrange`](#-concat_file--selrange) * [`selrole`](#-concat_file--selrole) * [`seltype`](#-concat_file--seltype) * [`seluser`](#-concat_file--seluser) * [`show_diff`](#-concat_file--show_diff) * [`tag`](#-concat_file--tag) * [`validate_cmd`](#-concat_file--validate_cmd) ##### `backup` Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's native file resource for execution. Valid options: true, false, or a string representing either a target filebucket or a filename extension beginning with ".".' ##### `ensure_newline` Valid values: `true`, `false`, `yes`, `no` Specifies whether to add a line break at the end of each fragment that doesn't already end in one. Default value: `false` ##### `force` Valid values: `true`, `false`, `yes`, `no` Specifies whether to merge data structures, keeping the values with higher order. Default value: `false` ##### `format` Valid values: `plain`, `yaml`, `json`, `json-array`, `json-pretty`, `json-array-pretty` Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'. Default value: `plain` ##### `group` Specifies a permissions group for the destination file. Valid options: a string containing a group name or integer containing a gid. ##### `mode` Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation. ##### `order` Valid values: `alpha`, `numeric` Specifies a method for sorting your fragments by name within the destination file. You can override this setting for individual fragments by adjusting the order parameter in their concat::fragment declarations. Default value: `numeric` ##### `owner` Specifies the owner of the destination file. Valid options: a string containing a username or integer containing a uid. ##### `path` Specifies a destination file for the combined fragments. Valid options: a string containing an absolute path. Default value: the title of your declared resource. ##### `replace` Valid values: `true`, `false`, `yes`, `no` Specifies whether to overwrite the destination file if it already exists. Default value: `true` ##### `selinux_ignore_defaults` Valid values: `true`, `false`, `yes`, `no` See the file type's selinux_ignore_defaults documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults. ##### `selrange` See the file type's selrange documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange ##### `selrole` See the file type's selrole documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole ##### `seltype` See the file type's seltype documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype ##### `seluser` See the file type's seluser documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser ##### `show_diff` Valid values: `true`, `false`, `yes`, `no` Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure reporting methods. ##### `tag` Required. Specifies a unique tag reference to collect all concat_fragments with the same tag. ##### `validate_cmd` Specifies a validation command to apply to the destination file. Requires Puppet version 3.5 or newer. Valid options: a string to be passed to a file resource. ### `concat_fragment` Manages the fragment. #### Examples ##### ```puppet # The example is based on exported resources. concat_fragment { \"uniqe_name_${::fqdn}\": tag => 'unique_name', order => 10, # Optional. Default to 10 content => 'some content' # OR # content => template('template.erb') source => 'puppet:///path/to/file' } ``` #### Parameters The following parameters are available in the `concat_fragment` type. * [`content`](#-concat_fragment--content) * [`name`](#-concat_fragment--name) * [`order`](#-concat_fragment--order) * [`source`](#-concat_fragment--source) * [`tag`](#-concat_fragment--tag) * [`target`](#-concat_fragment--target) ##### `content` Supplies the content of the fragment. Note: You must supply either a content parameter or a source parameter. Valid options: a string ##### `name` namevar Name of resource. ##### `order` Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. The string option is recommended. Default value: `10` ##### `source` Specifies a file to read into the content of the fragment. Note: You must supply either a content parameter or a source parameter. Valid options: a string or an array, containing one or more Puppet URLs. ##### `tag` Specifies a unique tag to be used by concat_file to reference and collect content. ##### `target` Required. Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat_file resource. puppetlabs-concat-7.3.1/Rakefile000066400000000000000000000067371437144444600166430ustar00rootroot00000000000000# frozen_string_literal: true require 'bundler' require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any? require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-syntax/tasks/puppet-syntax' require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any? require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any? require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any? def changelog_user return unless Rake.application.top_level_tasks.include? "changelog" returnVal = nil || JSON.load(File.read('metadata.json'))['author'] raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil? puts "GitHubChangelogGenerator user:#{returnVal}" returnVal end def changelog_project return unless Rake.application.top_level_tasks.include? "changelog" returnVal = nil returnVal ||= begin metadata_source = JSON.load(File.read('metadata.json'))['source'] metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z}) metadata_source_match && metadata_source_match[1] end raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil? puts "GitHubChangelogGenerator project:#{returnVal}" returnVal end def changelog_future_release return unless Rake.application.top_level_tasks.include? "changelog" returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version'] raise "unable to find the future_release (version) in metadata.json" if returnVal.nil? puts "GitHubChangelogGenerator future_release:#{returnVal}" returnVal end PuppetLint.configuration.send('disable_relative') if Bundler.rubygems.find_name('github_changelog_generator').any? GitHubChangelogGenerator::RakeTask.new :changelog do |config| raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil? config.user = "#{changelog_user}" config.project = "#{changelog_project}" config.future_release = "#{changelog_future_release}" config.exclude_labels = ['maintenance'] config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)." config.add_pr_wo_labels = true config.issues = false config.merge_prefix = "### UNCATEGORIZED PRS; LABEL THEM ON GITHUB" config.configure_sections = { "Changed" => { "prefix" => "### Changed", "labels" => ["backwards-incompatible"], }, "Added" => { "prefix" => "### Added", "labels" => ["enhancement", "feature"], }, "Fixed" => { "prefix" => "### Fixed", "labels" => ["bug", "documentation", "bugfix"], }, } end else desc 'Generate a Changelog from GitHub' task :changelog do raise < 1.15' condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.3.0')" EOM end end puppetlabs-concat-7.3.1/data/000077500000000000000000000000001437144444600160725ustar00rootroot00000000000000puppetlabs-concat-7.3.1/data/common.yaml000066400000000000000000000000071437144444600202430ustar00rootroot00000000000000--- {} puppetlabs-concat-7.3.1/examples/000077500000000000000000000000001437144444600167775ustar00rootroot00000000000000puppetlabs-concat-7.3.1/examples/format.pp000066400000000000000000000003701437144444600206300ustar00rootroot00000000000000concat { '/tmp/file': format => 'yaml', # See REFERENCE.md for more formats } concat::fragment { '1': target => '/tmp/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '/tmp/file', content => '{"two": "bar"}', } puppetlabs-concat-7.3.1/examples/fragment.pp000066400000000000000000000005371437144444600211500ustar00rootroot00000000000000concat { 'testconcat': ensure => present, path => '/tmp/concat', owner => 'root', group => 'root', mode => '0664', show_diff => true, } concat::fragment { '1': target => 'testconcat', content => '1', order => '01', } concat::fragment { '2': target => 'testconcat', content => '2', order => '02', } puppetlabs-concat-7.3.1/examples/init.pp000066400000000000000000000001531437144444600203020ustar00rootroot00000000000000concat { '/tmp/concat': ensure => present, owner => 'root', group => 'root', mode => '0644', } puppetlabs-concat-7.3.1/hiera.yaml000066400000000000000000000012551437144444600171400ustar00rootroot00000000000000--- version: 5 defaults: # Used for any hierarchy level that omits these keys. datadir: data # This path is relative to hiera.yaml's directory. data_hash: yaml_data # Use the built-in YAML backend. hierarchy: - name: "osfamily/major release" paths: # Used to distinguish between Debian and Ubuntu - "os/%{facts.os.name}/%{facts.os.release.major}.yaml" - "os/%{facts.os.family}/%{facts.os.release.major}.yaml" # Used for Solaris - "os/%{facts.os.family}/%{facts.kernelrelease}.yaml" - name: "osfamily" paths: - "os/%{facts.os.name}.yaml" - "os/%{facts.os.family}.yaml" - name: 'common' path: 'common.yaml' puppetlabs-concat-7.3.1/lib/000077500000000000000000000000001437144444600157275ustar00rootroot00000000000000puppetlabs-concat-7.3.1/lib/puppet/000077500000000000000000000000001437144444600172445ustar00rootroot00000000000000puppetlabs-concat-7.3.1/lib/puppet/type/000077500000000000000000000000001437144444600202255ustar00rootroot00000000000000puppetlabs-concat-7.3.1/lib/puppet/type/concat_file.rb000066400000000000000000000262201437144444600230220ustar00rootroot00000000000000# frozen_string_literal: true require 'puppet/type/file/owner' require 'puppet/type/file/group' require 'puppet/type/file/mode' require 'puppet/util/checksums' Puppet::Type.newtype(:concat_file) do @doc = <<-DOC @summary Generates a file with content from fragments sharing a common unique tag. @example Concat_fragment <<| tag == 'unique_tag' |>> concat_file { '/tmp/file': tag => 'unique_tag', # Optional. Default to undef path => '/tmp/file', # Optional. If given it overrides the resource name owner => 'root', # Optional. Default to undef group => 'root', # Optional. Default to undef mode => '0644' # Optional. Default to undef order => 'numeric' # Optional, Default to 'numeric' ensure_newline => false # Optional, Defaults to false } DOC ensurable do desc <<-DOC Specifies whether the destination file should exist. Setting to 'absent' tells Puppet to delete the destination file if it exists, and negates the effect of any other parameters. DOC defaultvalues defaultto { :present } end def exists? self[:ensure] == :present end newparam(:tag) do desc 'Required. Specifies a unique tag reference to collect all concat_fragments with the same tag.' end newparam(:path, namevar: true) do desc <<-DOC Specifies a destination file for the combined fragments. Valid options: a string containing an absolute path. Default value: the title of your declared resource. DOC validate do |value| unless Puppet::Util.absolute_path?(value, :posix) || Puppet::Util.absolute_path?(value, :windows) raise ArgumentError, _("File paths must be fully qualified, not '%{_value}'") % { _value: value } end end end newparam(:owner, parent: Puppet::Type::File::Owner) do desc <<-DOC Specifies the owner of the destination file. Valid options: a string containing a username or integer containing a uid. DOC end newparam(:group, parent: Puppet::Type::File::Group) do desc <<-DOC Specifies a permissions group for the destination file. Valid options: a string containing a group name or integer containing a gid. DOC end newparam(:mode, parent: Puppet::Type::File::Mode) do desc <<-DOC Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation. DOC end newparam(:order) do desc <<-DOC Specifies a method for sorting your fragments by name within the destination file. You can override this setting for individual fragments by adjusting the order parameter in their concat::fragment declarations. DOC newvalues(:alpha, :numeric) defaultto :numeric end newparam(:backup) do desc <<-DOC Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's native file resource for execution. Valid options: true, false, or a string representing either a target filebucket or a filename extension beginning with ".".' DOC validate do |value| unless [TrueClass, FalseClass, String].include?(value.class) raise ArgumentError, _('Backup must be a Boolean or String') end end end newparam(:replace, boolean: true, parent: Puppet::Parameter::Boolean) do desc 'Specifies whether to overwrite the destination file if it already exists.' defaultto true end newparam(:validate_cmd) do desc <<-DOC Specifies a validation command to apply to the destination file. Requires Puppet version 3.5 or newer. Valid options: a string to be passed to a file resource. DOC validate do |value| unless value.is_a?(String) raise ArgumentError, _('Validate_cmd must be a String') end end end newparam(:ensure_newline, boolean: true, parent: Puppet::Parameter::Boolean) do desc "Specifies whether to add a line break at the end of each fragment that doesn't already end in one." defaultto false end newparam(:format) do desc <<-DOC Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', 'json-array-pretty'. DOC newvalues(:plain, :yaml, :json, :'json-array', :'json-pretty', :'json-array-pretty') defaultto :plain end newparam(:force, boolean: true, parent: Puppet::Parameter::Boolean) do desc 'Specifies whether to merge data structures, keeping the values with higher order.' defaultto false end newparam(:selinux_ignore_defaults, boolean: true, parent: Puppet::Parameter::Boolean) do desc <<-DOC See the file type's selinux_ignore_defaults documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults. DOC end newparam(:selrange) do desc "See the file type's selrange documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange" validate do |value| raise ArgumentError, _('Selrange must be a String') unless value.is_a?(String) end end newparam(:selrole) do desc "See the file type's selrole documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole" validate do |value| raise ArgumentError, _('Selrole must be a String') unless value.is_a?(String) end end newparam(:seltype) do desc "See the file type's seltype documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype" validate do |value| raise ArgumentError, _('Seltype must be a String') unless value.is_a?(String) end end newparam(:seluser) do desc "See the file type's seluser documentation: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser" validate do |value| raise ArgumentError, _('Seluser must be a String') unless value.is_a?(String) end end newparam(:show_diff, boolean: true, parent: Puppet::Parameter::Boolean) do desc <<-DOC Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure reporting methods. DOC end # Autorequire the file we are generating below # Why is this necessary ? autorequire(:file) do [self[:path]] end def fragments # Collect fragments that target this resource by path, title or tag. @fragments ||= catalog.resources.map { |resource| next unless resource.is_a?(Puppet::Type.type(:concat_fragment)) if resource[:target] == self[:path] || resource[:target] == title || (resource[:tag] && resource[:tag] == self[:tag]) resource end }.compact end def decompound(d) d.split('___', 2).map { |v| (v =~ %r{^\d+$}) ? v.to_i : v } end def should_content return @generated_content if @generated_content @generated_content = '' content_fragments = [] fragments.each do |r| content_fragments << ["#{r[:order]}___#{r[:name]}", fragment_content(r)] end sorted = if self[:order] == :numeric content_fragments.sort do |a, b| decompound(a[0]) <=> decompound(b[0]) end else content_fragments.sort_by do |a| a_order, a_name = a[0].split('__', 2) [a_order, a_name] end end case self[:format] when :plain @generated_content = sorted.map { |cf| cf[1] }.join when :yaml content_array = sorted.map do |cf| YAML.safe_load(cf[1]) end content_hash = content_array.reduce({}) do |memo, current| nested_merge(memo, current) end @generated_content = content_hash.to_yaml when :json, :'json-array', :'json-pretty', :'json-array-pretty' content_array = sorted.map do |cf| JSON.parse(cf[1]) end if [:json, :'json-pretty'].include?(self[:format]) content_hash = content_array.reduce({}) do |memo, current| nested_merge(memo, current) end @generated_content = if self[:format] == :json content_hash.to_json else JSON.pretty_generate(content_hash) end else @generated_content = if self[:format] == :'json-array' content_array.to_json else JSON.pretty_generate(content_array) end end end @generated_content end def nested_merge(hash1, hash2) # If a hash is nil or empty, simply return the other return hash1 if hash2.nil? || hash2.empty? return hash2 if hash1.nil? || hash1.empty? # Unique merge for arrays if hash1.is_a?(Array) && hash2.is_a?(Array) return (hash1 + hash2).uniq end # Deep-merge Hashes; higher order value is kept hash1.merge(hash2) do |k, v1, v2| if v1.is_a?(Hash) && v2.is_a?(Hash) nested_merge(v1, v2) elsif v1.is_a?(Array) && v2.is_a?(Array) nested_merge(v1, v2) else # Fail if there are duplicate keys without force unless v1 == v2 unless self[:force] err_message = [ "Duplicate key '#{k}' found with values '#{v1}' and #{v2}'.", "Use 'force' attribute to merge keys.", ] raise(_(err_message.join(' '))) end Puppet.debug("Key '#{k}': replacing '#{v2}' with '#{v1}'.") end v1 end end end def fragment_content(r) if r[:content].nil? == false fragment_content = r[:content] elsif r[:source].nil? == false @source = nil Array(r[:source]).each do |source| if Puppet::FileServing::Metadata.indirection.find(source) @source = source break end end raise _('Could not retrieve source(s) %{_array}') % { _array: Array(r[:source]).join(', ') } unless @source tmp = Puppet::FileServing::Content.indirection.find(@source) fragment_content = tmp.content unless tmp.nil? end if self[:ensure_newline] newline = Puppet::Util::Platform.windows? ? "\r\n" : "\n" fragment_content << newline unless %r{#{newline}\Z}.match?(fragment_content) end fragment_content end def generate file_opts = { ensure: (self[:ensure] == :absent) ? :absent : :file, } [:path, :owner, :group, :mode, :replace, :backup, :selinux_ignore_defaults, :selrange, :selrole, :seltype, :seluser, :validate_cmd, :show_diff].each do |param| file_opts[param] = self[param] unless self[param].nil? end excluded_metaparams = [:before, :notify, :require, :subscribe, :tag] Puppet::Type.metaparams.each do |metaparam| unless self[metaparam].nil? || excluded_metaparams.include?(metaparam) file_opts[metaparam] = self[metaparam] end end [Puppet::Type.type(:file).new(file_opts)] end def eval_generate content = should_content unless content.nil? catalog.resource("File[#{self[:path]}]")[:content] = content end [catalog.resource("File[#{self[:path]}]")] end end puppetlabs-concat-7.3.1/lib/puppet/type/concat_fragment.rb000066400000000000000000000062361437144444600237130ustar00rootroot00000000000000# frozen_string_literal: true Puppet::Type.newtype(:concat_fragment) do @doc = <<-DOC @summary Manages the fragment. @example # The example is based on exported resources. concat_fragment { \"uniqe_name_${::fqdn}\": tag => 'unique_name', order => 10, # Optional. Default to 10 content => 'some content' # OR # content => template('template.erb') source => 'puppet:///path/to/file' } DOC newparam(:name, namevar: true) do desc 'Name of resource.' end newparam(:target) do desc <<-DOC Required. Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat_file resource. DOC validate do |value| raise ArgumentError, _('Target must be a String') unless value.is_a?(String) end end newparam(:content) do desc <<-DOC Supplies the content of the fragment. Note: You must supply either a content parameter or a source parameter. Valid options: a string DOC validate do |value| raise ArgumentError, _('Content must be a String') unless value.is_a?(String) end end newparam(:source) do desc <<-DOC Specifies a file to read into the content of the fragment. Note: You must supply either a content parameter or a source parameter. Valid options: a string or an array, containing one or more Puppet URLs. DOC validate do |value| raise ArgumentError, _('Content must be a String or Array') unless [String, Array].include?(value.class) end end newparam(:order) do desc <<-DOC Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. The string option is recommended. DOC defaultto '10' validate do |val| raise Puppet::ParseError, _('$order is not a string or integer.') unless val.is_a?(String) || val.is_a?(Integer) raise Puppet::ParseError, _('Order cannot contain \'/\', \':\', or \'\\n\'.') if %r{[:\n\/]}.match?(val.to_s) end end newparam(:tag) do desc 'Specifies a unique tag to be used by concat_file to reference and collect content.' end autorequire(:file) do found = catalog.resources.select do |resource| next unless resource.is_a?(Puppet::Type.type(:concat_file)) resource[:path] == self[:target] || resource.title == self[:target] || (resource[:tag] && resource[:tag] == self[:tag]) end if found.empty? tag_message = (self[:tag]) ? "or tag '#{self[:tag]} " : '' warning "Target Concat_file with path or title '#{self[:target]}' #{tag_message}not found in the catalog" end end validate do # Check if target is set raise Puppet::ParseError, _("No 'target' or 'tag' set") unless self[:target] || self[:tag] # Check if either source or content is set. raise error if none is set raise Puppet::ParseError, _("Set either 'source' or 'content'") if self[:source].nil? && self[:content].nil? # Check if both are set, if so rais error raise Puppet::ParseError, _("Can't use 'source' and 'content' at the same time") if !self[:source].nil? && !self[:content].nil? end end puppetlabs-concat-7.3.1/manifests/000077500000000000000000000000001437144444600171525ustar00rootroot00000000000000puppetlabs-concat-7.3.1/manifests/fragment.pp000066400000000000000000000040631437144444600213210ustar00rootroot00000000000000# @summary # Manages a fragment of text to be compiled into a file. # # @param content # Supplies the content of the fragment. Note: You must supply either a content parameter or a source parameter. # Allows a String or a Deferred function which returns a String. # # @param order # Reorders your fragments within the destination file. Fragments that share the same order number are ordered by name. The string # option is recommended. # # @param source # Specifies a file to read into the content of the fragment. Note: You must supply either a content parameter or a source parameter. # Valid options: a string or an array, containing one or more Puppet URLs. # # @param target # Specifies the destination file of the fragment. Valid options: a string containing the path or title of the parent concat resource. # define concat::fragment ( String $target, Optional[Any] $content = undef, Optional[Variant[String, Array]] $source = undef, Variant[String, Integer] $order = '10', ) { $resource = 'Concat::Fragment' if ($order =~ String and $order =~ /[:\n\/]/) { fail("${resource}['${title}']: 'order' cannot contain '/', ':', or '\\n'.") } if ! ($content or $source) { crit('No content, source or symlink specified') } elsif ($content and $source) { fail("${resource}['${title}']: Can't use 'source' and 'content' at the same time.") } # $serverversion is empty on 'puppet apply' runs. Just use clientversion. $_serverversion = getvar('serverversion') ? { undef => $clientversion, default => $serverversion, } if versioncmp($clientversion, '6.0') >= 0 and versioncmp($_serverversion, '6.0') >= 0 { assert_type(Optional[Variant[String, Deferred]], $content) } else { assert_type(Optional[String], $content) } $safe_target_name = regsubst($target, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'GM') concat_fragment { $name: target => $target, tag => $safe_target_name, order => $order, content => $content, source => $source, } } puppetlabs-concat-7.3.1/manifests/init.pp000066400000000000000000000147011437144444600204610ustar00rootroot00000000000000# @summary # Manages a file, compiled from one or more text fragments. # # @example # concat { '/tmp/concat': # ensure => present, # owner => 'root', # group => 'root', # mode => '0644', # } # # @param backup # Specifies whether (and how) to back up the destination file before overwriting it. Your value gets passed on to Puppet's native file # resource for execution. Valid options: true, false, or a string representing either a target filebucket or a filename extension # beginning with ".". # # @param ensure # Specifies whether the destination file should exist. Setting to 'absent' tells Puppet to delete the destination file if it exists, and # negates the effect of any other parameters. # # @param ensure_newline # Specifies whether to add a line break at the end of each fragment that doesn't already end in one. # # @param format # Specify what data type to merge the fragments as. Valid options: 'plain', 'yaml', 'json', 'json-array', 'json-pretty', # 'json-array-pretty'. # # @param force # Specifies whether to merge data structures, keeping the values with higher order. Used when format is specified as a value other than # 'plain'. # # @param group # Specifies a permissions group for the destination file. Valid options: a string containing a group name or integer containing a gid. # # @param mode # Specifies the permissions mode of the destination file. Valid options: a string containing a permission mode value in octal notation. # # @param order # Specifies a method for sorting your fragments by name within the destination file. You can override this setting for individual # fragments by adjusting the order parameter in their concat::fragment declarations. # # @param owner # Specifies the owner of the destination file. Valid options: a string containing a username or integer containing a uid. # # @param path # Specifies a destination file for the combined fragments. # # @param replace # Specifies whether to overwrite the destination file if it already exists. # # @param selinux_ignore_defaults # See the file type's selinux_ignore_defaults documentention: # https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selinux_ignore_defaults # # @param selrange # See the file type's selrange documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrange # # @param selrole # See the file type's selrole documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-selrole # # @param seltype # See the file type's seltype documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seltype # # @param seluser # See the file type's seluser documentention: https://docs.puppetlabs.com/references/latest/type.html#file-attribute-seluser # # @param show_diff # Specifies whether to set the show_diff parameter for the file resource. Useful for hiding secrets stored in hiera from insecure # reporting methods. # # @param validate_cmd # Specifies a validation command to apply to the destination file. # # @param warn # Specifies whether to add a header message at the top of the destination file. Valid options: the booleans true and false, or a string # to serve as the header. # If you set 'warn' to true, concat adds the following line with an order of 0: # `# This file is managed by Puppet. DO NOT EDIT.` # Before 2.0.0, this parameter would add a newline at the end of the warn message. To improve flexibilty, this was removed. Please add # it explicitly if you need it. # define concat ( Enum['present', 'absent'] $ensure = 'present', Stdlib::Absolutepath $path = $name, Optional[Variant[String, Integer]] $owner = undef, Optional[Variant[String, Integer]] $group = undef, String $mode = '0644', Variant[Boolean, String] $warn = false, Boolean $show_diff = true, Variant[Boolean, String] $backup = 'puppet', Boolean $replace = true, Enum['alpha','numeric'] $order = 'alpha', Boolean $ensure_newline = false, Optional[String] $validate_cmd = undef, Optional[Boolean] $selinux_ignore_defaults = undef, Optional[String] $selrange = undef, Optional[String] $selrole = undef, Optional[String] $seltype = undef, Optional[String] $seluser = undef, Optional[String] $format = 'plain', Optional[Boolean] $force = false, ) { $safe_name = regsubst($name, '[\\\\/:~\n\s\+\*\(\)@]', '_', 'G') $default_warn_message = "# This file is managed by Puppet. DO NOT EDIT.\n" case $warn { true: { $warn_message = $default_warn_message $_append_header = true } false: { $warn_message = '' $_append_header = false } default: { $warn_message = $warn $_append_header = true } } if $ensure == 'present' { concat_file { $name: tag => $safe_name, path => $path, owner => $owner, group => $group, mode => $mode, selinux_ignore_defaults => $selinux_ignore_defaults, selrange => $selrange, selrole => $selrole, seltype => $seltype, seluser => $seluser, replace => $replace, backup => $backup, show_diff => $show_diff, order => $order, ensure_newline => $ensure_newline, validate_cmd => $validate_cmd, format => $format, force => $force, } if $_append_header { concat_fragment { "${name}_header": target => $name, tag => $safe_name, content => $warn_message, order => '0', } } } else { concat_file { $name: ensure => $ensure, tag => $safe_name, path => $path, backup => $backup, } } } puppetlabs-concat-7.3.1/metadata.json000066400000000000000000000042351437144444600176400ustar00rootroot00000000000000{ "name": "puppetlabs-concat", "version": "7.3.1", "author": "puppetlabs", "summary": "Construct files from multiple fragments.", "license": "Apache-2.0", "source": "https://github.com/puppetlabs/puppetlabs-concat", "project_page": "https://github.com/puppetlabs/puppetlabs-concat", "issues_url": "https://tickets.puppetlabs.com/browse/MODULES", "dependencies": [ { "name": "puppetlabs/stdlib", "version_requirement": ">= 4.13.1 < 9.0.0" } ], "operatingsystem_support": [ { "operatingsystem": "RedHat", "operatingsystemrelease": [ "7", "8", "9" ] }, { "operatingsystem": "CentOS", "operatingsystemrelease": [ "7", "8" ] }, { "operatingsystem": "OracleLinux", "operatingsystemrelease": [ "7" ] }, { "operatingsystem": "Scientific", "operatingsystemrelease": [ "7" ] }, { "operatingsystem": "SLES", "operatingsystemrelease": [ "12", "15" ] }, { "operatingsystem": "Debian", "operatingsystemrelease": [ "10", "11" ] }, { "operatingsystem": "Ubuntu", "operatingsystemrelease": [ "18.04", "20.04", "22.04" ] }, { "operatingsystem": "Solaris", "operatingsystemrelease": [ "11" ] }, { "operatingsystem": "Windows", "operatingsystemrelease": [ "10", "2012 R2 Core", "2012", "2012 R2", "2016", "2022" ] }, { "operatingsystem": "AIX", "operatingsystemrelease": [ "7.1" ] }, { "operatingsystem": "Rocky", "operatingsystemrelease": [ "8" ] }, { "operatingsystem": "AlmaLinux", "operatingsystemrelease": [ "8" ] } ], "requirements": [ { "name": "puppet", "version_requirement": ">= 6.0.0 < 8.0.0" } ], "template-url": "https://github.com/puppetlabs/pdk-templates.git#main", "template-ref": "heads/main-0-g9375381", "pdk-version": "2.6.1" } puppetlabs-concat-7.3.1/pdk.yaml000066400000000000000000000000171437144444600166210ustar00rootroot00000000000000--- ignore: [] puppetlabs-concat-7.3.1/provision.yaml000066400000000000000000000030511437144444600200740ustar00rootroot00000000000000--- default: provisioner: docker images: - litmusimage/centos:7 vagrant: provisioner: vagrant images: - centos/7 - generic/ubuntu1804 - gusztavvargadr/windows-server travis_deb: provisioner: docker images: - litmusimage/debian:8 - litmusimage/debian:9 - litmusimage/debian:10 travis_ub_6: provisioner: docker images: - litmusimage/ubuntu:14.04 - litmusimage/ubuntu:16.04 - litmusimage/ubuntu:18.04 - litmusimage/ubuntu:20.04 travis_el7: provisioner: docker images: - litmusimage/centos:7 - litmusimage/oraclelinux:7 - litmusimage/scientificlinux:7 travis_el8: provisioner: docker images: - litmusimage/centos:8 release_checks_6: provisioner: abs images: - redhat-6-x86_64 - redhat-7-x86_64 - redhat-8-x86_64 - centos-6-x86_64 - centos-7-x86_64 - centos-8-x86_64 - oracle-5-x86_64 - oracle-6-x86_64 - oracle-7-x86_64 - scientific-6-x86_64 - scientific-7-x86_64 - debian-8-x86_64 - debian-9-x86_64 - debian-10-x86_64 - sles-12-x86_64 - sles-15-x86_64 - ubuntu-1404-x86_64 - ubuntu-1604-x86_64 - ubuntu-1804-x86_64 - ubuntu-2004-x86_64 - win-2008r2-x86_64 - win-2012r2-x86_64 - win-2016-x86_64 - win-10-pro-x86_64 release_checks_7: provisioner: abs images: - redhat-7-x86_64 - redhat-8-x86_64 - centos-7-x86_64 - centos-8-x86_64 - oracle-7-x86_64 - scientific-7-x86_64 - sles-12-x86_64 - sles-15-x86_64 - debian-9-x86_64 - debian-10-x86_64 - ubuntu-1804-x86_64 - ubuntu-2004-x86_64 - win-2012r2-x86_64 - win-2016-x86_64 - win-10-pro-x86_64 puppetlabs-concat-7.3.1/readmes/000077500000000000000000000000001437144444600166015ustar00rootroot00000000000000puppetlabs-concat-7.3.1/readmes/README_ja_JP.md000066400000000000000000000133641437144444600211320ustar00rootroot00000000000000# concat #### 目次 1. [概要](#overview) 2. [説明 - モジュールの機能とその有益性](#module-description) * [concatを開始する](#beginning-with-concat) 4. [使用方法 - 設定オプションと追加機能](#usage) 5. [参考 - モジュールの機能と動作について](#reference) * [削除した機能](#removed-functionality) 6. [制約事項 - OSの互換性など](#limitations) 7. [開発 - モジュール貢献についてのガイド](#development) ## 概要 concatモジュールでは、複数の順序付きテキストフラグメントからファイルを構築できます。 ## モジュールの概要 concatモジュールでは、他のモジュールから`concat::fragment`リソースを収集し、それを単一の`concat` リソースを通じて整合性のあるファイルに並べることができます。 ### concatを開始する concatを開始するには、以下の作成が必要です。 * 最終ファイルのconcat{}リソース。 * 1つ以上のconcat::fragment{}。 最小限の例: ~~~ concat { '/tmp/file': ensure => present, } concat::fragment { 'tmpfile': target => '/tmp/file', content => 'test contents', order => '01' } ~~~ ## 使用方法 ### ノードの主要モジュールのリストを維持します いずれかのノードのモジュールをリストするmotdファイルを維持するには、まずファイルをフレームするクラスを作成します。 ~~~ class motd { $motd = '/etc/motd' concat { $motd: owner => 'root', group => 'root', mode => '0644' } concat::fragment{ 'motd_header': target => $motd, content => "\nPuppet modules on this server:\n\n", order => '01' } # let local users add to the motd by creating a file called # /etc/motd.local concat::fragment{ 'motd_local': target => $motd, source => '/etc/motd.local', order => '15' } } # let other modules register themselves in the motd define motd::register($content="", $order='10') { if $content == "" { $body = $name } else { $body = $content } concat::fragment{ "motd_fragment_$name": target => '/etc/motd', order => $order, content => " -- $body\n" } } ~~~ 次に、ノードの各モジュールの宣言に`motd::register{ 'Apache': }`を追加し、motdのモジュールを登録します。 ~~~ class apache { include apache::install, apache::config, apache::service motd::register{ 'Apache': } } ~~~ これらの2つのステップは、インストールされ、登録されたモジュールのリストを/etc/motdファイルに追加します。このファイルは、登録済みモジュールの`include`行を削除しただけであっても最新の状態を保ちます。システム管理者は、/etc/motd.localに書き込むことでリストにテキストを追加できます。 完成したmotdファイルは、以下のようになります。 ~~~ Puppet modules on this server: -- Apache -- MySQL ~~~ ## リファレンス [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-concat/blob/main/REFERENCE.md)を参照してください。 ### 削除した機能 次の機能は、concatモジュールの過去のバージョンには存在していましたが、バージョン2.0.0では削除されています。 `concat::fragment`から削除されたパラメータ: * `gnu` * `backup` * `group` * `mode` * `owner` `concat::setup`クラスも削除されました。 バージョン2.0.0以前のconcatでは、`warn`パラメータを`true`、`false`、'yes'、'no'、'on'、または'off'の文字列値に設定すると、モジュールは文字列を対応するブール値に変換していました。concatバージョン2.0.0以降では、`warn_header`パラメータはこれらの値を他の文字列と同じように扱い、ヘッダメッセージの内容として使用します。これを回避するには、`true`および`false`値を文字列ではなくブール値として渡します。 ## 制約事項 このモジュールは[PE対応のすべてのプラットフォーム](https://forge.puppetlabs.com/supported#compat-matrix)上でテスト済みであり、問題は発見されていません。 サポートされているオペレーティングシステムの一覧については、[metadata.json](https://github.com/puppetlabs/puppetlabs-concat/blob/main/metadata.json)を参照してください。 ## 開発 Puppet Forge上のPuppetモジュールはオープンプロジェクトであり、その価値を維持するにはコミュニティからの貢献が欠かせません。Puppetが提供する膨大な数のプラットフォームや、無数のハードウェア、ソフトウェア、デプロイ設定に弊社がアクセスすることは不可能です。 弊社は、できるだけ変更に貢献しやすくして、弊社のモジュールがユーザの環境で機能する状態を維持したいと考えています。弊社では、状況を把握できるよう、貢献者に従っていただくべきいくつかのガイドラインを設けています。 詳細については、[モジュール貢献ガイド](https://docs.puppetlabs.com/forge/contributing.html)を参照してください。 ### コントリビュータ Richard Pijnenburg ([@Richardp82](http://twitter.com/richardp82)) Joshua Hoblitt ([@jhoblitt](http://twitter.com/jhoblitt)) [その他のコントリビュータ](https://github.com/puppetlabs/puppetlabs-concat/graphs/contributors) puppetlabs-concat-7.3.1/spec/000077500000000000000000000000001437144444600161135ustar00rootroot00000000000000puppetlabs-concat-7.3.1/spec/acceptance/000077500000000000000000000000001437144444600202015ustar00rootroot00000000000000puppetlabs-concat-7.3.1/spec/acceptance/backup_spec.rb000066400000000000000000000045551437144444600230160ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat backup parameter' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when puppet' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': backup => 'puppet', } concat::fragment { 'new file': target => '#{basedir}/file', content => 'new contents', } MANIFEST end it 'applies the manifest twice with "Filebucketed" stdout and no stderr' do expect(apply_manifest(pp, catch_failures: true, debug: true).stdout).to match(%r{Filebucketed.*to puppet with sum.*}) apply_manifest(pp, catch_changes: true) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match %r{new contents} end end describe 'when .backup' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': backup => '.backup', } concat::fragment { 'new file': target => '#{basedir}/file', content => 'backup extension', } MANIFEST end # XXX Puppet doesn't mention anything about filebucketing with a given # extension like .backup it 'applies the manifest twice no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match %r{backup extension} expect(file("#{basedir}/file.backup")).to be_file expect(file("#{basedir}/file.backup").content).to match %r{new contents} end end # XXX The backup parameter uses validate_string() and thus can't be the # boolean false value, but the string 'false' has the same effect in Puppet 3 describe "when 'false'" do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': backup => '.backup', } concat::fragment { 'new file': target => '#{basedir}/file', content => 'new contents', } MANIFEST end it 'applies the manifest twice with no "Filebucketed" stdout and no stderr' do apply_manifest(pp, catch_failures: true) do |r| expect(r.stdout).not_to match(%r{Filebucketed}) end apply_manifest(pp, catch_changes: true) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match %r{new contents} end end end puppetlabs-concat-7.3.1/spec/acceptance/concat_spec.rb000066400000000000000000000104741437144444600230150ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' case os[:family] when 'aix' username = 'root' groupname = 'system' when 'darwin' username = 'root' groupname = 'wheel' when 'windows' username = 'Administrator' groupname = 'Administrators' else username = 'root' groupname = 'root' end describe 'basic concat test' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'with owner/group root' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat::fragment { '1': target => '#{basedir}/file', content => '1', order => '01', } concat::fragment { '2': target => '#{basedir}/file', content => '2', order => '02', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file")).to be_owned_by username unless os[:family] == 'windows' expect(file("#{basedir}/file")).to be_grouped_into groupname unless os[:family] == 'windows' || os[:family] == 'darwin' expect(file("#{basedir}/file")).to be_mode 644 unless os[:family] == 'aix' || os[:family] == 'windows' expect(file("#{basedir}/file").content).to match '1' expect(file("#{basedir}/file").content).to match '2' end end describe 'when present with path set' do let(:pp) do <<-MANIFEST concat { 'file': ensure => present, path => '#{basedir}/file', mode => '0644', } concat::fragment { '1': target => 'file', content => '1', order => '01', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file")).to be_mode 644 unless os[:family] == 'aix' || os[:family] == 'windows' expect(file("#{basedir}/file").content).to match '1' end end describe 'with no fragments declared' do let(:pp) do <<-MANIFEST concat { 'file': ensure => present, path => '#{basedir}/file', mode => '0644', } MANIFEST end it 'applies manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to eq '' end end describe 'when absent with path set' do let(:pp) do <<-MANIFEST concat { 'file': ensure => absent, path => '#{basedir}/file', mode => '0644', } concat::fragment { '1': target => 'file', content => '1', order => '01', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).not_to be_file end end describe 'when present with path that has special characters' do filename = (os[:family] == 'windows') ? 'file(1)' : 'file(1:2)' let(:pp) do <<-MANIFEST concat { '#{filename}': ensure => present, path => '#{basedir}/#{filename}', mode => '0644', } concat::fragment { '1': target => '#{filename}', content => '1', order => '01', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/#{filename}")).to be_file expect(file("#{basedir}/#{filename}")).to be_mode 644 unless os[:family] == 'aix' || os[:family] == 'windows' expect(file("#{basedir}/#{filename}").content).to match '1' end end describe 'with noop properly' do let(:pp) do <<-MANIFEST concat { 'file': ensure => present, path => '#{basedir}/file', mode => '0644', noop => true, } concat::fragment { '1': target => 'file', content => '1', order => '01', } MANIFEST end it 'applies manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).not_to be_file end end end puppetlabs-concat-7.3.1/spec/acceptance/concurrency_spec.rb000066400000000000000000000015631437144444600240770ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concurrency, with file recursive purge' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when run should still create concat file' do let(:pp) do <<-MANIFEST file { '#{basedir}/bar': ensure => directory, purge => true, recurse => true, } concat { "foobar": ensure => 'present', path => '#{basedir}/bar/foobar', } concat::fragment { 'foo': target => 'foobar', content => 'foo', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/bar/foobar")).to be_file expect(file("#{basedir}/bar/foobar").content).to match 'foo' end end end puppetlabs-concat-7.3.1/spec/acceptance/force_spec.rb000066400000000000000000000104331437144444600226370ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'force merge of file' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when run should not force' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'yaml', force => false, } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": "bar"}', } MANIFEST end it 'applies manifest twice with stderr check' do expect(apply_manifest(pp, catch_failures: true).stderr).to match("Duplicate key 'one' found with values 'foo' and bar'. Use 'force' attribute to merge keys.") expect(apply_manifest(pp, catch_failures: true).stderr).to match("Duplicate key 'one' found with values 'foo' and bar'. Use 'force' attribute to merge keys.") expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match 'file exists' expect(file("#{basedir}/file").content).not_to match 'one: foo' expect(file("#{basedir}/file").content).not_to match 'one: bar' end end describe 'when run should not force by default' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'yaml', } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": "bar"}', } MANIFEST end it 'applies manifest twice with stderr check' do expect(apply_manifest(pp, catch_failures: true).stderr).to match("Duplicate key 'one' found with values 'foo' and bar'. Use 'force' attribute to merge keys.") expect(apply_manifest(pp, catch_failures: true).stderr).to match("Duplicate key 'one' found with values 'foo' and bar'. Use 'force' attribute to merge keys.") expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match 'file exists' expect(file("#{basedir}/file").content).not_to match 'one: foo' expect(file("#{basedir}/file").content).not_to match 'one: bar' end end describe 'when run should force' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'yaml', force => true, } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": "bar"}', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match 'one: foo' end end describe 'when run should force merge nested arrays' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'json', force => true, } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": [1]}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": [2]}', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to contain '{"one":\[1,2\]}' end end describe 'when run should not force on plain' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': force => true, format => plain, } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": "bar"}', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '{"one": "foo"}{"one": "bar"}' end end end puppetlabs-concat-7.3.1/spec/acceptance/format_spec.rb000066400000000000000000000125611437144444600230350ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'format of file' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when run should default to plain' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '{"one": "foo"}{"one": "bar"}' end end describe 'when run should output to plain format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => plain, } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"one": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '{"one": "foo"}{"one": "bar"}' end end describe 'when run should output to yaml format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'yaml', } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"two": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match 'one: foo\Rtwo: bar' end end describe 'when run should output yaml arrays to yaml format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'yaml', } concat::fragment { '1': target => '#{basedir}/file', content => to_yaml([{ 'one.a' => 'foo', 'one.b' => 'bar' }]), } concat::fragment { '2': target => '#{basedir}/file', content => to_yaml([{ 'two.a' => 'dip', 'two.b' => 'doot' }]), } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '- one.a: foo\R one.b: bar\R- two.a: dip\R two.b: doot' end end describe 'when run should output to json format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'json', } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"two": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '{"one":"foo","two":"bar"}' end end describe 'when run should output to json-array format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'json-array', } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"two": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '[{"one":"foo"},{"two":"bar"}]' end end describe 'when run should output to json-pretty format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'json-pretty', } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"two": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '{\R "one": "foo",\R "two": "bar"\R}' end end describe 'when run should output to json-array-pretty format' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': format => 'json-array-pretty', } concat::fragment { '1': target => '#{basedir}/file', content => '{"one": "foo"}', } concat::fragment { '2': target => '#{basedir}/file', content => '{"two": "bar"}', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '[\n {\n "one": "foo"\n },\n {\n "two": "bar"\n }\n]' end end end puppetlabs-concat-7.3.1/spec/acceptance/fragment_order_spec.rb000066400000000000000000000047741437144444600245520ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat::fragment order' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'with reverse order, alphabetical' do let(:pp) do <<-MANIFEST concat { '#{basedir}/foo': order => 'alpha' } concat::fragment { '1': target => '#{basedir}/foo', content => 'string1', order => '15', } concat::fragment { '2': target => '#{basedir}/foo', content => 'string2', # default order 10 } concat::fragment { '3': target => '#{basedir}/foo', content => 'string3', order => '1', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).to match %r{string3string2string1} end end describe 'with reverse order, numeric' do let(:pp) do <<-MANIFEST concat { '#{basedir}/foo': order => 'numeric' } concat::fragment { '1': target => '#{basedir}/foo', content => 'string1', order => '15', } concat::fragment { '2': target => '#{basedir}/foo', content => 'string2', # default order 10 } concat::fragment { '3': target => '#{basedir}/foo', content => 'string3', order => '1', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).to match %r{string3string2string1} end end describe 'with normal order' do let(:pp) do <<-MANIFEST concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'string1', order => '01', } concat::fragment { '2': target => '#{basedir}/foo', content => 'string2', order => '02' } concat::fragment { '3': target => '#{basedir}/foo', content => 'string3', order => '03', } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).to match %r{string1string2string3} end end end puppetlabs-concat-7.3.1/spec/acceptance/fragment_replace_spec.rb000066400000000000000000000117541437144444600250460ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'replacement of' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'file' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': replace => false, } concat::fragment { '1': target => '#{basedir}/file', content => '1', } concat::fragment { '2': target => '#{basedir}/file', content => '2', } concat { '#{basedir}/file2': replace => true, } concat::fragment { 'file2_1': target => '#{basedir}/file2', content => '1', } concat::fragment { 'file2_2': target => '#{basedir}/file2', content => '2', } MANIFEST end it 'when file should not succeed' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match 'file exists' expect(file("#{basedir}/file").content).not_to match '1' expect(file("#{basedir}/file").content).not_to match '2' end it 'when file should succeed' do expect(file("#{basedir}/file2")).to be_file expect(file("#{basedir}/file2").content).not_to match 'file exists' expect(file("#{basedir}/file2").content).to match '1' expect(file("#{basedir}/file2").content).to match '2' end end describe 'symlink', unless: (os[:family] == 'windows') do # XXX the core puppet file type will replace a symlink with a plain file # when using ensure => present and source => ... but it will not when using # ensure => present and content => ...; this is somewhat confusing behavior before(:all) do pp = <<-MANIFEST file { '#{basedir}': ensure => directory, } file { '#{basedir}/file': ensure => link, target => '#{basedir}/dangling', } MANIFEST apply_manifest(pp) end let(:pp) do <<-MANIFEST concat { '#{basedir}/file': replace => false, } concat::fragment { '1': target => '#{basedir}/file', content => '1', } concat::fragment { '2': target => '#{basedir}/file', content => '2', } concat { '#{basedir}/file2': replace => true, } concat::fragment { 'file2_1': target => '#{basedir}/file2', content => '1', } concat::fragment { 'file2_2': target => '#{basedir}/file2', content => '2', } MANIFEST end it 'when symlink should not succeed' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_linked_to "#{basedir}/dangling" unless os[:family] == 'aix' || os[:family] == 'windows' expect(file("#{basedir}/dangling")).not_to be_file expect(file("#{basedir}/dangling")).not_to be_directory end it 'when symlink should succeed' do expect(file("#{basedir}/file2")).to be_file expect(file("#{basedir}/file2").content).to match '1' expect(file("#{basedir}/file2").content).to match '2' end end describe 'when directory should not succeed' do before(:all) do pp = <<-MANIFEST file { '#{basedir}': ensure => directory, } file { '#{basedir}/file': ensure => directory, } MANIFEST apply_manifest(pp) end let(:pp) do <<-MANIFEST concat { '#{basedir}/file': } concat::fragment { '1': target => '#{basedir}/file', content => '1', } concat::fragment { '2': target => '#{basedir}/file', content => '2', } MANIFEST end it 'applies the manifest twice with stderr' do expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{change from '?directory'? to '?file'? failed}) expect(apply_manifest(pp, expect_failures: true).stderr).to match(%r{change from '?directory'? to '?file'? failed}) expect(file("#{basedir}/file")).to be_directory end end # XXX # when there are no fragments, and the replace param will only replace # files and symlinks, not directories. The semantics either need to be # changed, extended, or a new param introduced to control directory # replacement. describe 'when directory should succeed', pending: 'not yet implemented' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': } concat::fragment { '1': target => '#{basedir}/file', content => '1', } concat::fragment { '2': target => '#{basedir}/file', content => '2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '1' end end end puppetlabs-concat-7.3.1/spec/acceptance/fragment_source_spec.rb000066400000000000000000000107061437144444600247270ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' case os[:family] when 'aix' username = 'root' groupname = 'system' when 'darwin' username = 'root' groupname = 'wheel' when 'windows' username = 'Administrator' groupname = 'Administrators' else username = 'root' groupname = 'root' end describe 'concat::fragment source' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when run should read file fragments from local system' do let(:pp) do <<-MANIFEST file { '#{basedir}/file1': content => "file1 contents\n" } file { '#{basedir}/file2': content => "file2 contents\n" } concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', source => '#{basedir}/file1', require => File['#{basedir}/file1'], } concat::fragment { '2': target => '#{basedir}/foo', content => 'string1 contents', } concat::fragment { '3': target => '#{basedir}/foo', source => '#{basedir}/file2', require => File['#{basedir}/file2'], } MANIFEST end it 'idempotent, file matches' do idempotent_apply(pp) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).to match 'file1 contents' expect(file("#{basedir}/foo").content).to match 'file2 contents' end end describe 'when run should create files containing first match only.' do let(:pp) do <<-MANIFEST file { '#{basedir}/file1': content => "file1 contents\n" } file { '#{basedir}/file2': content => "file2 contents\n" } concat { '#{basedir}/result_file1': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat { '#{basedir}/result_file2': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat { '#{basedir}/result_file3': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat::fragment { '1': target => '#{basedir}/result_file1', source => [ '#{basedir}/file1', '#{basedir}/file2' ], require => [ File['#{basedir}/file1'], File['#{basedir}/file2'] ], order => '01', } concat::fragment { '2': target => '#{basedir}/result_file2', source => [ '#{basedir}/file2', '#{basedir}/file1' ], require => [ File['#{basedir}/file1'], File['#{basedir}/file2'] ], order => '01', } concat::fragment { '3': target => '#{basedir}/result_file3', source => [ '#{basedir}/file1', '#{basedir}/file2' ], require => [ File['#{basedir}/file1'], File['#{basedir}/file2'] ], order => '01', } MANIFEST end it 'idempotent, files match' do idempotent_apply(pp) expect(file("#{basedir}/result_file1")).to be_file expect(file("#{basedir}/result_file1").content).to match 'file1 contents' expect(file("#{basedir}/result_file1").content).not_to match 'file2 contents' expect(file("#{basedir}/result_file2")).to be_file expect(file("#{basedir}/result_file2").content).to match 'file2 contents' expect(file("#{basedir}/result_file2").content).not_to match 'file1 contents' expect(file("#{basedir}/result_file3")).to be_file expect(file("#{basedir}/result_file3").content).to match 'file1 contents' expect(file("#{basedir}/result_file3").content).not_to match 'file2 contents' end end describe 'when run should fail if no match on source.' do let(:pp) do <<-MANIFEST concat { '#{basedir}/fail_no_source': owner => '#{username}', group => '#{groupname}', mode => '0644', } concat::fragment { '1': target => '#{basedir}/fail_no_source', source => [ '#{basedir}/nofilehere', '#{basedir}/nothereeither' ], order => '01', } MANIFEST end it 'applies the manifest with resource failures' do expect(apply_manifest(pp, catch_failures: true).stderr).to match(%r{Failed to generate additional resources using 'eval_generate'}) expect(file("#{basedir}/fail_no_source")).not_to be_directory end end end puppetlabs-concat-7.3.1/spec/acceptance/fragments_are_always_replaced_spec.rb000066400000000000000000000061571437144444600276050ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat::fragment replace' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when run should create fragment files' do let(:pp1) do <<-MANIFEST concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'caller has replace unset run 1', } MANIFEST end let(:pp2) do <<-MANIFEST concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'caller has replace unset run 2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp1) idempotent_apply(pp2) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).not_to match 'caller has replace unset run 1' expect(file("#{basedir}/foo").content).to match 'caller has replace unset run 2' end end # should create fragment files describe 'when run should replace its own fragment files when caller has File { replace=>true } set' do let(:pp1) do <<-MANIFEST File { replace=>true } concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'caller has replace true set run 1', } MANIFEST end let(:pp2) do <<-MANIFEST File { replace=>true } concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'caller has replace true set run 2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp1) idempotent_apply(pp2) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).not_to match 'caller has replace true set run 1' expect(file("#{basedir}/foo").content).to match 'caller has replace true set run 2' end end # should replace its own fragment files when caller has File(replace=>true) set describe 'when run should replace its own fragment files even when caller has File { replace=>false } set' do let(:pp1) do <<-MANIFEST File { replace=>false } concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'caller has replace false set run 1', } MANIFEST end let(:pp2) do <<-MANIFEST File { replace=>false } concat { '#{basedir}/foo': } concat::fragment { '1': target => '#{basedir}/foo', content => 'caller has replace false set run 2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp1) idempotent_apply(pp2) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).not_to match 'caller has replace false set run 1' expect(file("#{basedir}/foo").content).to match 'caller has replace false set run 2' end end # should replace its own fragment files even when caller has File(replace=>false) set end puppetlabs-concat-7.3.1/spec/acceptance/newline_spec.rb000066400000000000000000000024671437144444600232120ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat ensure_newline parameter' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'when false' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': ensure_newline => false, } concat::fragment { '1': target => '#{basedir}/file', content => '1', } concat::fragment { '2': target => '#{basedir}/file', content => '2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '12' end end describe 'when true' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': ensure_newline => true, } concat::fragment { '1': target => '#{basedir}/file', content => '1', } concat::fragment { '2': target => '#{basedir}/file', content => '2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match %r{1\r?\n2\r?\n} end end end puppetlabs-concat-7.3.1/spec/acceptance/noop_spec.rb000066400000000000000000000013421437144444600225130ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat noop parameter', if: ['debian', 'redhat', 'ubuntu'].include?(os[:family]) do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'with "/usr/bin/test -e %"' do let(:pp) do <<-MANIFEST concat_file { '#{basedir}/file': noop => false, } concat_fragment { 'content': target => '#{basedir}/file', content => 'content', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to contain 'content' end end end puppetlabs-concat-7.3.1/spec/acceptance/order_spec.rb000066400000000000000000000032061437144444600226540ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat order' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'sortby alpha' do let(:pp) do <<-MANIFEST concat { '#{basedir}/foo': order => 'alpha' } concat::fragment { '1': target => '#{basedir}/foo', content => 'string1', order => '1', } concat::fragment { '2': target => '#{basedir}/foo', content => 'string2', order => '2', } concat::fragment { '10': target => '#{basedir}/foo', content => 'string10', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).to match %r{string1string10string2} end end describe 'sortby numeric' do let(:pp) do <<-MANIFEST concat { '#{basedir}/foo': order => 'numeric' } concat::fragment { '1': target => '#{basedir}/foo', content => 'string1', order => '1', } concat::fragment { '2': target => '#{basedir}/foo', content => 'string2', order => '2', } concat::fragment { '10': target => '#{basedir}/foo', content => 'string10', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/foo")).to be_file expect(file("#{basedir}/foo").content).to match %r{string1string2string10} end end end puppetlabs-concat-7.3.1/spec/acceptance/pup_1963_spec.rb000066400000000000000000000035301437144444600230270ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' command = case os[:family] when 'windows' 'cmd.exe /c echo triggered' else 'echo triggered' end describe 'with metaparameters' do attr_reader :basedir before(:each) do @basedir = setup_test_directory end describe 'with subscribed resources' do let(:pp) do <<-MANIFEST concat { "foobar": ensure => 'present', path => '#{basedir}/foobar', } concat::fragment { 'foo': target => 'foobar', content => 'foo', } exec { 'trigger': path => $::path, command => "#{command}", subscribe => Concat['foobar'], refreshonly => true, } MANIFEST end it 'applies the manifest twice with no changes second apply' do expect(apply_manifest(pp, catch_failures: true).stdout).to match(%r{Triggered 'refresh'}) expect(apply_manifest(pp, catch_changes: true).stdout).not_to match(%r{Triggered 'refresh'}) end end describe 'with resources to notify' do let(:pp) do <<-MANIFEST exec { 'trigger': path => $::path, command => "#{command}", refreshonly => true, } concat { "foobar": ensure => 'present', path => '#{basedir}/foobar', notify => Exec['trigger'], } concat::fragment { 'foo': target => 'foobar', content => 'foo', } MANIFEST end it 'applies the manifest twice with no changes second apply' do expect(apply_manifest(pp, catch_failures: true).stdout).to match(%r{Triggered 'refresh'}) expect(apply_manifest(pp, catch_changes: true).stdout).not_to match(%r{Triggered 'refresh'}) end end end puppetlabs-concat-7.3.1/spec/acceptance/quoted_paths_spec.rb000066400000000000000000000016121437144444600242400ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'quoted paths' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'with path with blanks' do let(:pp) do <<-MANIFEST file { '#{basedir}/concat test': ensure => directory, } concat { '#{basedir}/concat test/foo': } concat::fragment { '1': target => '#{basedir}/concat test/foo', content => 'string1', } concat::fragment { '2': target => '#{basedir}/concat test/foo', content => 'string2', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/concat test/foo")).to be_file expect(file("#{basedir}/concat test/foo").content).to match %r{string1string2} end end end puppetlabs-concat-7.3.1/spec/acceptance/specinfra_stubs.rb000066400000000000000000000012721437144444600237220ustar00rootroot00000000000000# frozen_string_literal: true # class Specinfra::Command::Windows::Base::File class Specinfra::Command::Windows::Base::File < Specinfra::Command::Windows::Base class << self def check_is_owned_by(file, owner) Backend::PowerShell::Command.new do exec "if((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}' -or ((Get-Item '#{file}').GetAccessControl().Owner -match '#{owner}').Length -gt 0){ exit 0 } else { exit 1 }" end end end end # class Specinfra::Command::Base::File class Specinfra::Command::Base::File < Specinfra::Command::Base class << self def get_content(file) "cat '#{file}' 2> /dev/null || echo -n" end end end puppetlabs-concat-7.3.1/spec/acceptance/symbolic_name_spec.rb000066400000000000000000000014341437144444600243630ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'symbolic name' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end let(:pp) do <<-MANIFEST concat { 'not_abs_path': path => '#{basedir}/file', } concat::fragment { '1': target => 'not_abs_path', content => '1', order => '01', } concat::fragment { '2': target => 'not_abs_path', content => '2', order => '02', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match '1' expect(file("#{basedir}/file").content).to match '2' end end puppetlabs-concat-7.3.1/spec/acceptance/validation_spec.rb000066400000000000000000000014121437144444600236700ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'validation, concat validate_cmd parameter', if: ['debian', 'redhat', 'ubuntu'].include?(os[:family]) do attr_reader :basedir before(:all) do @basedir = setup_test_directory end context 'with "/usr/bin/test -e %"' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': validate_cmd => '/usr/bin/test -e %', } concat::fragment { 'content': target => '#{basedir}/file', content => 'content', } MANIFEST end it 'applies the manifest twice with no stderr' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to contain 'content' end end end puppetlabs-concat-7.3.1/spec/acceptance/warn_header_spec.rb000066400000000000000000000044501437144444600240220ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'concat warn_header =>' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end describe 'applies the manifest twice with no stderr' do let(:pp) do <<-MANIFEST concat { '#{basedir}/file': warn => true, } concat::fragment { '1': target => '#{basedir}/file', content => '1', order => '01', } concat::fragment { '2': target => '#{basedir}/file', content => '2', order => '02', } concat { '#{basedir}/file2': warn => false, } concat::fragment { 'file2_1': target => '#{basedir}/file2', content => '1', order => '01', } concat::fragment { 'file2_2': target => '#{basedir}/file2', content => '2', order => '02', } concat { '#{basedir}/file3': warn => "# foo\n", } concat::fragment { 'file3_1': target => '#{basedir}/file3', content => '1', order => '01', } concat::fragment { 'file3_2': target => '#{basedir}/file3', content => '2', order => '02', } MANIFEST end it 'when true should enable default warning message' do idempotent_apply(pp) expect(file("#{basedir}/file")).to be_file expect(file("#{basedir}/file").content).to match %r{# This file is managed by Puppet\. DO NOT EDIT\.} expect(file("#{basedir}/file").content).to match %r{1} expect(file("#{basedir}/file").content).to match %r{2} end it 'when false should not enable default warning message' do expect(file("#{basedir}/file2")).to be_file expect(file("#{basedir}/file2").content).not_to match %r{# This file is managed by Puppet\. DO NOT EDIT\.} expect(file("#{basedir}/file2").content).to match %r{1} expect(file("#{basedir}/file2").content).to match %r{2} end it 'when foo should overide default warning message' do expect(file("#{basedir}/file3")).to be_file expect(file("#{basedir}/file3").content).to match %r{# foo} expect(file("#{basedir}/file3").content).to match %r{1} expect(file("#{basedir}/file3").content).to match %r{2} end end end puppetlabs-concat-7.3.1/spec/acceptance/warnings_spec.rb000066400000000000000000000013061437144444600233700ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper_acceptance' describe 'warnings' do attr_reader :basedir before(:all) do @basedir = setup_test_directory end context 'when concat::fragment target not found' do let(:pp) do <<-MANIFEST concat { 'file': path => '#{basedir}/file', } concat::fragment { 'foo': target => '#{basedir}/bar', content => 'bar', } MANIFEST end it 'applies manifests, check stderr' do expect(apply_manifest(pp, catch_failures: true).stderr).to match 'not found in the catalog' expect(apply_manifest(pp, catch_failures: true).stderr).to match 'not found in the catalog' end end end puppetlabs-concat-7.3.1/spec/default_facts.yml000066400000000000000000000004121437144444600214370ustar00rootroot00000000000000# Use default_module_facts.yml for module specific facts. # # Facts specified here will override the values provided by rspec-puppet-facts. --- ipaddress: "172.16.254.254" ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA" is_pe: false macaddress: "AA:AA:AA:AA:AA:AA" puppetlabs-concat-7.3.1/spec/defines/000077500000000000000000000000001437144444600175305ustar00rootroot00000000000000puppetlabs-concat-7.3.1/spec/defines/concat_fragment_spec.rb000066400000000000000000000103401437144444600242170ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe 'concat::fragment' do shared_examples 'fragment' do |title, params| params = {} if params.nil? p = { content: nil, source: nil, order: 10, }.merge(params) let(:title) { title } let(:params) { params } let(:pre_condition) do "concat{ '#{p[:target]}': }" end it do is_expected.to contain_concat(p[:target]) end it do is_expected.to contain_concat_file(p[:target]) end it do is_expected.to contain_concat_fragment(title) end end context 'when title' do ['0', '1', 'a', 'z'].each do |title| it_behaves_like 'fragment', title, target: '/etc/motd', content: "content for #{title}" end end # title context 'when target =>' do ['./etc/motd', 'etc/motd', 'motd_header'].each do |target| context target do it_behaves_like 'fragment', target, target: '/etc/motd', content: "content for #{target}" end end context 'when false' do let(:title) { 'motd_header' } let(:params) { { target: false } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'target' expects a .*String.*}) end end end # target => context 'when content =>' do ['', 'ashp is our hero'].each do |content| context content do it_behaves_like 'fragment', 'motd_header', content: content, target: '/etc/motd' end end context 'when false' do let(:title) { 'motd_header' } let(:params) { { content: false, target: '/etc/motd' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{expects a value of type Undef( or String|, String, or Deferred), got Boolean}) end end end # content => context 'when source =>' do ['', '/foo/bar', ['/foo/bar', '/foo/baz']].each do |source| context source do it_behaves_like 'fragment', 'motd_header', source: source, target: '/etc/motd' end end context 'when false' do let(:title) { 'motd_header' } let(:params) { { source: false, target: '/etc/motd' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'source' expects a .*String.*Array.*}) end end end # source => context 'when order =>' do ['', '42', 'a', 'z'].each do |order| context "'#{order}'" do it_behaves_like 'fragment', 'motd_header', order: order, target: '/etc/motd' end end context 'when false' do let(:title) { 'motd_header' } let(:params) { { order: false, target: '/etc/motd' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Evaluation Error.*expects.*Boolean.*}) end end context 'when 123:456' do let(:title) { 'motd_header' } let(:params) { { order: '123:456', target: '/etc/motd' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{cannot contain}) end end context 'when 23/456' do let(:title) { 'motd_header' } let(:params) { { order: '123/456', target: '/etc/motd' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{cannot contain}) end end context 'when 123\n456' do let(:title) { 'motd_header' } let(:params) { { order: "123\n456", target: '/etc/motd' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{cannot contain}) end end end # order => context 'with more than one content source' do context 'with source and content' do let(:title) { 'motd_header' } let(:params) do { target: '/etc/motd', source: '/foo', content: 'bar', } end it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Can\'t use \'source\' and \'content\' at the same time}m) end end end # more than one content source end puppetlabs-concat-7.3.1/spec/defines/concat_spec.rb000066400000000000000000000235731437144444600223500ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe 'concat' do shared_examples 'concat' do |title, params, id| params = {} if params.nil? id = 'root' if id.nil? # default param values p = { ensure: 'present', path: title, owner: nil, group: nil, mode: '0644', warn: false, backup: 'puppet', replace: true, force: false, }.merge(params) file_defaults = { backup: p[:backup], } present_expect = { ensure: 'present', owner: p[:owner], group: p[:group], mode: p[:mode], path: p[:path], backup: p[:backup], replace: p[:replace], selinux_ignore_defaults: p[:selinux_ignore_defaults], selrange: p[:selrange], selrole: p[:selrole], seltype: p[:seltype], seluser: p[:seluser], force: p[:force], } let(:title) { title } let(:params) { params } let(:facts) do { id: id, osfamily: 'Debian', path: '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', kernel: 'Linux', is_pe: false, } end if p[:ensure] == 'present' it do is_expected.to contain_concat(title).with(file_defaults.merge(present_expect)) end else it do is_expected.to contain_concat(title).with(file_defaults.merge(ensure: 'absent', backup: p[:backup])) end end end context 'when title without path param' do # title/name is the default value for the path param. therefore, the # title must be an absolute path unless path is specified ['/foo', '/foo/bar', '/foo/bar/baz'].each do |title| context title do it_behaves_like 'concat', '/etc/foo.bar' end end ['./foo', 'foo', 'foo/bar'].each do |title| context title do let(:title) { title } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Stdlib::Unixpath}) end end end end context 'when title with path param' do ['/foo', 'foo', 'foo/bar'].each do |title| context title do it_behaves_like 'concat', title, path: '/etc/foo.bar' end end end context 'when title with special characters in title' do ['foo:bar', 'foo*bar', 'foo(bar)', 'foo@bar'].each do |title| context title do it_behaves_like 'concat', title, path: '/etc/foo.bar' end end end context 'when as non-root user' do it_behaves_like 'concat', '/etc/foo.bar', {}, 'bob' end context 'when ensure =>' do ['present', 'absent'].each do |ens| context ens do it_behaves_like 'concat', '/etc/foo.bar', ensure: ens end end context 'when invalid' do let(:title) { '/etc/foo.bar' } let(:params) { { ensure: 'invalid' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{expects a match for Enum\['absent', 'present'\]}) end end end # ensure => context 'when path =>' do context 'when /foo' do it_behaves_like 'concat', '/etc/foo.bar', path: '/foo' end context 'when false' do let(:title) { '/etc/foo.bar' } let(:params) { { path: false } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Stdlib::Unixpath}) end end ['./foo', 'foo', 'foo/bar'].each do |path| context path do let(:title) { '/etc/foo.bar' } let(:params) { { path: path } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Stdlib::Unixpath}) end end end end # path => context 'when owner =>' do ['apenney', 1000, '1001'].each do |owner| context owner do it_behaves_like 'concat', '/etc/foo.bar', owner: owner end end context 'when false' do let(:title) { '/etc/foo.bar' } let(:params) { { owner: false } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Evaluation Error.*expects.*String.*Boolean.*}) end end end # owner => context 'when group =>' do ['apenney', 1000, '1001'].each do |group| context group do it_behaves_like 'concat', '/etc/foo.bar', group: group end end context 'when false' do let(:title) { '/etc/foo.bar' } let(:params) { { group: false } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Evaluation Error.*expects.*String.*Boolean.*}) end end end # group => context 'when mode =>' do context 'when 1755' do it_behaves_like 'concat', '/etc/foo.bar', mode: '1755' end context 'when false' do let(:title) { '/etc/foo.bar' } let(:params) { { mode: false } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'mode' expects .*String.*}) end end end # mode => context 'when warn =>' do [true, false, '# foo'].each do |warn| context warn do it_behaves_like 'concat', '/etc/foo.bar', warn: warn end end context 'when (stringified boolean)' do ['true', 'yes', 'on', 'false', 'no', 'off'].each do |warn| define warn do it_behaves_like 'concat', '/etc/foo.bar', warn: warn it 'creates a warning' do skip('rspec-puppet support for testing warning()') end end end end context 'when 123' do let(:title) { '/etc/foo.bar' } let(:params) { { warn: 123 } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'warn' expects .*Boolean.*String.*}) end end end # warn => context 'when show_diff =>' do [true, false].each do |show_diff| context show_diff do it_behaves_like 'concat', '/etc/foo.bar', show_diff: show_diff end end context 'when 123' do let(:title) { '/etc/foo.bar' } let(:params) { { show_diff: 123 } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'show_diff' expects .*Boolean.*}) end end end # show_diff => context 'when backup =>' do ['reverse', false, true].each do |backup| context backup.to_s do it_behaves_like 'concat', '/etc/foo.bar', backup: backup end end context 'when true' do let(:title) { '/etc/foo.bar' } let(:params) { { backup: [] } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'backup' expects .*Boolean.*String.*}) end end end # backup => context 'when replace =>' do [true, false].each do |replace| context replace do it_behaves_like 'concat', '/etc/foo.bar', replace: replace end end context 'when 123' do let(:title) { '/etc/foo.bar' } let(:params) { { replace: 123 } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'replace' expects .*Boolean.*}) end end end # replace => context 'when force =>' do [true, false].each do |force| context force do it_behaves_like 'concat', '/etc/foo.bar', force: force end end context 'when 123' do let(:title) { '/etc/foo.bar' } let(:params) { { force: 123 } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'force' expects .*Boolean.*}) end end end # force => context 'when order =>' do ['alpha', 'numeric'].each do |order| context order do it_behaves_like 'concat', '/etc/foo.bar', order: order end end context 'when invalid' do let(:title) { '/etc/foo.bar' } let(:params) { { order: 'invalid' } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{expects a match for Enum\['alpha', 'numeric'\]}) end end end # order => context 'when ensure_newline =>' do [true, false].each do |ensure_newline| context 'when true' do it_behaves_like 'concat', '/etc/foo.bar', ensure_newline: ensure_newline end end context 'when 123' do let(:title) { '/etc/foo.bar' } let(:params) { { ensure_newline: 123 } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'ensure_newline' expects a Boolean value}) end end end # ensure_newline => context 'when validate_cmd =>' do context 'when /usr/bin/test -e %' do it_behaves_like 'concat', '/etc/foo.bar', validate_cmd: '/usr/bin/test -e %' end [1234, true].each do |cmd| context cmd do let(:title) { '/etc/foo.bar' } let(:params) { { validate_cmd: cmd } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter 'validate_cmd' expects.*String.*}) end end end end # validate_cmd => context 'when selinux_ignore_defaults =>' do let(:title) { '/etc/foo.bar' } [true, false].each do |v| context v do it_behaves_like 'concat', '/etc/foo.bar', selinux_ignore_defaults: v end end context 'when 123' do let(:title) { '/etc/foo.bar' } let(:params) { { selinux_ignore_defaults: 123 } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{Evaluation Error.*expects.*Boolean.*}) end end end # selinux_ignore_defaults => [ :selrange, :selrole, :seltype, :seluser, ].each do |p| context " #{p} =>" do let(:title) { '/etc/foo.bar' } context 'when foo' do it_behaves_like 'concat', '/etc/foo.bar', p => 'foo' end context 'when false' do let(:title) { '/etc/foo.bar' } let(:params) { { p => false } } it 'fails' do expect { catalogue }.to raise_error(Puppet::Error, %r{parameter '#{p}' expects.*String.*}) end end end # #{p} => end end puppetlabs-concat-7.3.1/spec/spec_helper.rb000066400000000000000000000041031437144444600207270ustar00rootroot00000000000000# frozen_string_literal: true RSpec.configure do |c| c.mock_with :rspec end 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 default_facts.merge!(YAML.safe_load(File.read(f), [], [], true)) rescue => 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 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 puppetlabs-concat-7.3.1/spec/spec_helper_acceptance.rb000066400000000000000000000003131437144444600230740ustar00rootroot00000000000000# frozen_string_literal: true require 'puppet_litmus' require 'spec_helper_acceptance_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_acceptance_local.rb')) PuppetLitmus.configure! puppetlabs-concat-7.3.1/spec/spec_helper_acceptance_local.rb000066400000000000000000000011651437144444600242540ustar00rootroot00000000000000# frozen_string_literal: true require 'singleton' class LitmusHelper include Singleton include PuppetLitmus end def setup_test_directory basedir = case os[:family] when 'windows' 'c:/concat_test' else '/tmp/concat_test' end pp = <<-MANIFEST file { '#{basedir}': ensure => directory, force => true, purge => true, recurse => true, } file { '#{basedir}/file': content => "file exists\n", force => true, } MANIFEST LitmusHelper.instance.apply_manifest(pp, expect_failures: false) basedir end puppetlabs-concat-7.3.1/spec/spec_helper_local.rb000066400000000000000000000042751437144444600221130ustar00rootroot00000000000000# frozen_string_literal: true if ENV['COVERAGE'] == 'yes' require 'simplecov' require 'simplecov-console' require 'codecov' SimpleCov.formatters = [ SimpleCov::Formatter::HTMLFormatter, SimpleCov::Formatter::Console, SimpleCov::Formatter::Codecov, ] SimpleCov.start do track_files 'lib/**/*.rb' add_filter '/spec' # do not track vendored files add_filter '/vendor' add_filter '/.vendor' # do not track gitignored files # this adds about 4 seconds to the coverage check # this could definitely be optimized add_filter do |f| # system returns true if exit status is 0, which with git-check-ignore means file is ignored system("git check-ignore --quiet #{f.filename}") end end end shared_examples 'Puppet::Parameter::Boolean' do |parameter| [true, :true, 'true', :yes, 'yes'].each do |value| it "accepts #{value} (#{value.class}) as a value" do resource[parameter] = value expect(resource[parameter]).to eq(true) end end [false, :false, 'false', :no, 'no'].each do |value| it "accepts #{value} (#{value.class}) as a value" do resource[parameter] = value expect(resource[parameter]).to eq(false) end end it 'does not accept "foo" as a value' do expect { resource[parameter] = 'foo' }.to raise_error(%r{Invalid value "foo"}) end end shared_examples 'a parameter that accepts only string values' do |parameter| it 'accepts a string value' do resource[parameter] = 'foo' expect(resource[parameter]).to eq('foo') end it 'does not accept an array value' do expect { resource[parameter] = ['foo', 'bar'] }.to raise_error(%r{must be a String}) end it 'does not accept a hash value' do expect { resource[parameter] = { foo: 'bar' } }.to raise_error(%r{must be a String}) end it 'does not accept an integer value' do expect { resource[parameter] = 9001 }.to raise_error(%r{must be a String}) end it 'does not accept a boolean true value' do expect { resource[parameter] = true }.to raise_error(%r{must be a String}) end it 'does not accept a boolean false value' do expect { resource[parameter] = false }.to raise_error(%r{must be a String}) end end puppetlabs-concat-7.3.1/spec/unit/000077500000000000000000000000001437144444600170725ustar00rootroot00000000000000puppetlabs-concat-7.3.1/spec/unit/type/000077500000000000000000000000001437144444600200535ustar00rootroot00000000000000puppetlabs-concat-7.3.1/spec/unit/type/concat_file_spec.rb000066400000000000000000000076701437144444600236720ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:concat_file) do let(:resource) { described_class.new(name: '/foo/bar') } describe 'key attributes' do let(:subject) { described_class.key_attributes } it 'contain only :path' do is_expected.to eq([:path]) end end describe 'parameter :path' do it 'does not accept unqualified paths' do expect { resource[:path] = 'foo' }.to raise_error( %r{File paths must be fully qualified}, ) end end describe 'parameter :owner' do subject { described_class.attrclass(:owner) } it 'inherits Puppet::Type::File::Owner' do is_expected.to be < Puppet::Type::File::Owner end end describe 'parameter :group' do subject { described_class.attrclass(:group) } it 'inherits Puppet::Type::File::Group' do is_expected.to be < Puppet::Type::File::Group end end describe 'parameter :mode' do subject { described_class.attrclass(:mode) } it 'inherits Puppet::Type::File::Mode' do is_expected.to be < Puppet::Type::File::Mode end end describe 'parameter :order' do it 'accepts "alpha" as a value' do resource[:order] = 'alpha' expect(resource[:order]).to eq(:alpha) end it 'accepts "numeric" as a value' do resource[:order] = 'numeric' expect(resource[:order]).to eq(:numeric) end it 'does not accept "bar" as a value' do expect { resource[:order] = 'bar' }.to raise_error(%r{Invalid value "bar"}) end end describe 'parameter :backup' do it 'accepts true (TrueClass) as a value' do resource[:backup] = true expect(resource[:backup]).to eq(true) end it 'accepts false (FalseClass) as a value' do resource[:backup] = false expect(resource[:backup]).to eq(false) end it 'accepts "foo" as a value' do resource[:backup] = 'foo' expect(resource[:backup]).to eq('foo') end end describe 'parameter :selrange' do it_behaves_like 'a parameter that accepts only string values', :selrange end describe 'parameter :selrole' do it_behaves_like 'a parameter that accepts only string values', :selrole end describe 'parameter :seltype' do it_behaves_like 'a parameter that accepts only string values', :seltype end describe 'parameter :seluser' do it_behaves_like 'a parameter that accepts only string values', :seluser end describe 'parameter :replace' do it_behaves_like 'Puppet::Parameter::Boolean', :replace end describe 'parameter :ensure_newline' do it_behaves_like 'Puppet::Parameter::Boolean', :ensure_newline end describe 'parameter :show_diff' do it_behaves_like 'Puppet::Parameter::Boolean', :show_diff end describe 'parameter :selinux_ignore_defaults' do it_behaves_like 'Puppet::Parameter::Boolean', :selinux_ignore_defaults end describe 'parameter :force' do it_behaves_like 'Puppet::Parameter::Boolean', :force end describe 'parameter :format' do it 'accepts "plain" as a value' do resource[:format] = 'plain' expect(resource[:format]).to eq(:plain) end it 'accepts "yaml" as a value' do resource[:format] = 'yaml' expect(resource[:format]).to eq(:yaml) end it 'accepts "json" as a value' do resource[:format] = 'json' expect(resource[:format]).to eq(:json) end it 'accepts "json-array" as a value' do resource[:format] = 'json-array' expect(resource[:format]).to eq(:'json-array') end it 'accepts "json-pretty" as a value' do resource[:format] = 'json-pretty' expect(resource[:format]).to eq(:'json-pretty') end it 'accepts "json-array-pretty" as a value' do resource[:format] = 'json-array-pretty' expect(resource[:format]).to eq(:'json-array-pretty') end it 'does not accept "bar" as a value' do expect { resource[:format] = 'bar' }.to raise_error(%r{Invalid value "bar"}) end end end puppetlabs-concat-7.3.1/spec/unit/type/concat_fragment_spec.rb000066400000000000000000000066671437144444600245630ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Puppet::Type.type(:concat_fragment) do let(:resource) do described_class.new(name: 'foo', target: 'bar', content: 'baz') end describe 'key attributes' do let(:subject) { described_class.key_attributes } it 'contain only :name' do is_expected.to eq([:name]) end end describe 'parameter :target' do it_behaves_like 'a parameter that accepts only string values', :target end describe 'parameter :content' do it_behaves_like 'a parameter that accepts only string values', :content end describe 'parameter :source' do it 'accepts a string value' do resource[:source] = 'foo' expect(resource[:source]).to eq('foo') end it 'accepts an array value' do resource[:source] = ['foo', 'bar'] expect(resource[:source]).to eq(['foo', 'bar']) end it 'does not accept a hash value' do expect { resource[:source] = { foo: 'bar' } }.to raise_error(%r{must be a String or Array}) end it 'does not accept an integer value' do expect { resource[:source] = 9001 }.to raise_error(%r{must be a String or Array}) end it 'does not accept a boolean true value' do expect { resource[:source] = true }.to raise_error(%r{must be a String or Array}) end it 'does not accept a boolean false value' do expect { resource[:source] = false }.to raise_error(%r{must be a String or Array}) end end describe 'parameter :order' do it 'accepts a string value' do resource[:order] = 'foo' expect(resource[:order]).to eq('foo') end it 'accepts an integer value' do resource[:order] = 9001 expect(resource[:order]).to eq(9001) end it 'does not accept an array value' do expect { resource[:order] = ['foo', 'bar'] }.to raise_error(%r{is not a string or integer}) end it 'does not accept a hash value' do expect { resource[:order] = { foo: 'bar' } }.to raise_error(%r{is not a string or integer}) end it 'does not accept a boolean true value' do expect { resource[:order] = true }.to raise_error(%r{is not a string or integer}) end it 'does not accept a boolean false value' do expect { resource[:order] = false }.to raise_error(%r{is not a string or integer}) end it 'does not accept a string with ":" in it/' do expect { resource[:order] = ':foo' }.to raise_error(%r{Order cannot contain}) end it 'does not accept a string with "\n" in it/' do expect { resource[:order] = "\nfoo" }.to raise_error(%r{Order cannot contain}) end it 'does not accept a string with "/" in it/' do expect { resource[:order] = '/foo' }.to raise_error(%r{Order cannot contain}) end end context 'without a value set for :target or :tag' do it 'throws an error' do expect { described_class.new(name: 'foo', content: 'baz') }.to raise_error(%r{No 'target' or 'tag' set}) end end context 'without a value set for both :content and :source' do it 'throws an error' do expect { described_class.new(name: 'foo', target: 'bar') }.to raise_error(%r{Set either 'source' or 'content'}) end end context 'with a value set for both :content and :source' do it 'throws an error' do expect { described_class.new(name: 'foo', target: 'bar', content: 'baz', source: 'qux') }.to raise_error(%r{Can't use 'source' and 'content' at the same time}) end end end