Commit 1042df79 authored by James T. Lee's avatar James T. Lee
Browse files

Move puppet libraries into module for Puppet 7 compat

parent d8c34007
...@@ -129,15 +129,13 @@ fi ...@@ -129,15 +129,13 @@ fi
# Process templates with Puppet if we're on the main branch or a clone # Process templates with Puppet if we're on the main branch or a clone
if [[ $branch == 'main' || $PWD != $HOME ]]; then if [[ $branch == 'main' || $PWD != $HOME ]]; then
"$PUPPET" module install puppetlabs-stdlib
[[ -d /tmp/cache ]] && rmdir --ignore-fail-on-non-empty /tmp/cache
generate_manifest > "$MANIFEST" generate_manifest > "$MANIFEST"
cat >> "$MANIFEST" <<END_SPECIAL cat >> "$MANIFEST" <<END_SPECIAL
File <| title == '${BASEDIR}/.ssh/config' |> { File <| title == '${BASEDIR}/.ssh/config' |> {
mode => '0600', mode => '0600',
} }
END_SPECIAL END_SPECIAL
FACTERLIB="${BASEDIR}/lib/facter" RUBYLIB="${BASEDIR}/lib/ruby" "$PUPPET" apply "$MANIFEST" "$PUPPET" apply --modulepath="${BASEDIR}/lib/puppet" "$MANIFEST"
fi fi
...@@ -106,7 +106,7 @@ class ColorScheme ...@@ -106,7 +106,7 @@ class ColorScheme
end end
def initialize(filename) def initialize(filename)
@scheme_data = YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', filename)) @scheme_data = YAML.load_file(File.join(File.dirname(__FILE__), '..', '..', '..', '..', filename))
@colors = BASE_TO_ANSI.keys.each_with_object(Hash.new) do |term_colors, colors_acc| @colors = BASE_TO_ANSI.keys.each_with_object(Hash.new) do |term_colors, colors_acc|
colors_acc[term_colors] = BASE_TO_ANSI[term_colors].each_with_index.map do |ansis, base| colors_acc[term_colors] = BASE_TO_ANSI[term_colors].each_with_index.map do |ansis, base|
basestr = '%02X' % base basestr = '%02X' % base
......
name: "Auto release"
on:
schedule:
- cron: '0 3 * * 6'
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/iac_release:ci
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: "Commit changes"
if: ${{ github.repository_owner == 'puppetlabs' }}
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' }}
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' }}
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'
name: "nightly"
on:
schedule:
- cron: '0 0 * * *'
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: 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: always()
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-ia-bots'
name: 'GABot'
name: "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: 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'
name: "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:2.1.0.0
with:
args: 'build'
- name: "Push to Forge"
uses: docker://puppet/pdk:2.1.0.0
with:
args: 'release publish --forge-token ${{ secrets.FORGE_API_KEY }} --force'
name: "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: 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 }}
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 Static & Syntax Tests
run: |
buildevents cmd $TRACE_ID $STEP_ID 'static_syntax_checks Puppet ${{ matrix.puppet_version }}, Ruby ${{ matrix.ruby_version }}' -- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
- 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
FROM 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
image:
file: .gitpod.Dockerfile
tasks:
- init: pdk bundle install
vscode:
extensions:
- puppet.puppet-vscode@1.2.0:f5iEPbmOj6FoFTOV6q8LTg==
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2020-12-17 20:35:36 UTC using RuboCop version 1.6.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.
# Offense count: 6
# Configuration parameters: AllowComments.
Lint/SuppressedException:
Exclude:
- 'lib/facter/facter_dot_d.rb'
- 'lib/puppet/functions/merge.rb'
- 'lib/puppet/parser/functions/getvar.rb'
- 'lib/puppet/parser/functions/has_interface_with.rb'
# Offense count: 62
# Configuration parameters: IgnoreSharedExamples.
RSpec/NamedSubject:
Enabled: false
# Offense count: 2
RSpec/SubjectStub:
Exclude:
- 'spec/unit/facter/facter_dot_d_spec.rb'
# 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.1.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v7.1.0) (2021-05-15)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v7.0.1...v7.1.0)
### Added
- pw\_hash: add support for bcrypt variants [\#1173](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1173) ([kjetilho](https://github.com/kjetilho))
## [v7.0.1](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v7.0.1) (2021-04-12)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v7.0.0...v7.0.1)
### Fixed
- Fix typo in validate\_ipv6\_address function [\#1176](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1176) ([nbarrientos](https://github.com/nbarrientos))
## [v7.0.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v7.0.0) (2021-03-01)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.6.0...v7.0.0)
### Changed
- pdksync - Remove Puppet 5 from testing and bump minimal version to 6.0.0 [\#1164](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1164) ([carabasdaniel](https://github.com/carabasdaniel))
### Added
- Stdlib::Email type [\#1160](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1160) ([b4ldr](https://github.com/b4ldr))
### Fixed
- \(bugfix\) Setting stricter email validation [\#1163](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1163) ([pmcmaw](https://github.com/pmcmaw))
- \(IAC-1414\) Throw error in range\(\) function when step size invalid [\#1161](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1161) ([sanfrancrisko](https://github.com/sanfrancrisko))
## [v6.6.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.6.0) (2021-02-02)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.5.0...v6.6.0)
### Added
- stdlib::ensure: new fuction to cast ensure values [\#1150](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1150) ([b4ldr](https://github.com/b4ldr))
- \(feat\) Add support for Puppet 7 [\#1144](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1144) ([daianamezdrea](https://github.com/daianamezdrea))
- Allow options injection for to\_yaml [\#1137](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1137) ([baurmatt](https://github.com/baurmatt))
- Allow start/end checks on empty strings [\#1135](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1135) ([jvrsantacruz](https://github.com/jvrsantacruz))
- Stdlib::HttpStatus: add type for HTTP status codes as per rfc2616 [\#1132](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1132) ([b4ldr](https://github.com/b4ldr))
### Fixed
- \(IAC-1375\) fix unit tests for pe\_version fact, when using later facte… [\#1155](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1155) ([tphoney](https://github.com/tphoney))
- seeded\_rand: update funtion to ensure it returns an int not String [\#1139](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1139) ([b4ldr](https://github.com/b4ldr))
## [v6.5.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.5.0) (2020-09-30)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.4.0...v6.5.0)
### Added
- Add parsehocon\(\) function [\#1130](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1130) ([reidmv](https://github.com/reidmv))
- Add new types for Stdlib::Ensure::File [\#1129](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1129) ([b4ldr](https://github.com/b4ldr))
- Add additional types Stdlib::Port::Dynamic,Ephemeral,Registered,User} [\#1128](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1128) ([b4ldr](https://github.com/b4ldr))
- Stdlib::Datasize: This CR adds a new data size type alias [\#1126](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1126) ([b4ldr](https://github.com/b4ldr))
## [v6.4.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.4.0) (2020-08-20)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.3.0...v6.4.0)
### Added
- pdksync - \(IAC-973\) - Update travis/appveyor to run on new default branch `main` [\#1117](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1117) ([david22swan](https://github.com/david22swan))
- \(IAC-746\) - Add ubuntu 20.04 support [\#1110](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1110) ([david22swan](https://github.com/david22swan))
### Fixed
- \[MODULES-10781\] Fix defined type defined\_with\_params\(\) [\#1122](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1122) ([trevor-vaughan](https://github.com/trevor-vaughan))
- \[MODULES-10729\] defined\_with\_params - unnamed type [\#1115](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1115) ([trevor-vaughan](https://github.com/trevor-vaughan))
## [v6.3.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.3.0) (2020-04-16)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.2.0...v6.3.0)
### Added
- Add start\_with function [\#1086](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1086) ([baurmatt](https://github.com/baurmatt))
- stdlib::end\_with: create String.end\_with function [\#1084](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1084) ([b4ldr](https://github.com/b4ldr))
- Adding str2saltedpbkdf2 function [\#1040](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1040) ([genebean](https://github.com/genebean))
### Fixed
- \(MODULES-10623\) explicitly top-scope calls to JSON methods [\#1101](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1101) ([tkishel](https://github.com/tkishel))
- \[IAC-547\] Remove strftime from stdlib as it has already been replaced by the puppet agent since 4.8.0 [\#1097](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1097) ([carabasdaniel](https://github.com/carabasdaniel))
- Add correct namespace for start\_with function [\#1095](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1095) ([baurmatt](https://github.com/baurmatt))
- intersection: show types in exception due to invalid arguments [\#1077](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1077) ([runejuhl](https://github.com/runejuhl))
- Make type aliases stricter [\#1066](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1066) ([pegasd](https://github.com/pegasd))
## [v6.2.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.2.0) (2019-12-10)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.1.0...v6.2.0)
### Added
- \(FM-8696\) - Addition of Support for CentOS 8 [\#1065](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1065) ([david22swan](https://github.com/david22swan))
- Add support for additional options to to\_json\_pretty [\#1055](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1055) ([runejuhl](https://github.com/runejuhl))
### Fixed
- Fix PE detection \(for the moment\) [\#1049](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1049) ([trevor-vaughan](https://github.com/trevor-vaughan))
## [v6.1.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.1.0) (2019-09-20)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/v6.0.0...v6.1.0)
### Added
- \(MODULES-9915\) Add type aliases for cloud object store uris [\#1048](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1048) ([hooten](https://github.com/hooten))
- FM-8411 - add support for debian10 [\#1045](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1045) ([lionce](https://github.com/lionce))
- \(FM-8230\) Convert testing to litmus [\#1031](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1031) ([eimlav](https://github.com/eimlav))
- \(FM-8160\) Add Windows Server 2019 support [\#1025](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1025) ([eimlav](https://github.com/eimlav))
- \(FM-8048\) Add RedHat 8 support [\#1022](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1022) ([eimlav](https://github.com/eimlav))
- \(MODULES-9049\) Add type alias for 'yes' and 'no'. [\#1017](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1017) ([ghoneycutt](https://github.com/ghoneycutt))
- add Stdlib::Syslogfacility type [\#1005](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1005) ([bastelfreak](https://github.com/bastelfreak))
### Fixed
- fix lib/puppet/parser/functions/fqdn\_rand\_string.rb:21: syntax error [\#1029](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1029) ([pulecp](https://github.com/pulecp))
- Limit the maximum array size produced by range\(\). [\#1023](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1023) ([mbaynton](https://github.com/mbaynton))
## [v6.0.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/v6.0.0) (2019-05-10)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/5.2.0...v6.0.0)
### Changed
- pdksync - \(MODULES-8444\) - Raise lower Puppet bound [\#1011](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1011) ([david22swan](https://github.com/david22swan))
- \(MODULES-8760\) Add iterative feature to merge\(\) function [\#1008](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1008) ([hlindberg](https://github.com/hlindberg))
### Added
- Add a stdlib::ip\_in\_range\(\) function [\#1003](https://github.com/puppetlabs/puppetlabs-stdlib/pull/1003) ([iglov](https://github.com/iglov))
## [5.2.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/5.2.0) (2019-01-17)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/5.1.0...5.2.0)
### Added
- \(MODULES-8404\) - Relax `Stdlib::Filesource` type [\#981](https://github.com/puppetlabs/puppetlabs-stdlib/pull/981) ([alexjfisher](https://github.com/alexjfisher))
- Creates new type Stdlib::IP::Address::V6::CIDR [\#980](https://github.com/puppetlabs/puppetlabs-stdlib/pull/980) ([timhughes](https://github.com/timhughes))
- \(MODULES-8137\) - Addition of support for SLES 15 [\#978](https://github.com/puppetlabs/puppetlabs-stdlib/pull/978) ([david22swan](https://github.com/david22swan))
- \(MODULES-8322\) Consider IPs with /0 as valid [\#975](https://github.com/puppetlabs/puppetlabs-stdlib/pull/975) ([simondeziel](https://github.com/simondeziel))
- Add a function to compare the OS version [\#972](https://github.com/puppetlabs/puppetlabs-stdlib/pull/972) ([ekohl](https://github.com/ekohl))
- \(MODULES-8273\) - Make unquoted classes useable [\#971](https://github.com/puppetlabs/puppetlabs-stdlib/pull/971) ([baurmatt](https://github.com/baurmatt))
- add Function extname\(\) [\#949](https://github.com/puppetlabs/puppetlabs-stdlib/pull/949) ([cocker-cc](https://github.com/cocker-cc))
- \(MODULES-7024\) Add 20-octet MAC addresses [\#905](https://github.com/puppetlabs/puppetlabs-stdlib/pull/905) ([ananace](https://github.com/ananace))
### Fixed
- pdksync - \(FM-7655\) Fix rubygems-update for ruby \< 2.3 [\#979](https://github.com/puppetlabs/puppetlabs-stdlib/pull/979) ([tphoney](https://github.com/tphoney))
- fix ensure\_packages duplicate checking [\#969](https://github.com/puppetlabs/puppetlabs-stdlib/pull/969) ([netzvieh](https://github.com/netzvieh))
## [5.1.0](https://github.com/puppetlabs/puppetlabs-stdlib/tree/5.1.0) (2018-09-28)
[Full Changelog](https://github.com/puppetlabs/puppetlabs-stdlib/compare/5.0.0...5.1.0)
### Added
- pdksync - \(MODULES-6805\) metadata.json shows support for puppet 6 [\#958](https://github.com/puppetlabs/puppetlabs-stdlib/pull/958) ([tphoney](https://github.com/tphoney))
- \(maint\) Convert from mocking with mocha to rspec-mocks [\#948](https://github.com/puppetlabs/puppetlabs-stdlib/pull/948) ([rodjek](https://github.com/rodjek))
### Fixed
- \(FM-7388\) - Fixing unit tests for puppet 4, 5 and 6 [\#962](https://github.com/puppetlabs/puppetlabs-stdlib/pull/962) ([tphoney](https://github.com/tphoney))
- Fix `pick` function docs [\#955](https://github.com/puppetlabs/puppetlabs-stdlib/pull/955) ([alexjfisher](https://github.com/alexjfisher))
- \(MODULES-7768\) Handle nil in delete\_undef\_values\(\) function [\#954](https://github.com/puppetlabs/puppetlabs-stdlib/pull/954) ([hlindberg](https://github.com/hlindberg))
- Update docs for 'concat' to be correct [\#950](https://github.com/puppetlabs/puppetlabs-stdlib/pull/950) ([rhowe-gds](https://github.com/rhowe-gds))
## 5.0.0
### Summary
This is a major release which removes support for the Scientific 5 and Debian 7 OS, as well as a removal of the `Stdlib::(Ipv4|IPv6|Ip_address)` data types in favour of `Stdlib::IP::*`.
**In addition it contains a substantial piece of work centered around updating functions that have now been migrated into Puppet itself. Please note that this will be the last major release to support Puppet 2 and Puppet 3 and that they will soon be removed.**
#### Fixed
- Docs URLs corrected.
- Docs clarified that `Stdlib::Unixpath` only matches absolute paths.
- `dirname()` now fails when passed an empty string.
- `basename()` documentation clarified.
- Corrected documentation of `count()` wrt matches and empty string.
- Corrected example in `getparam()` and added note about equivalent in puppet.
- Fixed URL to use 'latest' instead of '5.5' for `Hash.new` function.
#### Added
- Support added for symbolic file nodes.
- `loadjson()` and `loadyml()` now compatible with HTTPS files.
- `loadjson()` and `loadyml()` now compatible with HTTP basic auth files.
- `any2array` now returns and empty array when given an empty string.
- Support has now been added for Ubuntu 18.04.
- `seeded_rand_string()` function has been added.
#### Changed
- PDK update `1.5.0` has been applied.
- `size()` function deprecated for Puppet 6 and above.
- `wrt` functions moved to Puppet as of Puppet 6.
- `sprintf_hash` has had notification put in place to show that as of Puppet 4.10.10 it's functionality is supported by the puppet core.
- Added note that `abs()` is in puppet since 6.0.0.
- Added information to `base64` function about Binary data type.
- Added note to `camelcase()` that function is now in puppet.
- Added note to `capitalize()` that function is now in puppet.
- Added note to `ceiling()` that function is now in puppet.
- Added note to `chomp()` that function is now in puppet.
- Added note to `chop()` that function is now in puppet.
- Added note how to do equivalence of `clamp()` function in puppet 6.
- Added note that `concat()` can be done with + since puppet 4.0.0.
- Added note to `convert_base()` how to do this with puppet core.
- Added equivalent puppet core way of doing `count()`.
- Added docs for equivalent puppet language for `delete_regexp()`.
- Added docs for equivalent language constructs for `delete_at()`.
- Added puppet 4 equivalent for `delete_undef()` function.
- Added equivalent puppet language for `delete_values()`.
- Updated `delete()` function with docs about equivalent language.
- Added docs that - between arrays is the same as `difference()`.
- Added note to `downcase()` that function is now in puppet.
- Added note to `empty()` that function is now in puppet.
- Added note to `flatten()` that function is now in puppet.
- Added note to `floor()` that function is now in puppet.
- Added note to `get_module_path()` that puppet has similar function.
- Amended documentation for `getvar()`.
- Add note to `grep()` that `filter()` in puppet does the same.
- Updated `has_key()` with equivalent puppet lang expresion.
- Updated the `hash()` function to show equivalent expression.
- Added note about more formatting options with `String()` in puppet.
- Added note to `join()` that it is in puppet since 5.4.0.
- Added note to `keys()` that it is in puppet since 5.4.0.
- Added note to `lstrip()`, `rstrip()`, `strip()` and `upcase()` that they are in puppet since 6.0.0.
- Updated `member()` with equivalent language expression example.
- Updated `merge()` with puppt language equivalent example.
- Updated `min()` and `max()` with note that they are in puppet.
- Updated `num2bool()` with information that Boolean can convert.
- Updated `prefix()` function with equivalent operation in pupppet.
- Updated `range()` with information that Integer can be used.
- Updated `reject()` with equivalent filter() call.
- Added note to `reverse()` that the `reverse_each()` Puppet function does the same as it.
- Added note to `round()` that it has moved to puppet in 6.0.0.
- Added note to `size()` that `length()` is in puppet since 5.4.0.
- Added note to `sort()` that is has moved to Puppet in 6.0.0.
- Updated `str2bool()` with a note that Boolean can handle conversion.
- Added note to `strftime()` that it moved to puppet in 4.8.0.
- Added note to `suffix()` that the same can be done with `map()`.
- Updated `time()` to mention Timespan and Timestamp data types.
- Added note to `values_at()` for equivalent slice operation in language.
- Added note to `values()` that it moved to puppet in 5.5.0.
- Corrected docs for `keys()` - in puppet since 5.5.0.
- Added note to `length()` that function moved to puppet.
- Updated README.md with deprecations for functions moved to puppet.
- Updated documentation of `values_at()`.
- Updated README with note from `time()` about data types for time.
- Updated README for `strintf_hash()` (supported by builtin sprintf).
- Updated README with deprecation of `hash()` function (use data type).
- Updated README `suffix` with equiv example for `map`.
- Updated README with `reject` equivalent call to `filter`.
- Updated README with `range` equiv use of type system + `each`.
- Updated README with `prefix` equiv func using `map`.
- Updated README for `num2bool` with info about Boolean type.
- Updated README `str2bool` with information about `Boolean` equivalent.
- Updated README `merge` with info about `+` operator equivalent.
- Updated README `member` with equivalent alternative in language.
- Updated README `join_keys_to_values` with link to String.new.
- Updated README `has_key` shows deprecation in favor of `in`.
- Updated README `grep` adds information about `filter`.
- Updated README and `getvar.rb` as getvar has moved to puppet.
- Updated README for `getparam` to be the same as in function.
- Updated README `get_module_path` with info about built in variant.
- Updated README `difference` to mention `-` operator equiv.
- Updated README `delete` with built-in alternatives.
- Updated README `delete_values` with builtin equiv.
- Updated README `delete_undef` & `delete_regexp` with builtin equiv.
- Updated README `delete_at` with equivalent built-in examples.
- Updated README `coun`t to show built-in equiv.
- Updated README `convert_base` with built-in equiv.
- Updated README `concat` with built-in equiv using + and <<.
- Updated README `base_64` with built-in equiv using Binary type.
- Skipped tests for `abs` if puppet version < 6.0.0.
- Skipped tests for `min` and `max` if puppet version < 6.0.0.
- Skipped tests for `floor` if puppet version < 6.0.0.
- Skipped tests for `ceiling` if puppet version < 6.0.0.
- Skipped tests for `round` if puppet version < 6.0.0.
- Skipped tests for `upcase` if puppet version < 6.0.0.
- Skipped tests for `downcase` if puppet version < 6.0.0.
- Skipped tests for `capitalize` if puppet version < 6.0.0.
- Skipped tests for `camelcase` if puppet version < 6.0.0.
- Skipped tests for strip functions if puppet version < 6.0.0.
- Skipped tests for `chop` and `chomp` if puppet version < 6.0.0.
- Skipped tests for `sort` if puppet version < 6.0.0.
- Removed extra space in `describe` for `abs` test.
- Updated README and `any2array` with built-in equiv Array.new.
- Updated README and `any2bool` with built-in equiv Boolean.new.
- Updated README and `bool2num` with built-in equiv Numeric.new.
- Updated README and `bool2str` with built-in equiv String.new.
- Corrected equivalent example for `count`.
- Updated README and made mention of `filter` in `delete` a link.
- Updated docs and tests for `strftime`.
- Updated all acceptance test using Puppet.version.
- Change 'puppet' to 'Puppet' in function doc strings.
- HTTP type checks are now case insensitive.
#### Removed
- Support has been removed for `Scientific 5` and `Debian 7` operating systems.
- `Stdlib::(Ipv4|IPv6|Ip_address)` have been removed.
## Supported Release 4.25.1
### Summary
This is a patch which includes a roll up of small fixes. In Puppet 5.5.0 `flatten()`, `length(),` `empty(),` `join(),` `keys(),` and `values()` are now built into Puppet. Please note that the Puppet implementation of the functions will take precedence over the functions in 'puppetlabs-stdlib'.
#### Fixed
- Remove unneeded execute permission from test files.
- Puppet 5.5.0 function deprecation [MODULES-6894](https://tickets.puppetlabs.com/browse/MODULES-6894).
## Supported Release 4.25.0
### Summary
This is quite a feature heavy release, it makes this module PDK-compliant for easier maintenance and includes a roll up of maintenance changes.
#### Added
- PDK conversion [MODULES-6332](https://tickets.puppetlabs.com/browse/MODULES-6332).
- Update `join_keys_to_values` with an undef statement.
- Type alias `Stdlib::Fqdn` matches paths on a fully qualified domain name.
- Type alias `Stdlib::Host` matches a valid host, this can be a valid 'ipv4', 'ipv6' or 'fqdn'.
- Type alias `Stdlib::Port` matches a valid TCP/UDP Port number.
- Type alias `Stdlib::Filesource` matches paths valid values for the source parameter of the puppet file type.
- Type alias `Stdlib::IP::Address` matches any IP address, including both IPv4 and IPv6 addresses,
- Type alias `Stdlib::IP::Address::V4` matches any string consisting of a valid IPv4 address, this is extended by 'CIDR' and 'nosubnet'.
- Type alias `Stdlib::IP::Address::V6` matches any string consisting of a valid IPv6 address, this is extended by 'Full', 'Alternate' and 'Compressed'.
- Type alias `Stdlib::IP::Address::V6::Nosubnet`matches any string consisting of a valid IPv6 address with no subnet, this is extended by 'Full', 'Alternate' and 'Compressed'.
- Type alias `Stdlib::Port` matches a valid TCP/UDP Port number this is then extended to 'Privileged' which are ports less than 1024 and 'Unprivileged' which are ports greater than 1024.
## Supported Release 4.24.0
### Summary
This release includes a roll up of minor changes and a new feature which provides the ability to skip undef values `to_json_pretty()`.
We have also reverted a change that was previously made and resulted in breaking compatibility with Ruby 1.8.7.
#### Added
- Ability to skip undef values in `to_json_pretty()`.
- Fix type3x function in stdlib ([MODULES-6216](https://tickets.puppet.com/browse/MODULES-6216))
#### Changed
- Indentation for `sync.yml` was fixed.
- Updated type alias tests and dropped superfluous wrapper classes
- Revert to old ruby 1.X style of hash ([MODULES-6139](https://tickets.puppet.com/browse/MODULES-6139))
- `rubocop.yml` not managed by msync ([MODULES-6201](https://tickets.puppet.com/browse/MODULES-6201))
## Supported Release 4.23.0
### Summary
This release is in order to implement Rubocop changes throughout the module.
#### Added
- Standard and translated readme's have been updated.
- Rubocop has been implemented in the module and a wide variety of changes have been made to the code.
- Modulesync changes have been merged into the code.
#### Fixed
- Minor fix to the readme.
## Supported Release 4.22.0
### Summary
This is a clean release in preparation of putting the module through the rubocop process.
#### Added
- Support has been added for Debian 9
- 'Stdlib::Mode type' has been added to the module.
- A type for 'ensure' has been added to the service resources.
- A new function 'sprintf_hash' has been added to allow the use of named references.
#### Removed
- Support has been removed for: RedHat 4, CentOS 4, OracleLinux 4, Scientific 4, SLES 10 SP4, Windows Server 2003, Windows Server 2003 R2 and Windows 8.
#### Fixed
- The 'ruby_spec.rb' test file has been altered s that it properly checks results.
- Example syntax in 'file_line.rb' has been fixed.
## Supported Release 4.21.0
### Summary
This is a small feature release that includes a revamped, albeit backwards-compatible file_line type.
#### Added
- `replace_all_matches_not_matching_line` parameter in file_line
- additional tests and documentation for file_line
#### Removed
- duplicate spec test for absolute_path
#### Fixed
- Unixpath type to allow "/" as valid path
- file_line behavior that caused infinite appending of `line` to a file ([MODULES-5651](https://tickets.puppet.com/browse/MODULES-5651))
## Supported Release 4.20.0
### Summary
This release adds new functions and updated README translations.
#### Added
- `to_json`, `to_json_pretty`, and `to_yaml` functions
- new Japanese README translations
#### Fixed
- compatibility issue with older versions of Puppet and the `pw_hash` function ([MODULES-5546](https://tickets.puppet.com/browse/MODULES-5546))
#### Removed
- support for EOL platform Debian 6 (Squeeze)
## Supported Release 4.19.0
### Summary
This release adds new functions and better documentation/fixes for existing functions with a noteworthy fix for file_line.
#### Added
- Add validate_domain_name function
- Add the round function
- Add type for MAC address
- Add support for sensitive data type to pw_hash ([MODULES-4908](https://tickets.puppet.com/browse/MODULES-4908))
- Add new function, fact() (FACT-932)
#### Fixed
- Fixes for the file_line provider ([MODULES-5003](https://tickets.puppet.com/browse/MODULES-5003))
- Add documentation for email functions ([MODULES-5382](https://tickets.puppet.com/browse/MODULES-5382))
- unique function is deprecated for puppet version > 5. (FM-6239)
- Fix headers in CHANGELOG.md so that headers render correctly
- ensure_packages, converge ensure values 'present' and 'installed'
#### Changed
- Removes listed support for EOL Ubuntu versions
## Supported Release 4.18.0
### Summary
Small release that reverts the Puppet version requirement lower bound to again include Puppet 2.7+ and bumps the upper bound to now include Puppet 5.
#### Fixed
- Reverts lower bound of Puppet requirement to 2.7.20
## Supported Release 4.17.1
### Summary
Small release to address a bug (PUP-7650). Also pushes the Puppet version compatibility to 4.7.0.
#### Bugfixes
- (MODULES-5095) Workaround for PUP-7650
- (FM-6197) Formatting fixes for file_line resource
## Supported Release 4.17.0
### Summary
This release adds support for internationalization. It also contains Japanese translations for the README, summary and description of the metadata.json and major cleanups in the README. Additional folders have been introduced called locales and readmes where translation files can be found. A number of features and bug fixes are also included in this release. It also adds a new function `glob()` for expanding file lists. Also works around an issue that appeared in puppet 4.6.0 involving types being declared multiple times.
#### Features
- Addition of POT file / folder structure for i18n.
- Addition of Internationalized READMEs.
- `glob()` function
### Fixed
- Occasional duplicate type definitions when using `defined_with_params()`
- `file_line` encoding issue on ruby 1.8 (unsupported)
- Huge readme refresh
## Supported Release 4.16.0
### Summary
This release sees a massive update to all unit tests to test UTF8 characters. There are also multiple cleanups in preparation for internationalization. Alongside this, improvements to ipv6 support, a new length function compatible with Puppet 4, and an update to path types. Also contains multiple bug fixes around functionality and tests.
#### Features
- Addition of coverage in all unit tests for functions, data and resource types for UTF8 for i18n.
- All strings within the readme and functions that are split over two lines have been combined in preparation for i18n parser/decorator.
- Improvement on the ipv6 support for type - Improves regex to catch some valid (but lesser known) ipv6 strings, mostly those which are a mix of ipv6 strings and embedded ipv6 numbers.
- Adds a new parameter `encoding` to allow non UTF-8 files to specify a file encoding. This prevents receiving the error message "invalid byte sequence in UTF-8" when special characters that are not UTF-8 encoded appear in the input stream, such as the copyright symbol.
- Addition of the new length function. Returns the length of a given string, array or hash. To eventually replace the deprecated size() function as can handle the new type functionality introduced in Puppet 4.
- Permit double slash in absolute/Unix path types.
#### Bugfixes
- Fix unsupported data type error with rspec-puppet server.
- Now allows test module metadata.json to be read by Puppet.
- Fix acceptance test failure "Hiera is not a class".
- Removal of unsupported platforms and future parser setting in acceptance tests.
- Regex for tuple checking has been loosened.
- Ensure_packages function - Now only tries to apply the resource if not defined.
- (MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat.
- Adds comments to warn for UTF8 incompatibility of the functions that may not be compatible with UTF8 with Ruby < 2.4.0.
## Supported Release 4.15.0
### Summary
This release introduces multiple new functions, a new fact and the addition of Ubuntu Xenial support. Also includes a bugfix and documentation update.
#### Features
- Addition of puppet_server fact to return agents server.
- Addition of a pry function.
- Addition of tests for ensure_resources.
- Addition of FQDN UUID generation function.
- Addition of Ubuntu Xenial to OS Support.
#### Bugfixes
- Ensure_packages now works with Ruby < 2.0.
- Updated the documentation of str2bool function.
## Supported Release 4.14.0
### Summary
Adds several new features and updates, especially around refining the deprecation and validate_legacy functions. Also includes a Gemfile update around an issue with parallel_tests dependancy for different versions of Ruby.
#### Features
- Deprecation function now uses puppet stacktrace if available.
- join_key_to_values function now handles array values. If values are arrays, multiple keys are added for each element.
- Updated Gemfile to deal with parallel_tests Ruby dependancy (MODULES-3983).
- Updated/Fixed ipv4 regex validator (MODULES-3980).
- Deprecation clarification added to README.
#### Bugfixes
- README typo fixes.
- Use .dup to duplicate classes for modification (MODULES-3829).
- Fixes spec failures that were caused by a change in the tested error message in validate_legacy_spec.
- Broken link to validate_legacy docs fixed.
- Updates deprecation tests to include future parser.
## Supported Release 4.13.1
### Summary
This bugfix release addresses the `undefined method 'optional_repeated_param'` error messages seen by users of puppet 3.7.
It also improves the user experience around function deprecations by emitting one warning per function(-name) instead of only one deprecation overall. This allows users to identify all deprecated functions used in one agent run, with less back-and-forth.
#### Bugfixes
* Emit deprecations warnings for each function, instead of once per process. (MODULES-3961)
* Use a universally available API for the v4 deprecation stubs of `is_*` and `validate_*`. (MODULES-3962)
* Make `getvar()` compatible to ruby 1.8.7. (MODULES-3969)
* Add v4 deprecation stubs for the `is_` counterparts of the deprecated functions to emit the deprecations warnings in all cases.
## Supported Release 4.13.0
### Summary
This version of stdlib deprecates a whole host of functions, and provides stepping stones to move to Puppet 4 type validations. Be sure to check out the new `deprecation()` and `validate_legacy()` functions to migrate off the deprecated v3-style data validations.
Many thanks to all community contributors: bob, Dmitry Ilyin, Dominic Cleal, Joris, Joseph Yaworski, Loic Antoine-Gombeaud, Maksym Melnychok, Michiel Brandenburg, Nate Potter, Romain Tartière, Stephen Benjamin, and Steve Moore, as well as anyone contributing in the code review process and by submitting issues.
Special thanks to [Voxpupuli's](https://voxpupuli.org/) Igor Galić for donating the puppet-tea types to kickstart this part of stdlib.
#### Deprecations
* `validate_absolute_path`, `validate_array`, `validate_bool`, `validate_hash`, `validate_integer`, `validate_ip_address`, `validate_ipv4_address`, `validate_ipv6_address`, `validate_numeric`, `validate_re`, `validate_slength`, `validate_string`, and their `is_` counter parts are now deprecated on Puppet 4. See the `validate_legacy()` description in the README for help on migrating away from those functions.
* The `dig` function is provided by core puppet since 4.5.0 with slightly different calling convention. The stdlib version can still be accessed as `dig44` for now.
#### Features
* Add Puppet 4 data types for Unix, and Windows paths, and URLs.
* Add `deprecation` function to warn users of functionality that will be removed soon.
* Add `validate_legacy` function to help with migrating to Puppet 4 data types.
* Add `any2bool` function, a combination of of `string2bool` and `num2bool`.
* Add `delete_regex` function to delete array elements matching a regular expression.
* Add `puppet_environmentpath` fact to expose the `environmentpath` setting.
* Add `regexpescape` function to safely insert arbitrary strings into regular expressions.
* Add `shell_escape`, `shell_join`, and `shell_split` functions for safer working with shell scripts..
* The `delete` function now also accepts regular expressions as search term.
* The `loadyaml` function now accepts a default value, which is returned when there is an error loading the file.
#### Bugfixes
* Fix `file_line.match_for_absence` implementation and description to actually work. (MODULES-3590)
* Fix `getparam` so that it can now also return `false`. (MODULES-3933)
* Fix the fixture setup for testing and adjust `load_module_metadata` and `loadjson` tests.
* Fix `defined_with_params` to handle `undef` correctly on all puppet versions. (PUP-6422, MODULES-3543)
* Fix `file_line.path` validation to use puppet's built in `absolute_path?` matcher.
#### Minor Improvements
* README changes: improved descriptions of `deep_merge`, `delete`, `ensure_packages`, `file_line.after`, `range`, and `validate_numeric`.
* The `getvar` function now returns nil in all situations where the variable is not found.
* Update the `dig44` function with better `undef`, `nil`, and `false` handling.
* Better wording on `str2bool` argument validation error message.
### Known issues
* The `validate_legacy` function relies on internal APIs from Puppet 4.4.0 (PE 2016.1) onwards, and doesn't work on earlier versions.
* Puppet 4.5.0 (PE 2016.2) has a number of improvements around data types - especially error handling - that make working with them much nicer.
## Supported Release 4.12.0
### Summary
This release provides several new functions, bugfixes, modulesync changes, and some documentation updates.
#### Features
- Adds `clamp`. This function keeps values within a specified range.
- Adds `validate_x509_rsa_key_pair`. This function validates an x509 RSA certificate and key pair.
- Adds `dig`. This function performs a deep lookup in nested hashes or arrays.
- Extends the `base64` support to fit `rfc2045` and `rfc4648`.
- Adds `is_ipv6_address` and `is_ipv4_address`. These functions validate the specified ipv4 or ipv6 addresses.
- Adds `enclose_ipv6`. This function encloses IPv6 addresses in square brackets.
- Adds `ensure_resources`. This function takes a list of resources and creates them if they do not exist.
- Extends `suffix` to support applying a suffix to keys in a hash.
- Apply modulesync changes.
- Add validate_email_address function.
#### Bugfixes
- Fixes `fqdn_rand_string` tests, since Puppet 4.4.0 and later have a higher `fqdn_rand` ceiling.
- (MODULES-3152) Adds a check to `package_provider` to prevent failures if Gem is not installed.
- Fixes to README.md.
- Fixes catch StandardError rather than the gratuitous Exception
- Fixes file_line attribute validation.
- Fixes concat with Hash arguments.
## Supported Release 4.11.0
### Summary
Provides a validate_absolute_paths and Debian 8 support. There is a fix to the is_package_provider fact and a test improvement.
#### Features
- Adds new parser called is_absolute_path
- Supports Debian 8
#### Bugfixes
- Allow package_provider fact to resolve on PE 3.x
#### Improvements
- ensures that the test passes independently of changes to rubygems for ensure_resource
## 2015-12-15 - Supported Release 4.10.0
### Summary
Includes the addition of several new functions and considerable improvements to the existing functions, tests and documentation. Includes some bug fixes which includes compatibility, test and fact issues.
#### Features
- Adds service_provider fact
- Adds is_a() function
- Adds package_provider fact
- Adds validate_ip_address function
- Adds seeded_rand function
#### Bugfixes
- Fix backwards compatibility from an improvement to the parseyaml function
- Renaming of load_module_metadata test to include \_spec.rb
- Fix root_home fact on AIX 5.x, now '-c' rather than '-C'
- Fixed Gemfile to work with ruby 1.8.7
#### Improvements
- (MODULES-2462) Improvement of parseyaml function
- Improvement of str2bool function
- Improvement to readme
- Improvement of intersection function
- Improvement of validate_re function
- Improved speed on Facter resolution of service_provider
- empty function now handles numeric values
- Package_provider now prevents deprecation warning about the allow_virtual parameter
- load_module_metadata now succeeds on empty file
- Check added to ensure puppetversion value is not nil
- Improvement to bool2str to return a string of choice using boolean
- Improvement to naming convention in validate_ipv4_address function
## Supported Release 4.9.1
### Summary
Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
## 2015-09-08 - Supported Release 4.9.0
### Summary
This release adds new features including the new functions dos2unix, unix2dos, try_get_value, convert_base as well as other features and improvements.
#### Features
- (MODULES-2370) allow `match` parameter to influence `ensure => absent` behavior
- (MODULES-2410) Add new functions dos2unix and unix2dos
- (MODULE-2456) Modify union to accept more than two arrays
- Adds a convert_base function, which can convert numbers between bases
- Add a new function "try_get_value"
#### Bugfixes
- n/a
#### Improvements
- (MODULES-2478) Support root_home fact on AIX through "lsuser" command
- Acceptance test improvements
- Unit test improvements
- Readme improvements
## 2015-08-10 - Supported Release 4.8.0
### Summary
This release adds a function for reading metadata.json from any module, and expands file\_line's abilities.
#### Features
- New parameter `replace` on `file_line`
- New function `load_module_metadata()` to load metadata.json and return the content as a hash.
- Added hash support to `size()`
#### Bugfixes
- Fix various docs typos
- Fix `file_line` resource on puppet < 3.3
## 2015-06-22 - Supported Release 4.7.0
### Summary
Adds Solaris 12 support along with improved Puppet 4 support. There are significant test improvements, and some minor fixes.
#### Features
- Add support for Solaris 12
#### Bugfixes
- Fix for AIO Puppet 4
- Fix time for ruby 1.8.7
- Specify rspec-puppet version
- range() fix for typeerror and missing functionality
- Fix pw_hash() on JRuby < 1.7.17
- fqdn_rand_string: fix argument error message
- catch and rescue from looking up non-existent facts
- Use puppet_install_helper, for Puppet 4
#### Improvements
- Enforce support for Puppet 4 testing
- fqdn_rotate/fqdn_rand_string acceptance tests and implementation
- Simplify mac address regex
- validate_integer, validate_numeric: explicitely reject hashes in arrays
- Readme edits
- Remove all the pops stuff for rspec-puppet
- Sync via modulesync
- Add validate_slength optional 3rd arg
- Move tests directory to examples directory
## 2015-04-14 - Supported Release 4.6.0
### Summary
Adds functions and function argument abilities, and improves compatibility with the new puppet parser
#### Features
- MODULES-444: `concat()` can now take more than two arrays
- `basename()` added to have Ruby File.basename functionality
- `delete()` can now take an array of items to remove
- `prefix()` can now take a hash
- `upcase()` can now take a hash or array of upcaseable things
- `validate_absolute_path()` can now take an array
- `validate_cmd()` can now use % in the command to embed the validation file argument in the string
- MODULES-1473: deprecate `type()` function in favor of `type3x()`
- MODULES-1473: Add `type_of()` to give better type information on future parser
- Deprecate `private()` for `assert_private()` due to future parser
- Adds `ceiling()` to take the ceiling of a number
- Adds `fqdn_rand_string()` to generate random string based on fqdn
- Adds `pw_hash()` to generate password hashes
- Adds `validate_integer()`
- Adds `validate_numeric()` (like `validate_integer()` but also accepts floats)
#### Bugfixes
- Fix seeding of `fqdn_rotate()`
- `ensure_resource()` is more verbose on debug mode
- Stricter argument checking for `dirname()`
- Fix `is_domain_name()` to better match RFC
- Fix `uriescape()` when called with array
- Fix `file_line` resource when using the `after` attribute with `match`
## 2015-01-14 - Supported Release 4.5.1
### Summary
This release changes the temporary facter_dot_d cache locations outside of the /tmp directory due to a possible security vunerability. CVE-2015-1029
#### Bugfixes
- Facter_dot_d cache will now be stored in puppet libdir instead of tmp
## 2014-12-15 - Supported Release 4.5.0
### Summary
This release improves functionality of the member function and adds improved future parser support.
#### Features
- MODULES-1329: Update member() to allow the variable to be an array.
- Sync .travis.yml, Gemfile, Rakefile, and CONTRIBUTING.md via modulesync
#### Bugfixes
- Fix range() to work with numeric ranges with the future parser
- Accurately express SLES support in metadata.json (was missing 10SP4 and 12)
- Don't require `line` to match the `match` parameter
## 2014-11-10 - Supported Release 4.4.0
### Summary
This release has an overhauled readme, new private manifest function, and fixes many future parser bugs.
#### Features
- All new shiny README
- New `private()` function for making private manifests (yay!)
#### Bugfixes
- Code reuse in `bool2num()` and `zip()`
- Fix many functions to handle `generate()` no longer returning a string on new puppets
- `concat()` no longer modifies the first argument (whoops)
- strict variable support for `getvar()`, `member()`, `values_at`, and `has_interface_with()`
- `to_bytes()` handles PB and EB now
- Fix `tempfile` ruby requirement for `validate_augeas()` and `validate_cmd()`
- Fix `validate_cmd()` for windows
- Correct `validate_string()` docs to reflect non-handling of `undef`
- Fix `file_line` matching on older rubies
## 2014-07-15 - Supported Release 4.3.2
### Summary
This release merely updates metadata.json so the module can be uninstalled and
upgraded via the puppet module command.
## 2014-07-14 - Supported Release 4.3.1
### Summary
This supported release updates the metadata.json to work around upgrade behavior of the PMT.
#### Bugfixes
- Synchronize metadata.json with PMT-generated metadata to pass checksums
## 2014-06-27 - Supported Release 4.3.0
### Summary
This release is the first supported release of the stdlib 4 series. It remains
backwards-compatible with the stdlib 3 series. It adds two new functions, one bugfix, and many testing updates.
#### Features
- New `bool2str()` function
- New `camelcase()` function
#### Bugfixes
- Fix `has_interface_with()` when interfaces fact is nil
## 2014-06-04 - Release 4.2.2
### Summary
This release adds PE3.3 support in the metadata and fixes a few tests.
## 2014-05-08 - Release - 4.2.1
### Summary
This release moves a stray symlink that can cause problems.
## 2014-05-08 - Release - 4.2.0
### Summary
This release adds many new functions and fixes, and continues to be backwards compatible with stdlib 3.x
#### Features
- New `base64()` function
- New `deep_merge()` function
- New `delete_undef_values()` function
- New `delete_values()` function
- New `difference()` function
- New `intersection()` function
- New `is_bool()` function
- New `pick_default()` function
- New `union()` function
- New `validate_ipv4_address` function
- New `validate_ipv6_address` function
- Update `ensure_packages()` to take an option hash as a second parameter.
- Update `range()` to take an optional third argument for range step
- Update `validate_slength()` to take an optional third argument for minimum length
- Update `file_line` resource to take `after` and `multiple` attributes
#### Bugfixes
- Correct `is_string`, `is_domain_name`, `is_array`, `is_float`, and `is_function_available` for parsing odd types such as bools and hashes.
- Allow facts.d facts to contain `=` in the value
- Fix `root_home` fact on darwin systems
- Fix `concat()` to work with a second non-array argument
- Fix `floor()` to work with integer strings
- Fix `is_integer()` to return true if passed integer strings
- Fix `is_numeric()` to return true if passed integer strings
- Fix `merge()` to work with empty strings
- Fix `pick()` to raise the correct error type
- Fix `uriescape()` to use the default URI.escape list
- Add/update unit & acceptance tests.
## 2014-03-04 - Supported Release - 3.2.1
### Summary
This is a supported release
#### Bugfixes
- Fixed `is_integer`/`is_float`/`is_numeric` for checking the value of arithmatic expressions.
#### Known bugs
* No known bugs
---
##### 2013-05-06 - Jeff McCune <jeff@puppetlabs.com> - 4.1.0
* (#20582) Restore facter\_dot\_d to stdlib for PE users (3b887c8)
* (maint) Update Gemfile with GEM\_FACTER\_VERSION (f44d535)
##### 2013-05-06 - Alex Cline <acline@us.ibm.com> - 4.1.0
* Terser method of string to array conversion courtesy of ethooz. (d38bce0)
##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
* Refactor ensure\_resource expectations (b33cc24)
##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
* Changed str-to-array conversion and removed abbreviation. (de253db)
##### 2013-05-03 - Alex Cline <acline@us.ibm.com> 4.1.0
* (#20548) Allow an array of resource titles to be passed into the ensure\_resource function (e08734a)
##### 2013-05-02 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.1.0
* Add a dirname function (2ba9e47)
##### 2013-04-29 - Mark Smith-Guerrero <msmithgu@gmail.com> - 4.1.0
* (maint) Fix a small typo in hash() description (928036a)
##### 2013-04-12 - Jeff McCune <jeff@puppetlabs.com> - 4.0.2
* Update user information in gemspec to make the intent of the Gem clear.
##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.1
* Fix README function documentation (ab3e30c)
##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* stdlib 4.0 drops support with Puppet 2.7
* stdlib 4.0 preserves support with Puppet 3
##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* Add ability to use puppet from git via bundler (9c5805f)
##### 2013-04-10 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* (maint) Make stdlib usable as a Ruby GEM (e81a45e)
##### 2013-04-10 - Erik Dalén <dalen@spotify.com> - 4.0.0
* Add a count function (f28550e)
##### 2013-03-31 - Amos Shapira <ashapira@atlassian.com> - 4.0.0
* (#19998) Implement any2array (7a2fb80)
##### 2013-03-29 - Steve Huff <shuff@vecna.org> - 4.0.0
* (19864) num2bool match fix (8d217f0)
##### 2013-03-20 - Erik Dalén <dalen@spotify.com> - 4.0.0
* Allow comparisons of Numeric and number as String (ff5dd5d)
##### 2013-03-26 - Richard Soderberg <rsoderberg@mozilla.com> - 4.0.0
* add suffix function to accompany the prefix function (88a93ac)
##### 2013-03-19 - Kristof Willaert <kristof.willaert@gmail.com> - 4.0.0
* Add floor function implementation and unit tests (0527341)
##### 2012-04-03 - Eric Shamow <eric@puppetlabs.com> - 4.0.0
* (#13610) Add is\_function\_available to stdlib (961dcab)
##### 2012-12-17 - Justin Lambert <jlambert@eml.cc> - 4.0.0
* str2bool should return a boolean if called with a boolean (5d5a4d4)
##### 2012-10-23 - Uwe Stuehler <ustuehler@team.mobile.de> - 4.0.0
* Fix number of arguments check in flatten() (e80207b)
##### 2013-03-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* Add contributing document (96e19d0)
##### 2013-03-04 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
* Add missing documentation for validate\_augeas and validate\_cmd to README.markdown (a1510a1)
##### 2013-02-14 - Joshua Hoblitt <jhoblitt@cpan.org> - 4.0.0
* (#19272) Add has\_element() function (95cf3fe)
##### 2013-02-07 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
* validate\_cmd(): Use Puppet::Util::Execution.execute when available (69248df)
##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
* Add validate\_augeas function (3a97c23)
##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
* Add validate\_cmd function (6902cc5)
##### 2013-01-14 - David Schmitt <david@dasz.at> - 4.0.0
* Add geppetto project definition (b3fc0a3)
##### 2013-01-02 - Jaka Hudoklin <jakahudoklin@gmail.com> - 4.0.0
* Add getparam function to get defined resource parameters (20e0e07)
##### 2013-01-05 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* (maint) Add Travis CI Support (d082046)
##### 2012-12-04 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* Clarify that stdlib 3 supports Puppet 3 (3a6085f)
##### 2012-11-30 - Erik Dalén <dalen@spotify.com> - 4.0.0
* maint: style guideline fixes (7742e5f)
##### 2012-11-09 - James Fryman <james@frymanet.com> - 4.0.0
* puppet-lint cleanup (88acc52)
##### 2012-11-06 - Joe Julian <me@joejulian.name> - 4.0.0
* Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d)
##### 2012-09-18 - Chad Metcalf <chad@wibidata.com> - 3.2.0
* Add an ensure\_packages function. (8a8c09e)
##### 2012-11-23 - Erik Dalén <dalen@spotify.com> - 3.2.0
* (#17797) min() and max() functions (9954133)
##### 2012-05-23 - Peter Meier <peter.meier@immerda.ch> - 3.2.0
* (#14670) autorequire a file\_line resource's path (dfcee63)
##### 2012-11-19 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
* Add join\_keys\_to\_values function (ee0f2b3)
##### 2012-11-17 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
* Extend delete function for strings and hashes (7322e4d)
##### 2012-08-03 - Gary Larizza <gary@puppetlabs.com> - 3.2.0
* Add the pick() function (ba6dd13)
##### 2012-03-20 - Wil Cooley <wcooley@pdx.edu> - 3.2.0
* (#13974) Add predicate functions for interface facts (f819417)
##### 2012-11-06 - Joe Julian <me@joejulian.name> - 3.2.0
* Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e)
##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 3.1.1
* (maint) Fix spec failures resulting from Facter API changes (97f836f)
##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 3.1.0
* Add PE facts to stdlib (cdf3b05)
##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.1
* Fix accidental removal of facts\_dot\_d.rb in 3.0.0 release
##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.0
* stdlib 3.0 drops support with Puppet 2.6
* stdlib 3.0 preserves support with Puppet 2.7
##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 3.0.0
* Add function ensure\_resource and defined\_with\_params (ba789de)
##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 3.0.0
* (#2157) Remove facter\_dot\_d for compatibility with external facts (f92574f)
##### 2012-04-10 - Chris Price <chris@puppetlabs.com> - 3.0.0
* (#13693) moving logic from local spec\_helper to puppetlabs\_spec\_helper (85f96df)
##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 2.5.1
* (maint) Fix spec failures resulting from Facter API changes (97f836f)
##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 2.5.0
* Add PE facts to stdlib (cdf3b05)
##### 2012-08-15 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Explicitly load functions used by ensure\_resource (9fc3063)
##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Add better docs about duplicate resource failures (97d327a)
##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Handle undef for parameter argument (4f8b133)
##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Add function ensure\_resource and defined\_with\_params (a0cb8cd)
##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
* Disable tests that fail on 2.6.x due to #15912 (c81496e)
##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
* (Maint) Fix mis-use of rvalue functions as statements (4492913)
##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
* Add .rspec file to repo root (88789e8)
##### 2012-06-07 - Chris Price <chris@puppetlabs.com> - 2.4.0
* Add support for a 'match' parameter to file\_line (a06c0d8)
##### 2012-08-07 - Erik Dalén <dalen@spotify.com> - 2.4.0
* (#15872) Add to\_bytes function (247b69c)
##### 2012-07-19 - Jeff McCune <jeff@puppetlabs.com> - 2.4.0
* (Maint) use PuppetlabsSpec::PuppetInternals.scope (main) (deafe88)
##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 2.4.0
* (#2157) Make facts\_dot\_d compatible with external facts (5fb0ddc)
##### 2012-03-16 - Steve Traylen <steve.traylen@cern.ch> - 2.4.0
* (#13205) Rotate array/string randomley based on fqdn, fqdn\_rotate() (fef247b)
##### 2012-05-22 - Peter Meier <peter.meier@immerda.ch> - 2.3.3
* fix regression in #11017 properly (f0a62c7)
##### 2012-05-10 - Jeff McCune <jeff@puppetlabs.com> - 2.3.3
* Fix spec tests using the new spec\_helper (7d34333)
##### 2012-05-10 - Puppet Labs <support@puppetlabs.com> - 2.3.2
* Make file\_line default to ensure => present (1373e70)
* Memoize file\_line spec instance variables (20aacc5)
* Fix spec tests using the new spec\_helper (1ebfa5d)
* (#13595) initialize\_everything\_for\_tests couples modules Puppet ver (3222f35)
* (#13439) Fix MRI 1.9 issue with spec\_helper (15c5fd1)
* (#13439) Fix test failures with Puppet 2.6.x (665610b)
* (#13439) refactor spec helper for compatibility with both puppet 2.7 and server (82194ca)
* (#13494) Specify the behavior of zero padded strings (61891bb)
##### 2012-03-29 Puppet Labs <support@puppetlabs.com> - 2.1.3
* (#11607) Add Rakefile to enable spec testing
* (#12377) Avoid infinite loop when retrying require json
##### 2012-03-13 Puppet Labs <support@puppetlabs.com> - 2.3.1
* (#13091) Fix LoadError bug with puppet apply and puppet\_vardir fact
##### 2012-03-12 Puppet Labs <support@puppetlabs.com> - 2.3.0
* Add a large number of new Puppet functions
* Backwards compatibility preserved with 2.2.x
##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.2.1
* Documentation only release for the Forge
##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.1.2
* Documentation only release for PE 2.0.x
##### 2011-11-08 Puppet Labs <support@puppetlabs.com> - 2.2.0
* #10285 - Refactor json to use pson instead.
* Maint - Add watchr autotest script
* Maint - Make rspec tests work with Puppet 2.6.4
* #9859 - Add root\_home fact and tests
##### 2011-08-18 Puppet Labs <support@puppetlabs.com> - 2.1.1
* Change facts.d paths to match Facter 2.0 paths.
* /etc/facter/facts.d
* /etc/puppetlabs/facter/facts.d
##### 2011-08-17 Puppet Labs <support@puppetlabs.com> - 2.1.0
* Add R.I. Pienaar's facts.d custom facter fact
* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are
automatically loaded now.
##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 2.0.0
* Rename whole\_line to file\_line
* This is an API change and as such motivating a 2.0.0 release according to semver.org.
##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.1.0
* Rename append\_line to whole\_line
* This is an API change and as such motivating a 1.1.0 release.
##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.0.0
* Initial stable release
* Add validate\_array and validate\_string functions
* Make merge() function work with Ruby 1.8.5
* Add hash merging function
* Add has\_key function
* Add loadyaml() function
* Add append\_line native
##### 2011-06-21 Jeff McCune <jeff@puppetlabs.com> - 0.1.7
* Add validate\_hash() and getvar() functions
##### 2011-06-15 Jeff McCune <jeff@puppetlabs.com> - 0.1.6
* Add anchor resource type to provide containment for composite classes
##### 2011-06-03 Jeff McCune <jeff@puppetlabs.com> - 0.1.5
* Add validate\_bool() function to stdlib
##### 0.1.4 2011-05-26 Jeff McCune <jeff@puppetlabs.com>
* Move most stages after main
##### 0.1.3 2011-05-25 Jeff McCune <jeff@puppetlabs.com>
* Add validate\_re() function
##### 0.1.2 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
* Update to add annotated tag
##### 0.1.1 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
* Add stdlib::stages class with a standard set of stages
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
# Setting ownership to the modules team
* @puppetlabs/modules
# Contributing to Puppet modules
So you want to contribute to a Puppet module: Great! Below are some instructions to get you started doing
that very thing while setting expectations around code quality as well as a few tips for making the
process as easy as possible.
### Table of Contents
1. [Getting Started](#getting-started)
1. [Commit Checklist](#commit-checklist)
1. [Submission](#submission)
1. [More about commits](#more-about-commits)
1. [Testing](#testing)
- [Running Tests](#running-tests)
- [Writing Tests](#writing-tests)
1. [Get Help](#get-help)
## Getting Started
- Fork the module repository on GitHub and clone to your workspace
- Make your changes!
## Commit Checklist
### The Basics
- [x] my commit is a single logical unit of work
- [x] I have checked for unnecessary whitespace with "git diff --check"
- [x] my commit does not include commented out code or unneeded files
### The Content
- [x] my commit includes tests for the bug I fixed or feature I added
- [x] my commit includes appropriate documentation changes if it is introducing a new feature or changing existing functionality
- [x] my code passes existing test suites
### The Commit Message
- [x] the first line of my commit message includes:
- [x] an issue number (if applicable), e.g. "(MODULES-xxxx) This is the first line"
- [x] a short description (50 characters is the soft limit, excluding ticket number(s))
- [x] the body of my commit message:
- [x] is meaningful
- [x] uses the imperative, present tense: "change", not "changed" or "changes"
- [x] includes motivation for the change, and contrasts its implementation with the previous behavior
## Submission
### Pre-requisites
- Make sure you have a [GitHub account](https://github.com/join)
- [Create a ticket](https://tickets.puppet.com/secure/CreateIssue!default.jspa), or [watch the ticket](https://tickets.puppet.com/browse/) you are patching for.
### Push and PR
- Push your changes to your fork
- [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request-from-a-fork/) against the repository in the puppetlabs organization
## More about commits
1. Make separate commits for logically separate changes.
Please break your commits down into logically consistent units
which include new or changed tests relevant to the rest of the
change. The goal of doing this is to make the diff easier to
read for whoever is reviewing your code. In general, the easier
your diff is to read, the more likely someone will be happy to
review it and get it into the code base.
If you are going to refactor a piece of code, please do so as a
separate commit from your feature or bug fix changes.
We also really appreciate changes that include tests to make
sure the bug is not re-introduced, and that the feature is not
accidentally broken.
Describe the technical detail of the change(s). If your
description starts to get too long, that is a good sign that you
probably need to split up your commit into more finely grained
pieces.
Commits which plainly describe the things which help
reviewers check the patch and future developers understand the
code are much more likely to be merged in with a minimum of
bike-shedding or requested changes. Ideally, the commit message
would include information, and be in a form suitable for
inclusion in the release notes for the version of Puppet that
includes them.
Please also check that you are not introducing any trailing
whitespace or other "whitespace errors". You can do this by
running "git diff --check" on your changes before you commit.
2. Sending your patches
To submit your changes via a GitHub pull request, we _highly_
recommend that you have them on a topic branch, instead of
directly on "main".
It makes things much easier to keep track of, especially if
you decide to work on another thing before your first change
is merged in.
GitHub has some pretty good
[general documentation](http://help.github.com/) on using
their site. They also have documentation on
[creating pull requests](https://help.github.com/articles/creating-a-pull-request-from-a-fork/).
In general, after pushing your topic branch up to your
repository on GitHub, you can switch to the branch in the
GitHub UI and click "Pull Request" towards the top of the page
in order to open a pull request.
3. Update the related JIRA issue.
If there is a JIRA issue associated with the change you
submitted, then you should update the ticket to include the
location of your branch, along with any other commentary you
may wish to make.
# Testing
## Getting Started
Our Puppet modules provide [`Gemfile`](./Gemfile)s, which can tell a Ruby package manager such as [bundler](http://bundler.io/) what Ruby packages,
or Gems, are required to build, develop, and test this software.
Please make sure you have [bundler installed](http://bundler.io/#getting-started) on your system, and then use it to
install all dependencies needed for this project in the project root by running
```shell
% bundle install --path .bundle/gems
Fetching gem metadata from https://rubygems.org/........
Fetching gem metadata from https://rubygems.org/..
Using rake (10.1.0)
Using builder (3.2.2)
-- 8><-- many more --><8 --
Using rspec-system-puppet (2.2.0)
Using serverspec (0.6.3)
Using rspec-system-serverspec (1.0.0)
Using bundler (1.3.5)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
```
NOTE: some systems may require you to run this command with sudo.
If you already have those gems installed, make sure they are up-to-date:
```shell
% bundle update
```
## Running Tests
With all dependencies in place and up-to-date, run the tests:
### Unit Tests
```shell
% bundle exec rake spec
```
This executes all the [rspec tests](http://rspec-puppet.com/) in the directories defined [here](https://github.com/puppetlabs/puppetlabs_spec_helper/blob/699d9fbca1d2489bff1736bb254bb7b7edb32c74/lib/puppetlabs_spec_helper/rake_tasks.rb#L17) and so on.
rspec tests may have the same kind of dependencies as the module they are testing. Although the module defines these dependencies in its [metadata.json](./metadata.json),
rspec tests define them in [.fixtures.yml](./fixtures.yml).
### Acceptance Tests
Some Puppet modules also come with acceptance tests, which use [beaker][]. These tests spin up a virtual machine under
[VirtualBox](https://www.virtualbox.org/), controlled with [Vagrant](http://www.vagrantup.com/), to simulate scripted test
scenarios. In order to run these, you need both Virtualbox and Vagrant installed on your system.
Run the tests by issuing the following command
```shell
% bundle exec rake spec_clean
% bundle exec rspec spec/acceptance
```
This will now download a pre-fabricated image configured in the [default node-set](./spec/acceptance/nodesets/default.yml),
install Puppet, copy this module, and install its dependencies per [spec/spec_helper_acceptance.rb](./spec/spec_helper_acceptance.rb)
and then run all the tests under [spec/acceptance](./spec/acceptance).
## Writing Tests
### Unit Tests
When writing unit tests for Puppet, [rspec-puppet][] is your best friend. It provides tons of helper methods for testing your manifests against a
catalog (e.g. contain_file, contain_package, with_params, etc). It would be ridiculous to try and top rspec-puppet's [documentation][rspec-puppet_docs]
but here's a tiny sample:
Sample manifest:
```puppet
file { "a test file":
ensure => present,
path => "/etc/sample",
}
```
Sample test:
```ruby
it 'does a thing' do
expect(subject).to contain_file("a test file").with({:path => "/etc/sample"})
end
```
### Acceptance Tests
Writing acceptance tests for Puppet involves [beaker][] and its cousin [beaker-rspec][]. A common pattern for acceptance tests is to create a test manifest, apply it
twice to check for idempotency or errors, then run expectations.
```ruby
it 'does an end-to-end thing' do
pp = <<-EOF
file { 'a test file':
ensure => present,
path => "/etc/sample",
content => "test string",
}
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
describe file("/etc/sample") do
it { is_expected.to contain "test string" }
end
```
# If you have commit access to the repository
Even if you have commit access to the repository, you still need to go through the process above, and have someone else review and merge
in your changes. The rule is that **all changes must be reviewed by a project developer that did not write the code to ensure that
all changes go through a code review process.**
The record of someone performing the merge is the record that they performed the code review. Again, this should be someone other than the author of the topic branch.
# Get Help
### On the web
* [Puppet help messageboard](http://puppet.com/community/get-help)
* [Writing tests](https://docs.puppet.com/guides/module_guides/bgtm.html#step-three-module-testing)
* [General GitHub documentation](http://help.github.com/)
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/)
### On chat
* Slack (slack.puppet.com) #forge-modules, #puppet-dev, #windows, #voxpupuli
* IRC (freenode) #puppet-dev, #voxpupuli
[rspec-puppet]: http://rspec-puppet.com/
[rspec-puppet_docs]: http://rspec-puppet.com/documentation/
[beaker]: https://github.com/puppetlabs/beaker
[beaker-rspec]: https://github.com/puppetlabs/beaker-rspec
## 5.0.0
### Summary
This is a major release which removes support for the Scientific 5 and Debian 7 OS, as well as a removal of the `Stdlib::(Ipv4|IPv6|Ip_address)` data types in favour of `Stdlib::IP::*`.
**In addition it contains a substantial piece of work centered around updating functions that have now been migrated into Puppet itself. Please note that this will be the last major release to support Puppet 2 and Puppet 3 and that they will soon be removed.**
#### Fixed
- Docs URLs corrected.
- Docs clarified that `Stdlib::Unixpath` only matches absolute paths.
- `dirname()` now fails when passed an empty string.
- `basename()` documentation clarified.
- Corrected documentation of `count()` wrt matches and empty string.
- Corrected example in `getparam()` and added note about equivalent in puppet.
- Fixed URL to use 'latest' instead of '5.5' for `Hash.new` function.
#### Added
- Support added for symbolic file nodes.
- `loadjson()` and `loadyml()` now compatible with HTTPS files.
- `loadjson()` and `loadyml()` now compatible with HTTP basic auth files.
- `any2array` now returns and empty array when given an empty string.
- Support has now been added for Ubuntu 18.04.
- `seeded_rand_string()` function has been added.
#### Changed
- PDK update `1.5.0` has been applied.
- `size()` function deprecated for Puppet 6 and above.
- `wrt` functions moved to Puppet as of Puppet 6.
- `sprintf_hash` has had notification put in place to show that as of Puppet 4.10.10 it's functionality is supported by the puppet core.
- Added note that `abs()` is in puppet since 6.0.0.
- Added information to `base64` function about Binary data type.
- Added note to `camelcase()` that function is now in puppet.
- Added note to `capitalize()` that function is now in puppet.
- Added note to `ceiling()` that function is now in puppet.
- Added note to `chomp()` that function is now in puppet.
- Added note to `chop()` that function is now in puppet.
- Added note how to do equivalence of `clamp()` function in puppet 6.
- Added note that `concat()` can be done with + since puppet 4.0.0.
- Added note to `convert_base()` how to do this with puppet core.
- Added equivalent puppet core way of doing `count()`.
- Added docs for equivalent puppet language for `delete_regexp()`.
- Added docs for equivalent language constructs for `delete_at()`.
- Added puppet 4 equivalent for `delete_undef()` function.
- Added equivalent puppet language for `delete_values()`.
- Updated `delete()` function with docs about equivalent language.
- Added docs that - between arrays is the same as `difference()`.
- Added note to `downcase()` that function is now in puppet.
- Added note to `empty()` that function is now in puppet.
- Added note to `flatten()` that function is now in puppet.
- Added note to `floor()` that function is now in puppet.
- Added note to `get_module_path()` that puppet has similar function.
- Amended documentation for `getvar()`.
- Add note to `grep()` that `filter()` in puppet does the same.
- Updated `has_key()` with equivalent puppet lang expresion.
- Updated the `hash()` function to show equivalent expression.
- Added note about more formatting options with `String()` in puppet.
- Added note to `join()` that it is in puppet since 5.4.0.
- Added note to `keys()` that it is in puppet since 5.4.0.
- Added note to `lstrip()`, `rstrip()`, `strip()` and `upcase()` that they are in puppet since 6.0.0.
- Updated `member()` with equivalent language expression example.
- Updated `merge()` with puppt language equivalent example.
- Updated `min()` and `max()` with note that they are in puppet.
- Updated `num2bool()` with information that Boolean can convert.
- Updated `prefix()` function with equivalent operation in pupppet.
- Updated `range()` with information that Integer can be used.
- Updated `reject()` with equivalent filter() call.
- Added note to `reverse()` that the `reverse_each()` Puppet function does the same as it.
- Added note to `round()` that it has moved to puppet in 6.0.0.
- Added note to `size()` that `length()` is in puppet since 5.4.0.
- Added note to `sort()` that is has moved to Puppet in 6.0.0.
- Updated `str2bool()` with a note that Boolean can handle conversion.
- Added note to `strftime()` that it moved to puppet in 4.8.0.
- Added note to `suffix()` that the same can be done with `map()`.
- Updated `time()` to mention Timespan and Timestamp data types.
- Added note to `values_at()` for equivalent slice operation in language.
- Added note to `values()` that it moved to puppet in 5.5.0.
- Corrected docs for `keys()` - in puppet since 5.5.0.
- Added note to `length()` that function moved to puppet.
- Updated README.md with deprecations for functions moved to puppet.
- Updated documentation of `values_at()`.
- Updated README with note from `time()` about data types for time.
- Updated README for `strintf_hash()` (supported by builtin sprintf).
- Updated README with deprecation of `hash()` function (use data type).
- Updated README `suffix` with equiv example for `map`.
- Updated README with `reject` equivalent call to `filter`.
- Updated README with `range` equiv use of type system + `each`.
- Updated README with `prefix` equiv func using `map`.
- Updated README for `num2bool` with info about Boolean type.
- Updated README `str2bool` with information about `Boolean` equivalent.
- Updated README `merge` with info about `+` operator equivalent.
- Updated README `member` with equivalent alternative in language.
- Updated README `join_keys_to_values` with link to String.new.
- Updated README `has_key` shows deprecation in favor of `in`.
- Updated README `grep` adds information about `filter`.
- Updated README and `getvar.rb` as getvar has moved to puppet.
- Updated README for `getparam` to be the same as in function.
- Updated README `get_module_path` with info about built in variant.
- Updated README `difference` to mention `-` operator equiv.
- Updated README `delete` with built-in alternatives.
- Updated README `delete_values` with builtin equiv.
- Updated README `delete_undef` & `delete_regexp` with builtin equiv.
- Updated README `delete_at` with equivalent built-in examples.
- Updated README `coun`t to show built-in equiv.
- Updated README `convert_base` with built-in equiv.
- Updated README `concat` with built-in equiv using + and <<.
- Updated README `base_64` with built-in equiv using Binary type.
- Skipped tests for `abs` if puppet version < 6.0.0.
- Skipped tests for `min` and `max` if puppet version < 6.0.0.
- Skipped tests for `floor` if puppet version < 6.0.0.
- Skipped tests for `ceiling` if puppet version < 6.0.0.
- Skipped tests for `round` if puppet version < 6.0.0.
- Skipped tests for `upcase` if puppet version < 6.0.0.
- Skipped tests for `downcase` if puppet version < 6.0.0.
- Skipped tests for `capitalize` if puppet version < 6.0.0.
- Skipped tests for `camelcase` if puppet version < 6.0.0.
- Skipped tests for strip functions if puppet version < 6.0.0.
- Skipped tests for `chop` and `chomp` if puppet version < 6.0.0.
- Skipped tests for `sort` if puppet version < 6.0.0.
- Removed extra space in `describe` for `abs` test.
- Updated README and `any2array` with built-in equiv Array.new.
- Updated README and `any2bool` with built-in equiv Boolean.new.
- Updated README and `bool2num` with built-in equiv Numeric.new.
- Updated README and `bool2str` with built-in equiv String.new.
- Corrected equivalent example for `count`.
- Updated README and made mention of `filter` in `delete` a link.
- Updated docs and tests for `strftime`.
- Updated all acceptance test using Puppet.version.
- Change 'puppet' to 'Puppet' in function doc strings.
- HTTP type checks are now case insensitive.
#### Removed
- Support has been removed for `Scientific 5` and `Debian 7` operating systems.
- `Stdlib::(Ipv4|IPv6|Ip_address)` have been removed.
## Supported Release 4.25.1
### Summary
This is a patch which includes a roll up of small fixes. In Puppet 5.5.0 `flatten()`, `length(),` `empty(),` `join(),` `keys(),` and `values()` are now built into Puppet. Please note that the Puppet implementation of the functions will take precedence over the functions in 'puppetlabs-stdlib'.
#### Fixed
- Remove unneeded execute permission from test files.
- Puppet 5.5.0 function deprecation [MODULES-6894](https://tickets.puppetlabs.com/browse/MODULES-6894).
## Supported Release 4.25.0
### Summary
This is quite a feature heavy release, it makes this module PDK-compliant for easier maintenance and includes a roll up of maintenance changes.
#### Added
- PDK conversion [MODULES-6332](https://tickets.puppetlabs.com/browse/MODULES-6332).
- Update `join_keys_to_values` with an undef statement.
- Type alias `Stdlib::Fqdn` matches paths on a fully qualified domain name.
- Type alias `Stdlib::Host` matches a valid host, this can be a valid 'ipv4', 'ipv6' or 'fqdn'.
- Type alias `Stdlib::Port` matches a valid TCP/UDP Port number.
- Type alias `Stdlib::Filesource` matches paths valid values for the source parameter of the puppet file type.
- Type alias `Stdlib::IP::Address` matches any IP address, including both IPv4 and IPv6 addresses,
- Type alias `Stdlib::IP::Address::V4` matches any string consisting of a valid IPv4 address, this is extended by 'CIDR' and 'nosubnet'.
- Type alias `Stdlib::IP::Address::V6` matches any string consisting of a valid IPv6 address, this is extended by 'Full', 'Alternate' and 'Compressed'.
- Type alias `Stdlib::IP::Address::V6::Nosubnet`matches any string consisting of a valid IPv6 address with no subnet, this is extended by 'Full', 'Alternate' and 'Compressed'.
- Type alias `Stdlib::Port` matches a valid TCP/UDP Port number this is then extended to 'Privileged' which are ports less than 1024 and 'Unprivileged' which are ports greater than 1024.
## Supported Release 4.24.0
### Summary
This release includes a roll up of minor changes and a new feature which provides the ability to skip undef values `to_json_pretty()`.
We have also reverted a change that was previously made and resulted in breaking compatibility with Ruby 1.8.7.
#### Added
- Ability to skip undef values in `to_json_pretty()`.
- Fix type3x function in stdlib ([MODULES-6216](https://tickets.puppet.com/browse/MODULES-6216))
#### Changed
- Indentation for `sync.yml` was fixed.
- Updated type alias tests and dropped superfluous wrapper classes
- Revert to old ruby 1.X style of hash ([MODULES-6139](https://tickets.puppet.com/browse/MODULES-6139))
- `rubocop.yml` not managed by msync ([MODULES-6201](https://tickets.puppet.com/browse/MODULES-6201))
## Supported Release 4.23.0
### Summary
This release is in order to implement Rubocop changes throughout the module.
#### Added
- Standard and translated readme's have been updated.
- Rubocop has been implemented in the module and a wide variety of changes have been made to the code.
- Modulesync changes have been merged into the code.
#### Fixed
- Minor fix to the readme.
## Supported Release 4.22.0
### Summary
This is a clean release in preparation of putting the module through the rubocop process.
#### Added
- Support has been added for Debian 9
- 'Stdlib::Mode type' has been added to the module.
- A type for 'ensure' has been added to the service resources.
- A new function 'sprintf_hash' has been added to allow the use of named references.
#### Removed
- Support has been removed for: RedHat 4, CentOS 4, OracleLinux 4, Scientific 4, SLES 10 SP4, Windows Server 2003, Windows Server 2003 R2 and Windows 8.
#### Fixed
- The 'ruby_spec.rb' test file has been altered s that it properly checks results.
- Example syntax in 'file_line.rb' has been fixed.
## Supported Release 4.21.0
### Summary
This is a small feature release that includes a revamped, albeit backwards-compatible file_line type.
#### Added
- `replace_all_matches_not_matching_line` parameter in file_line
- additional tests and documentation for file_line
#### Removed
- duplicate spec test for absolute_path
#### Fixed
- Unixpath type to allow "/" as valid path
- file_line behavior that caused infinite appending of `line` to a file ([MODULES-5651](https://tickets.puppet.com/browse/MODULES-5651))
## Supported Release 4.20.0
### Summary
This release adds new functions and updated README translations.
#### Added
- `to_json`, `to_json_pretty`, and `to_yaml` functions
- new Japanese README translations
#### Fixed
- compatibility issue with older versions of Puppet and the `pw_hash` function ([MODULES-5546](https://tickets.puppet.com/browse/MODULES-5546))
#### Removed
- support for EOL platform Debian 6 (Squeeze)
## Supported Release 4.19.0
### Summary
This release adds new functions and better documentation/fixes for existing functions with a noteworthy fix for file_line.
#### Added
- Add validate_domain_name function
- Add the round function
- Add type for MAC address
- Add support for sensitive data type to pw_hash ([MODULES-4908](https://tickets.puppet.com/browse/MODULES-4908))
- Add new function, fact() (FACT-932)
#### Fixed
- Fixes for the file_line provider ([MODULES-5003](https://tickets.puppet.com/browse/MODULES-5003))
- Add documentation for email functions ([MODULES-5382](https://tickets.puppet.com/browse/MODULES-5382))
- unique function is deprecated for puppet version > 5. (FM-6239)
- Fix headers in CHANGELOG.md so that headers render correctly
- ensure_packages, converge ensure values 'present' and 'installed'
#### Changed
- Removes listed support for EOL Ubuntu versions
## Supported Release 4.18.0
### Summary
Small release that reverts the Puppet version requirement lower bound to again include Puppet 2.7+ and bumps the upper bound to now include Puppet 5.
#### Fixed
- Reverts lower bound of Puppet requirement to 2.7.20
## Supported Release 4.17.1
### Summary
Small release to address a bug (PUP-7650). Also pushes the Puppet version compatibility to 4.7.0.
#### Bugfixes
- (MODULES-5095) Workaround for PUP-7650
- (FM-6197) Formatting fixes for file_line resource
## Supported Release 4.17.0
### Summary
This release adds support for internationalization. It also contains Japanese translations for the README, summary and description of the metadata.json and major cleanups in the README. Additional folders have been introduced called locales and readmes where translation files can be found. A number of features and bug fixes are also included in this release. It also adds a new function `glob()` for expanding file lists. Also works around an issue that appeared in puppet 4.6.0 involving types being declared multiple times.
#### Features
- Addition of POT file / folder structure for i18n.
- Addition of Internationalized READMEs.
- `glob()` function
### Fixed
- Occasional duplicate type definitions when using `defined_with_params()`
- `file_line` encoding issue on ruby 1.8 (unsupported)
- Huge readme refresh
## Supported Release 4.16.0
### Summary
This release sees a massive update to all unit tests to test UTF8 characters. There are also multiple cleanups in preparation for internationalization. Alongside this, improvements to ipv6 support, a new length function compatible with Puppet 4, and an update to path types. Also contains multiple bug fixes around functionality and tests.
#### Features
- Addition of coverage in all unit tests for functions, data and resource types for UTF8 for i18n.
- All strings within the readme and functions that are split over two lines have been combined in preparation for i18n parser/decorator.
- Improvement on the ipv6 support for type - Improves regex to catch some valid (but lesser known) ipv6 strings, mostly those which are a mix of ipv6 strings and embedded ipv6 numbers.
- Adds a new parameter `encoding` to allow non UTF-8 files to specify a file encoding. This prevents receiving the error message "invalid byte sequence in UTF-8" when special characters that are not UTF-8 encoded appear in the input stream, such as the copyright symbol.
- Addition of the new length function. Returns the length of a given string, array or hash. To eventually replace the deprecated size() function as can handle the new type functionality introduced in Puppet 4.
- Permit double slash in absolute/Unix path types.
#### Bugfixes
- Fix unsupported data type error with rspec-puppet server.
- Now allows test module metadata.json to be read by Puppet.
- Fix acceptance test failure "Hiera is not a class".
- Removal of unsupported platforms and future parser setting in acceptance tests.
- Regex for tuple checking has been loosened.
- Ensure_packages function - Now only tries to apply the resource if not defined.
- (MODULES-4528) Use versioncmp to check Puppet version for 4.10.x compat.
- Adds comments to warn for UTF8 incompatibility of the functions that may not be compatible with UTF8 with Ruby < 2.4.0.
## Supported Release 4.15.0
### Summary
This release introduces multiple new functions, a new fact and the addition of Ubuntu Xenial support. Also includes a bugfix and documentation update.
#### Features
- Addition of puppet_server fact to return agents server.
- Addition of a pry function.
- Addition of tests for ensure_resources.
- Addition of FQDN UUID generation function.
- Addition of Ubuntu Xenial to OS Support.
#### Bugfixes
- Ensure_packages now works with Ruby < 2.0.
- Updated the documentation of str2bool function.
## Supported Release 4.14.0
### Summary
Adds several new features and updates, especially around refining the deprecation and validate_legacy functions. Also includes a Gemfile update around an issue with parallel_tests dependancy for different versions of Ruby.
#### Features
- Deprecation function now uses puppet stacktrace if available.
- join_key_to_values function now handles array values. If values are arrays, multiple keys are added for each element.
- Updated Gemfile to deal with parallel_tests Ruby dependancy (MODULES-3983).
- Updated/Fixed ipv4 regex validator (MODULES-3980).
- Deprecation clarification added to README.
#### Bugfixes
- README typo fixes.
- Use .dup to duplicate classes for modification (MODULES-3829).
- Fixes spec failures that were caused by a change in the tested error message in validate_legacy_spec.
- Broken link to validate_legacy docs fixed.
- Updates deprecation tests to include future parser.
## Supported Release 4.13.1
### Summary
This bugfix release addresses the `undefined method 'optional_repeated_param'` error messages seen by users of puppet 3.7.
It also improves the user experience around function deprecations by emitting one warning per function(-name) instead of only one deprecation overall. This allows users to identify all deprecated functions used in one agent run, with less back-and-forth.
#### Bugfixes
* Emit deprecations warnings for each function, instead of once per process. (MODULES-3961)
* Use a universally available API for the v4 deprecation stubs of `is_*` and `validate_*`. (MODULES-3962)
* Make `getvar()` compatible to ruby 1.8.7. (MODULES-3969)
* Add v4 deprecation stubs for the `is_` counterparts of the deprecated functions to emit the deprecations warnings in all cases.
## Supported Release 4.13.0
### Summary
This version of stdlib deprecates a whole host of functions, and provides stepping stones to move to Puppet 4 type validations. Be sure to check out the new `deprecation()` and `validate_legacy()` functions to migrate off the deprecated v3-style data validations.
Many thanks to all community contributors: bob, Dmitry Ilyin, Dominic Cleal, Joris, Joseph Yaworski, Loic Antoine-Gombeaud, Maksym Melnychok, Michiel Brandenburg, Nate Potter, Romain Tartière, Stephen Benjamin, and Steve Moore, as well as anyone contributing in the code review process and by submitting issues.
Special thanks to [Voxpupuli's](https://voxpupuli.org/) Igor Galić for donating the puppet-tea types to kickstart this part of stdlib.
#### Deprecations
* `validate_absolute_path`, `validate_array`, `validate_bool`, `validate_hash`, `validate_integer`, `validate_ip_address`, `validate_ipv4_address`, `validate_ipv6_address`, `validate_numeric`, `validate_re`, `validate_slength`, `validate_string`, and their `is_` counter parts are now deprecated on Puppet 4. See the `validate_legacy()` description in the README for help on migrating away from those functions.
* The `dig` function is provided by core puppet since 4.5.0 with slightly different calling convention. The stdlib version can still be accessed as `dig44` for now.
#### Features
* Add Puppet 4 data types for Unix, and Windows paths, and URLs.
* Add `deprecation` function to warn users of functionality that will be removed soon.
* Add `validate_legacy` function to help with migrating to Puppet 4 data types.
* Add `any2bool` function, a combination of of `string2bool` and `num2bool`.
* Add `delete_regex` function to delete array elements matching a regular expression.
* Add `puppet_environmentpath` fact to expose the `environmentpath` setting.
* Add `regexpescape` function to safely insert arbitrary strings into regular expressions.
* Add `shell_escape`, `shell_join`, and `shell_split` functions for safer working with shell scripts..
* The `delete` function now also accepts regular expressions as search term.
* The `loadyaml` function now accepts a default value, which is returned when there is an error loading the file.
#### Bugfixes
* Fix `file_line.match_for_absence` implementation and description to actually work. (MODULES-3590)
* Fix `getparam` so that it can now also return `false`. (MODULES-3933)
* Fix the fixture setup for testing and adjust `load_module_metadata` and `loadjson` tests.
* Fix `defined_with_params` to handle `undef` correctly on all puppet versions. (PUP-6422, MODULES-3543)
* Fix `file_line.path` validation to use puppet's built in `absolute_path?` matcher.
#### Minor Improvements
* README changes: improved descriptions of `deep_merge`, `delete`, `ensure_packages`, `file_line.after`, `range`, and `validate_numeric`.
* The `getvar` function now returns nil in all situations where the variable is not found.
* Update the `dig44` function with better `undef`, `nil`, and `false` handling.
* Better wording on `str2bool` argument validation error message.
### Known issues
* The `validate_legacy` function relies on internal APIs from Puppet 4.4.0 (PE 2016.1) onwards, and doesn't work on earlier versions.
* Puppet 4.5.0 (PE 2016.2) has a number of improvements around data types - especially error handling - that make working with them much nicer.
## Supported Release 4.12.0
### Summary
This release provides several new functions, bugfixes, modulesync changes, and some documentation updates.
#### Features
- Adds `clamp`. This function keeps values within a specified range.
- Adds `validate_x509_rsa_key_pair`. This function validates an x509 RSA certificate and key pair.
- Adds `dig`. This function performs a deep lookup in nested hashes or arrays.
- Extends the `base64` support to fit `rfc2045` and `rfc4648`.
- Adds `is_ipv6_address` and `is_ipv4_address`. These functions validate the specified ipv4 or ipv6 addresses.
- Adds `enclose_ipv6`. This function encloses IPv6 addresses in square brackets.
- Adds `ensure_resources`. This function takes a list of resources and creates them if they do not exist.
- Extends `suffix` to support applying a suffix to keys in a hash.
- Apply modulesync changes.
- Add validate_email_address function.
#### Bugfixes
- Fixes `fqdn_rand_string` tests, since Puppet 4.4.0 and later have a higher `fqdn_rand` ceiling.
- (MODULES-3152) Adds a check to `package_provider` to prevent failures if Gem is not installed.
- Fixes to README.md.
- Fixes catch StandardError rather than the gratuitous Exception
- Fixes file_line attribute validation.
- Fixes concat with Hash arguments.
## Supported Release 4.11.0
### Summary
Provides a validate_absolute_paths and Debian 8 support. There is a fix to the is_package_provider fact and a test improvement.
#### Features
- Adds new parser called is_absolute_path
- Supports Debian 8
#### Bugfixes
- Allow package_provider fact to resolve on PE 3.x
#### Improvements
- ensures that the test passes independently of changes to rubygems for ensure_resource
## 2015-12-15 - Supported Release 4.10.0
### Summary
Includes the addition of several new functions and considerable improvements to the existing functions, tests and documentation. Includes some bug fixes which includes compatibility, test and fact issues.
#### Features
- Adds service_provider fact
- Adds is_a() function
- Adds package_provider fact
- Adds validate_ip_address function
- Adds seeded_rand function
#### Bugfixes
- Fix backwards compatibility from an improvement to the parseyaml function
- Renaming of load_module_metadata test to include \_spec.rb
- Fix root_home fact on AIX 5.x, now '-c' rather than '-C'
- Fixed Gemfile to work with ruby 1.8.7
#### Improvements
- (MODULES-2462) Improvement of parseyaml function
- Improvement of str2bool function
- Improvement to readme
- Improvement of intersection function
- Improvement of validate_re function
- Improved speed on Facter resolution of service_provider
- empty function now handles numeric values
- Package_provider now prevents deprecation warning about the allow_virtual parameter
- load_module_metadata now succeeds on empty file
- Check added to ensure puppetversion value is not nil
- Improvement to bool2str to return a string of choice using boolean
- Improvement to naming convention in validate_ipv4_address function
## Supported Release 4.9.1
### Summary
Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
## 2015-09-08 - Supported Release 4.9.0
### Summary
This release adds new features including the new functions dos2unix, unix2dos, try_get_value, convert_base as well as other features and improvements.
#### Features
- (MODULES-2370) allow `match` parameter to influence `ensure => absent` behavior
- (MODULES-2410) Add new functions dos2unix and unix2dos
- (MODULE-2456) Modify union to accept more than two arrays
- Adds a convert_base function, which can convert numbers between bases
- Add a new function "try_get_value"
#### Bugfixes
- n/a
#### Improvements
- (MODULES-2478) Support root_home fact on AIX through "lsuser" command
- Acceptance test improvements
- Unit test improvements
- Readme improvements
## 2015-08-10 - Supported Release 4.8.0
### Summary
This release adds a function for reading metadata.json from any module, and expands file\_line's abilities.
#### Features
- New parameter `replace` on `file_line`
- New function `load_module_metadata()` to load metadata.json and return the content as a hash.
- Added hash support to `size()`
#### Bugfixes
- Fix various docs typos
- Fix `file_line` resource on puppet < 3.3
## 2015-06-22 - Supported Release 4.7.0
### Summary
Adds Solaris 12 support along with improved Puppet 4 support. There are significant test improvements, and some minor fixes.
#### Features
- Add support for Solaris 12
#### Bugfixes
- Fix for AIO Puppet 4
- Fix time for ruby 1.8.7
- Specify rspec-puppet version
- range() fix for typeerror and missing functionality
- Fix pw_hash() on JRuby < 1.7.17
- fqdn_rand_string: fix argument error message
- catch and rescue from looking up non-existent facts
- Use puppet_install_helper, for Puppet 4
#### Improvements
- Enforce support for Puppet 4 testing
- fqdn_rotate/fqdn_rand_string acceptance tests and implementation
- Simplify mac address regex
- validate_integer, validate_numeric: explicitely reject hashes in arrays
- Readme edits
- Remove all the pops stuff for rspec-puppet
- Sync via modulesync
- Add validate_slength optional 3rd arg
- Move tests directory to examples directory
## 2015-04-14 - Supported Release 4.6.0
### Summary
Adds functions and function argument abilities, and improves compatibility with the new puppet parser
#### Features
- MODULES-444: `concat()` can now take more than two arrays
- `basename()` added to have Ruby File.basename functionality
- `delete()` can now take an array of items to remove
- `prefix()` can now take a hash
- `upcase()` can now take a hash or array of upcaseable things
- `validate_absolute_path()` can now take an array
- `validate_cmd()` can now use % in the command to embed the validation file argument in the string
- MODULES-1473: deprecate `type()` function in favor of `type3x()`
- MODULES-1473: Add `type_of()` to give better type information on future parser
- Deprecate `private()` for `assert_private()` due to future parser
- Adds `ceiling()` to take the ceiling of a number
- Adds `fqdn_rand_string()` to generate random string based on fqdn
- Adds `pw_hash()` to generate password hashes
- Adds `validate_integer()`
- Adds `validate_numeric()` (like `validate_integer()` but also accepts floats)
#### Bugfixes
- Fix seeding of `fqdn_rotate()`
- `ensure_resource()` is more verbose on debug mode
- Stricter argument checking for `dirname()`
- Fix `is_domain_name()` to better match RFC
- Fix `uriescape()` when called with array
- Fix `file_line` resource when using the `after` attribute with `match`
## 2015-01-14 - Supported Release 4.5.1
### Summary
This release changes the temporary facter_dot_d cache locations outside of the /tmp directory due to a possible security vunerability. CVE-2015-1029
#### Bugfixes
- Facter_dot_d cache will now be stored in puppet libdir instead of tmp
## 2014-12-15 - Supported Release 4.5.0
### Summary
This release improves functionality of the member function and adds improved future parser support.
#### Features
- MODULES-1329: Update member() to allow the variable to be an array.
- Sync .travis.yml, Gemfile, Rakefile, and CONTRIBUTING.md via modulesync
#### Bugfixes
- Fix range() to work with numeric ranges with the future parser
- Accurately express SLES support in metadata.json (was missing 10SP4 and 12)
- Don't require `line` to match the `match` parameter
## 2014-11-10 - Supported Release 4.4.0
### Summary
This release has an overhauled readme, new private manifest function, and fixes many future parser bugs.
#### Features
- All new shiny README
- New `private()` function for making private manifests (yay!)
#### Bugfixes
- Code reuse in `bool2num()` and `zip()`
- Fix many functions to handle `generate()` no longer returning a string on new puppets
- `concat()` no longer modifies the first argument (whoops)
- strict variable support for `getvar()`, `member()`, `values_at`, and `has_interface_with()`
- `to_bytes()` handles PB and EB now
- Fix `tempfile` ruby requirement for `validate_augeas()` and `validate_cmd()`
- Fix `validate_cmd()` for windows
- Correct `validate_string()` docs to reflect non-handling of `undef`
- Fix `file_line` matching on older rubies
## 2014-07-15 - Supported Release 4.3.2
### Summary
This release merely updates metadata.json so the module can be uninstalled and
upgraded via the puppet module command.
## 2014-07-14 - Supported Release 4.3.1
### Summary
This supported release updates the metadata.json to work around upgrade behavior of the PMT.
#### Bugfixes
- Synchronize metadata.json with PMT-generated metadata to pass checksums
## 2014-06-27 - Supported Release 4.3.0
### Summary
This release is the first supported release of the stdlib 4 series. It remains
backwards-compatible with the stdlib 3 series. It adds two new functions, one bugfix, and many testing updates.
#### Features
- New `bool2str()` function
- New `camelcase()` function
#### Bugfixes
- Fix `has_interface_with()` when interfaces fact is nil
## 2014-06-04 - Release 4.2.2
### Summary
This release adds PE3.3 support in the metadata and fixes a few tests.
## 2014-05-08 - Release - 4.2.1
### Summary
This release moves a stray symlink that can cause problems.
## 2014-05-08 - Release - 4.2.0
### Summary
This release adds many new functions and fixes, and continues to be backwards compatible with stdlib 3.x
#### Features
- New `base64()` function
- New `deep_merge()` function
- New `delete_undef_values()` function
- New `delete_values()` function
- New `difference()` function
- New `intersection()` function
- New `is_bool()` function
- New `pick_default()` function
- New `union()` function
- New `validate_ipv4_address` function
- New `validate_ipv6_address` function
- Update `ensure_packages()` to take an option hash as a second parameter.
- Update `range()` to take an optional third argument for range step
- Update `validate_slength()` to take an optional third argument for minimum length
- Update `file_line` resource to take `after` and `multiple` attributes
#### Bugfixes
- Correct `is_string`, `is_domain_name`, `is_array`, `is_float`, and `is_function_available` for parsing odd types such as bools and hashes.
- Allow facts.d facts to contain `=` in the value
- Fix `root_home` fact on darwin systems
- Fix `concat()` to work with a second non-array argument
- Fix `floor()` to work with integer strings
- Fix `is_integer()` to return true if passed integer strings
- Fix `is_numeric()` to return true if passed integer strings
- Fix `merge()` to work with empty strings
- Fix `pick()` to raise the correct error type
- Fix `uriescape()` to use the default URI.escape list
- Add/update unit & acceptance tests.
## 2014-03-04 - Supported Release - 3.2.1
### Summary
This is a supported release
#### Bugfixes
- Fixed `is_integer`/`is_float`/`is_numeric` for checking the value of arithmatic expressions.
#### Known bugs
* No known bugs
---
##### 2013-05-06 - Jeff McCune <jeff@puppetlabs.com> - 4.1.0
* (#20582) Restore facter\_dot\_d to stdlib for PE users (3b887c8)
* (maint) Update Gemfile with GEM\_FACTER\_VERSION (f44d535)
##### 2013-05-06 - Alex Cline <acline@us.ibm.com> - 4.1.0
* Terser method of string to array conversion courtesy of ethooz. (d38bce0)
##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
* Refactor ensure\_resource expectations (b33cc24)
##### 2013-05-06 - Alex Cline <acline@us.ibm.com> 4.1.0
* Changed str-to-array conversion and removed abbreviation. (de253db)
##### 2013-05-03 - Alex Cline <acline@us.ibm.com> 4.1.0
* (#20548) Allow an array of resource titles to be passed into the ensure\_resource function (e08734a)
##### 2013-05-02 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.1.0
* Add a dirname function (2ba9e47)
##### 2013-04-29 - Mark Smith-Guerrero <msmithgu@gmail.com> - 4.1.0
* (maint) Fix a small typo in hash() description (928036a)
##### 2013-04-12 - Jeff McCune <jeff@puppetlabs.com> - 4.0.2
* Update user information in gemspec to make the intent of the Gem clear.
##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.1
* Fix README function documentation (ab3e30c)
##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* stdlib 4.0 drops support with Puppet 2.7
* stdlib 4.0 preserves support with Puppet 3
##### 2013-04-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* Add ability to use puppet from git via bundler (9c5805f)
##### 2013-04-10 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* (maint) Make stdlib usable as a Ruby GEM (e81a45e)
##### 2013-04-10 - Erik Dalén <dalen@spotify.com> - 4.0.0
* Add a count function (f28550e)
##### 2013-03-31 - Amos Shapira <ashapira@atlassian.com> - 4.0.0
* (#19998) Implement any2array (7a2fb80)
##### 2013-03-29 - Steve Huff <shuff@vecna.org> - 4.0.0
* (19864) num2bool match fix (8d217f0)
##### 2013-03-20 - Erik Dalén <dalen@spotify.com> - 4.0.0
* Allow comparisons of Numeric and number as String (ff5dd5d)
##### 2013-03-26 - Richard Soderberg <rsoderberg@mozilla.com> - 4.0.0
* add suffix function to accompany the prefix function (88a93ac)
##### 2013-03-19 - Kristof Willaert <kristof.willaert@gmail.com> - 4.0.0
* Add floor function implementation and unit tests (0527341)
##### 2012-04-03 - Eric Shamow <eric@puppetlabs.com> - 4.0.0
* (#13610) Add is\_function\_available to stdlib (961dcab)
##### 2012-12-17 - Justin Lambert <jlambert@eml.cc> - 4.0.0
* str2bool should return a boolean if called with a boolean (5d5a4d4)
##### 2012-10-23 - Uwe Stuehler <ustuehler@team.mobile.de> - 4.0.0
* Fix number of arguments check in flatten() (e80207b)
##### 2013-03-11 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* Add contributing document (96e19d0)
##### 2013-03-04 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
* Add missing documentation for validate\_augeas and validate\_cmd to README.markdown (a1510a1)
##### 2013-02-14 - Joshua Hoblitt <jhoblitt@cpan.org> - 4.0.0
* (#19272) Add has\_element() function (95cf3fe)
##### 2013-02-07 - Raphaël Pinson <raphael.pinson@camptocamp.com> - 4.0.0
* validate\_cmd(): Use Puppet::Util::Execution.execute when available (69248df)
##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
* Add validate\_augeas function (3a97c23)
##### 2012-12-06 - Raphaël Pinson <raphink@gmail.com> - 4.0.0
* Add validate\_cmd function (6902cc5)
##### 2013-01-14 - David Schmitt <david@dasz.at> - 4.0.0
* Add geppetto project definition (b3fc0a3)
##### 2013-01-02 - Jaka Hudoklin <jakahudoklin@gmail.com> - 4.0.0
* Add getparam function to get defined resource parameters (20e0e07)
##### 2013-01-05 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* (maint) Add Travis CI Support (d082046)
##### 2012-12-04 - Jeff McCune <jeff@puppetlabs.com> - 4.0.0
* Clarify that stdlib 3 supports Puppet 3 (3a6085f)
##### 2012-11-30 - Erik Dalén <dalen@spotify.com> - 4.0.0
* maint: style guideline fixes (7742e5f)
##### 2012-11-09 - James Fryman <james@frymanet.com> - 4.0.0
* puppet-lint cleanup (88acc52)
##### 2012-11-06 - Joe Julian <me@joejulian.name> - 4.0.0
* Add function, uriescape, to URI.escape strings. Redmine #17459 (fd52b8d)
##### 2012-09-18 - Chad Metcalf <chad@wibidata.com> - 3.2.0
* Add an ensure\_packages function. (8a8c09e)
##### 2012-11-23 - Erik Dalén <dalen@spotify.com> - 3.2.0
* (#17797) min() and max() functions (9954133)
##### 2012-05-23 - Peter Meier <peter.meier@immerda.ch> - 3.2.0
* (#14670) autorequire a file\_line resource's path (dfcee63)
##### 2012-11-19 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
* Add join\_keys\_to\_values function (ee0f2b3)
##### 2012-11-17 - Joshua Harlan Lifton <lifton@puppetlabs.com> - 3.2.0
* Extend delete function for strings and hashes (7322e4d)
##### 2012-08-03 - Gary Larizza <gary@puppetlabs.com> - 3.2.0
* Add the pick() function (ba6dd13)
##### 2012-03-20 - Wil Cooley <wcooley@pdx.edu> - 3.2.0
* (#13974) Add predicate functions for interface facts (f819417)
##### 2012-11-06 - Joe Julian <me@joejulian.name> - 3.2.0
* Add function, uriescape, to URI.escape strings. Redmine #17459 (70f4a0e)
##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 3.1.1
* (maint) Fix spec failures resulting from Facter API changes (97f836f)
##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 3.1.0
* Add PE facts to stdlib (cdf3b05)
##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.1
* Fix accidental removal of facts\_dot\_d.rb in 3.0.0 release
##### 2012-08-16 - Jeff McCune <jeff@puppetlabs.com> - 3.0.0
* stdlib 3.0 drops support with Puppet 2.6
* stdlib 3.0 preserves support with Puppet 2.7
##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 3.0.0
* Add function ensure\_resource and defined\_with\_params (ba789de)
##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 3.0.0
* (#2157) Remove facter\_dot\_d for compatibility with external facts (f92574f)
##### 2012-04-10 - Chris Price <chris@puppetlabs.com> - 3.0.0
* (#13693) moving logic from local spec\_helper to puppetlabs\_spec\_helper (85f96df)
##### 2012-10-25 - Jeff McCune <jeff@puppetlabs.com> - 2.5.1
* (maint) Fix spec failures resulting from Facter API changes (97f836f)
##### 2012-10-23 - Matthaus Owens <matthaus@puppetlabs.com> - 2.5.0
* Add PE facts to stdlib (cdf3b05)
##### 2012-08-15 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Explicitly load functions used by ensure\_resource (9fc3063)
##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Add better docs about duplicate resource failures (97d327a)
##### 2012-08-13 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Handle undef for parameter argument (4f8b133)
##### 2012-08-07 - Dan Bode <dan@puppetlabs.com> - 2.5.0
* Add function ensure\_resource and defined\_with\_params (a0cb8cd)
##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
* Disable tests that fail on 2.6.x due to #15912 (c81496e)
##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
* (Maint) Fix mis-use of rvalue functions as statements (4492913)
##### 2012-08-20 - Jeff McCune <jeff@puppetlabs.com> - 2.5.0
* Add .rspec file to repo root (88789e8)
##### 2012-06-07 - Chris Price <chris@puppetlabs.com> - 2.4.0
* Add support for a 'match' parameter to file\_line (a06c0d8)
##### 2012-08-07 - Erik Dalén <dalen@spotify.com> - 2.4.0
* (#15872) Add to\_bytes function (247b69c)
##### 2012-07-19 - Jeff McCune <jeff@puppetlabs.com> - 2.4.0
* (Maint) use PuppetlabsSpec::PuppetInternals.scope (main) (deafe88)
##### 2012-07-10 - Hailee Kenney <hailee@puppetlabs.com> - 2.4.0
* (#2157) Make facts\_dot\_d compatible with external facts (5fb0ddc)
##### 2012-03-16 - Steve Traylen <steve.traylen@cern.ch> - 2.4.0
* (#13205) Rotate array/string randomley based on fqdn, fqdn\_rotate() (fef247b)
##### 2012-05-22 - Peter Meier <peter.meier@immerda.ch> - 2.3.3
* fix regression in #11017 properly (f0a62c7)
##### 2012-05-10 - Jeff McCune <jeff@puppetlabs.com> - 2.3.3
* Fix spec tests using the new spec\_helper (7d34333)
##### 2012-05-10 - Puppet Labs <support@puppetlabs.com> - 2.3.2
* Make file\_line default to ensure => present (1373e70)
* Memoize file\_line spec instance variables (20aacc5)
* Fix spec tests using the new spec\_helper (1ebfa5d)
* (#13595) initialize\_everything\_for\_tests couples modules Puppet ver (3222f35)
* (#13439) Fix MRI 1.9 issue with spec\_helper (15c5fd1)
* (#13439) Fix test failures with Puppet 2.6.x (665610b)
* (#13439) refactor spec helper for compatibility with both puppet 2.7 and server (82194ca)
* (#13494) Specify the behavior of zero padded strings (61891bb)
##### 2012-03-29 Puppet Labs <support@puppetlabs.com> - 2.1.3
* (#11607) Add Rakefile to enable spec testing
* (#12377) Avoid infinite loop when retrying require json
##### 2012-03-13 Puppet Labs <support@puppetlabs.com> - 2.3.1
* (#13091) Fix LoadError bug with puppet apply and puppet\_vardir fact
##### 2012-03-12 Puppet Labs <support@puppetlabs.com> - 2.3.0
* Add a large number of new Puppet functions
* Backwards compatibility preserved with 2.2.x
##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.2.1
* Documentation only release for the Forge
##### 2011-12-30 Puppet Labs <support@puppetlabs.com> - 2.1.2
* Documentation only release for PE 2.0.x
##### 2011-11-08 Puppet Labs <support@puppetlabs.com> - 2.2.0
* #10285 - Refactor json to use pson instead.
* Maint - Add watchr autotest script
* Maint - Make rspec tests work with Puppet 2.6.4
* #9859 - Add root\_home fact and tests
##### 2011-08-18 Puppet Labs <support@puppetlabs.com> - 2.1.1
* Change facts.d paths to match Facter 2.0 paths.
* /etc/facter/facts.d
* /etc/puppetlabs/facter/facts.d
##### 2011-08-17 Puppet Labs <support@puppetlabs.com> - 2.1.0
* Add R.I. Pienaar's facts.d custom facter fact
* facts defined in /etc/facts.d and /etc/puppetlabs/facts.d are
automatically loaded now.
##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 2.0.0
* Rename whole\_line to file\_line
* This is an API change and as such motivating a 2.0.0 release according to semver.org.
##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.1.0
* Rename append\_line to whole\_line
* This is an API change and as such motivating a 1.1.0 release.
##### 2011-08-04 Puppet Labs <support@puppetlabs.com> - 1.0.0
* Initial stable release
* Add validate\_array and validate\_string functions
* Make merge() function work with Ruby 1.8.5
* Add hash merging function
* Add has\_key function
* Add loadyaml() function
* Add append\_line native
##### 2011-06-21 Jeff McCune <jeff@puppetlabs.com> - 0.1.7
* Add validate\_hash() and getvar() functions
##### 2011-06-15 Jeff McCune <jeff@puppetlabs.com> - 0.1.6
* Add anchor resource type to provide containment for composite classes
##### 2011-06-03 Jeff McCune <jeff@puppetlabs.com> - 0.1.5
* Add validate\_bool() function to stdlib
##### 0.1.4 2011-05-26 Jeff McCune <jeff@puppetlabs.com>
* Move most stages after main
##### 0.1.3 2011-05-25 Jeff McCune <jeff@puppetlabs.com>
* Add validate\_re() function
##### 0.1.2 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
* Update to add annotated tag
##### 0.1.1 2011-05-24 Jeff McCune <jeff@puppetlabs.com>
* Add stdlib::stages class with a standard set of stages
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.
stdlib puppet module
Copyright (C) 2011-2016 Puppet Labs, Inc.
and some parts:
Copyright (C) 2011 Krzysztof Wilczynski
Puppet Labs can be contacted at: info@puppetlabs.com
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.
# stdlib
#### Table of Contents
1. [Overview](#overview)
1. [Module Description](#module-description)
1. [Setup](#setup)
1. [Usage](#usage)
1. [Reference](#reference)
1. [Data Types](#data-types)
1. [Facts](#facts)
1. [Limitations](#limitations)
1. [Development](#development)
1. [Contributors](#contributors)
## Overview
This module provides a standard library of resources for Puppet modules.
## Module Description
Puppet modules make heavy use of this standard library. The stdlib module adds the following resources to Puppet:
* Stages
* Facts
* Functions
* Defined types
* Data types
* Providers
> *Note:* As of version 3.7, Puppet Enterprise no longer includes the stdlib module. If you're running Puppet Enterprise, you should install the most recent release of stdlib for compatibility with Puppet modules.
## Setup
[Install](https://puppet.com/docs/puppet/latest/modules_installing.html) the stdlib module to add the functions, facts, and resources of this standard library to Puppet.
If you are authoring a module that depends on stdlib, be sure to [specify dependencies](https://puppet.com/docs/puppet/latest/modules_installing.html) in your metadata.json.
## Usage
Most of stdlib's features are automatically loaded by Puppet. To use standardized run stages in Puppet, declare this class in your manifest with `include stdlib`.
When declared, stdlib declares all other classes in the module. The only other class currently included in the module is `stdlib::stages`.
The `stdlib::stages` class declares various run stages for deploying infrastructure, language runtimes, and application layers. The high level stages are (in order):
* setup
* main
* runtime
* setup_infra
* deploy_infra
* setup_app
* deploy_app
* deploy
Sample usage:
```puppet
node default {
include stdlib
class { java: stage => 'runtime' }
}
```
## Reference
For information on the classes and types, see the [REFERENCE.md](https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/REFERENCE.md).
<a id="data-types"></a>
### Data types
#### `Stdlib::Absolutepath`
A strict absolute path type. Uses a variant of Unixpath and Windowspath types.
Acceptable input examples:
```shell
/var/log
```
```shell
/usr2/username/bin:/usr/local/bin:/usr/bin:.
```
```shell
C:\\WINDOWS\\System32
```
Unacceptable input example:
```shell
../relative_path
```
#### `Stdlib::Ensure::Service`
Matches acceptable ensure values for service resources.
Acceptable input examples:
```shell
stopped
running
```
Unacceptable input example:
```shell
true
false
```
#### `Stdlib::HTTPSUrl`
Matches HTTPS URLs. It is a case insensitive match.
Acceptable input example:
```shell
https://hello.com
HTTPS://HELLO.COM
```
Unacceptable input example:
```shell
httds://notquiteright.org`
```
#### `Stdlib::HTTPUrl`
Matches both HTTPS and HTTP URLs. It is a case insensitive match.
Acceptable input example:
```shell
https://hello.com
http://hello.com
HTTP://HELLO.COM
```
Unacceptable input example:
```shell
httds://notquiteright.org
```
#### `Stdlib::MAC`
Matches MAC addresses defined in [RFC5342](https://tools.ietf.org/html/rfc5342).
#### `Stdlib::Unixpath`
Matches absolute paths on Unix operating systems.
Acceptable input example:
```shell
/usr2/username/bin:/usr/local/bin:/usr/bin:
/var/tmp
```
Unacceptable input example:
```shell
C:/whatever
some/path
../some/other/path
```
#### `Stdlib::Filemode`
Matches octal file modes consisting of one to four numbers and symbolic file modes.
Acceptable input examples:
```shell
0644
```
```shell
1777
```
```shell
a=Xr,g=w
```
Unacceptable input examples:
```shell
x=r,a=wx
```
```shell
0999
```
#### `Stdlib::Windowspath`
Matches paths on Windows operating systems.
Acceptable input example:
```shell
C:\\WINDOWS\\System32
C:\\
\\\\host\\windows
```
Valid values: A windows filepath.
#### `Stdlib::Filesource`
Matches paths valid values for the source parameter of the Puppet file type.
Acceptable input example:
```shell
http://example.com
https://example.com
file:///hello/bla
```
Valid values: A filepath.
#### `Stdlib::Fqdn`
Matches paths on fully qualified domain name.
Acceptable input example:
```shell
localhost
example.com
www.example.com
```
Valid values: Domain name of a server.
#### `Stdlib::Host`
Matches a valid host which could be a valid ipv4, ipv6 or fqdn.
Acceptable input example:
```shell
localhost
www.example.com
192.0.2.1
```
Valid values: An IP address or domain name.
#### `Stdlib::Port`
Matches a valid TCP/UDP Port number.
Acceptable input examples:
```shell
80
443
65000
```
Valid values: An Integer.
#### `Stdlib::Port::Privileged`
Matches a valid TCP/UDP Privileged port i.e. < 1024.
Acceptable input examples:
```shell
80
443
1023
```
Valid values: A number less than 1024.
#### `Stdlib::Port::Unprivileged`
Matches a valid TCP/UDP Privileged port i.e. >= 1024.
Acceptable input examples:
```shell
1024
1337
65000
```
Valid values: A number more than or equal to 1024.
#### `Stdlib::Base32`
Matches paths a valid base32 string.
Acceptable input example:
```shell
ASDASDDASD3453453
asdasddasd3453453=
ASDASDDASD3453453==
```
Valid values: A base32 string.
#### `Stdlib::Base64`
Matches paths a valid base64 string.
Acceptable input example:
```shell
asdasdASDSADA342386832/746+=
asdasdASDSADA34238683274/6+
asdasdASDSADA3423868327/46+==
```
Valid values: A base64 string.
#### `Stdlib::Ipv4`
This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V4](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv4).
#### `Stdlib::Ipv6`
This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address::V6](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddressv6).
#### `Stdlib::Ip_address`
This type is no longer available. To make use of this functionality, use [Stdlib::IP::Address](https://github.com/puppetlabs/puppetlabs-stdlib#stdlibipaddress)
#### `Stdlib::IP::Address`
Matches any IP address, including both IPv4 and IPv6 addresses. It will match them either with or without an address prefix as used in CIDR format IPv4 addresses.
Examples:
```
'127.0.0.1' =~ Stdlib::IP::Address # true
'10.1.240.4/24' =~ Stdlib::IP::Address # true
'52.10.10.141' =~ Stdlib::IP::Address # true
'192.168.1' =~ Stdlib::IP::Address # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address # true
'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address # true
```
#### `Stdlib::IP::Address::V4`
Match any string consisting of an IPv4 address in the quad-dotted decimal format, with or without a CIDR prefix. It will not match any abbreviated form (for example, 192.168.1) because these are poorly documented and inconsistently supported.
Examples:
```
'127.0.0.1' =~ Stdlib::IP::Address::V4 # true
'10.1.240.4/24' =~ Stdlib::IP::Address::V4 # true
'192.168.1' =~ Stdlib::IP::Address::V4 # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V4 # false
'12AB::CD30:192.168.0.1' =~ Stdlib::IP::Address::V4 # false
```
Valid values: An IPv4 address.
#### `Stdlib::IP::Address::V6`
Match any string consistenting of an IPv6 address in any of the documented formats in RFC 2373, with or without an address prefix.
Examples:
```
'127.0.0.1' =~ Stdlib::IP::Address::V6 # false
'10.1.240.4/24' =~ Stdlib::IP::Address::V6 # false
'FEDC:BA98:7654:3210:FEDC:BA98:7654:3210' =~ Stdlib::IP::Address::V6 # true
'FF01:0:0:0:0:0:0:101' =~ Stdlib::IP::Address::V6 # true
'FF01::101' =~ Stdlib::IP::Address::V6 # true
```
Valid values: An IPv6 address.
#### `Stdlib::IP::Address::Nosubnet`
Match the same things as the `Stdlib::IP::Address` alias, except it will not match an address that includes an address prefix (for example, it will match '192.168.0.6' but not '192.168.0.6/24').
Valid values: An IP address with no subnet.
#### `Stdlib::IP::Address::V4::CIDR`
Match an IPv4 address in the CIDR format. It will only match if the address contains an address prefix (for example, it will match '192.168.0.6/24'
but not '192.168.0.6').
Valid values: An IPv4 address with a CIDR provided eg: '192.186.8.101/105'. This will match anything inclusive of '192.186.8.101' to '192.168.8.105'.
#### `Stdlib::IP::Address::V4::Nosubnet`
Match an IPv4 address only if the address does not contain an address prefix (for example, it will match '192.168.0.6' but not '192.168.0.6/24').
Valid values: An IPv4 address with no subnet.
#### `Stdlib::IP::Address::V6::Full`
Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt), with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
#### `Stdlib::IP::Address::V6::Alternate`
Match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will match addresses with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
#### `Stdlib::IP::Address::V6::Compressed`
Match an IPv6 address which may contain `::` used to compress zeros as documented in section 2.2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will match addresses with or without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
#### `Stdlib::IP::Address::V6::Nosubnet`
Alias to allow `Stdlib::IP::Address::V6::Nosubnet::Full`, `Stdlib::IP::Address::V6::Nosubnet::Alternate` and `Stdlib::IP::Address::V6::Nosubnet::Compressed`.
#### `Stdlib::IP::Address::V6::Nosubnet::Full`
Match an IPv6 address formatted in the "preferred form" as documented in section 2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will not match addresses with address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
#### `Stdlib::IP::Address::V6::Nosubnet::Alternate`
Match an IPv6 address formatted in the "alternative form" allowing for representing the last two 16-bit pieces of the address with a quad-dotted decimal, as documented in section 2.2.1 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will only match addresses without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
#### `Stdlib::IP::Address::V6::Nosubnet::Compressed`
Match an IPv6 address which may contain `::` used to compress zeros as documented in section 2.2.2 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt). It will only match addresses without an address prefix as documented in section 2.3 of [RFC 2373](https://www.ietf.org/rfc/rfc2373.txt).
#### `Stdlib::IP::Address::V6::CIDR`
Match an IPv6 address in the CIDR format. It will only match if the address contains an address prefix (for example, it will match 'FF01:0:0:0:0:0:0:101/32', 'FF01::101/60', '::/0',
but not 'FF01:0:0:0:0:0:0:101', 'FF01::101', '::').
#### `Stdlib::ObjectStore`
Matches cloud object store uris.
Acceptable input example:
```shell
s3://mybucket/path/to/file
gs://bucket/file
```
Valid values: cloud object store uris.
#### `Stdlib::ObjectStore::GSUri`
Matches Google Cloud object store uris.
Acceptable input example:
```shell
gs://bucket/file
gs://bucket/path/to/file
```
Valid values: Google Cloud object store uris.
#### `Stdlib::ObjectStore::S3Uri`
Matches Amazon Web Services S3 object store uris.
Acceptable input example:
```shell
s3://bucket/file
s3://bucket/path/to/file
```
Valid values: Amazon Web Services S3 object store uris.
#### `Stdlib::Syslogfacility`
An enum that defines all syslog facilities defined in [RFC5424](https://tools.ietf.org/html/rfc5424). This is based on work in the [voxpupuli/nrpe](https://github.com/voxpupuli/puppet-nrpe/commit/5700fd4f5bfc3e237195c8833039f9ed1045cd6b) module.
<a id="facts"></a>
### Facts
#### `package_provider`
Returns the default provider Puppet uses to manage packages on this system.
#### `is_pe`
Returns whether Puppet Enterprise is installed. Does not report anything on platforms newer than PE 3.x.
#### `pe_version`
Returns the version of Puppet Enterprise installed. Does not report anything on platforms newer than PE 3.x.
#### `pe_major_version`
Returns the major version Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.
#### `pe_minor_version`
Returns the minor version of Puppet Enterprise that is installed. Does not report anything on platforms newer than PE 3.x.
#### `pe_patch_version`
Returns the patch version of Puppet Enterprise that is installed.
#### `puppet_vardir`
Returns the value of the Puppet vardir setting for the node running Puppet or Puppet agent.
#### `puppet_environmentpath`
Returns the value of the Puppet environment path settings for the node running Puppet or Puppet agent.
#### `puppet_server`
Returns the Puppet agent's `server` value, which is the hostname of the Puppet server with which the agent should communicate.
#### `root_home`
Determines the root home directory.
Determines the root home directory, which depends on your operating system. Generally this is '/root'.
#### `service_provider`
Returns the default provider Puppet uses to manage services on this system
## Limitations
As of Puppet Enterprise 3.7, the stdlib module is no longer included in PE. PE users should install the most recent release of stdlib for compatibility with Puppet modules.
For an extensive list of supported operating systems, see [metadata.json](https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/metadata.json)
## Development
Puppet modules on the Puppet Forge are open projects, and community contributions are essential for keeping them great. We can’t access the huge number of platforms and myriad hardware, software, and deployment configurations that Puppet is intended to serve. We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. For more information, see our [module contribution guide](https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/CONTRIBUTING.md).
To report or research a bug with any part of this module, please go to [http://tickets.puppetlabs.com/browse/MODULES](http://tickets.puppetlabs.com/browse/MODULES).
## Contributors
The list of contributors can be found at: [https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors](https://github.com/puppetlabs/puppetlabs-stdlib/graphs/contributors).
Puppet Specific Facts
=====================
Facter is meant to stand alone and apart from Puppet. However, Facter often
runs inside Puppet and all custom facts included in the stdlib module will
almost always be evaluated in the context of Puppet and Facter working
together.
Still, we don't want to write custom facts that blow up in the users face if
Puppet is not loaded in memory. This is often the case if the user runs
`facter` without also supplying the `--puppet` flag.
Ah! But Jeff, the custom fact won't be in the `$LOAD_PATH` unless the user
supplies `--facter`! You might say...
Not (always) true I say! If the user happens to have a CWD of
`<modulepath>/stdlib/lib` then the facts will automatically be evaluated and
blow up.
In any event, it's pretty easy to write a fact that has no value if Puppet is
not loaded. Simply do it like this:
Facter.add(:node_vardir) do
setcode do
# This will be nil if Puppet is not available.
Facter::Util::PuppetSettings.with_puppet do
Puppet[:vardir]
end
end
end
The `Facter::Util::PuppetSettings.with_puppet` method accepts a block and
yields to it only if the Puppet library is loaded. If the Puppet library is
not loaded, then the method silently returns `nil` which Facter interprets as
an undefined fact value. The net effect is that the fact won't be set.
NOTE
====
This project's specs depend on puppet core, and thus they require the
`puppetlabs_spec_helper` project. For more information please see the README
in that project, which can be found here: [puppetlabs spec
helper](https://github.com/puppetlabs/puppetlabs_spec_helper)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment