diff --git a/.github/dependabot.template.yml b/.github/dependabot.template.yml
deleted file mode 100644
index 60014835..00000000
--- a/.github/dependabot.template.yml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-version: 2
-updates:
- - package-ecosystem: "bundler"
- directory: "/"
- schedule:
- interval: "daily"
- open-pull-requests-limit: 20
- vendor: true
- - package-ecosystem: "docker"
- directory: "/"
- schedule:
- interval: "daily"
- open-pull-requests-limit: 20
- - package-ecosystem: "github-actions"
- directory: "/"
- schedule:
- interval: "daily"
- open-pull-requests-limit: 20
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index 01d08545..00000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file was generated by the "Generate Dependabot Glob" action. Do not edit it directly.
-# Make changes to `.github/dependabot.template.yml` and a PR will be automatically created.
-version: 2
-updates:
- - package-ecosystem: bundler
- directory: /
- schedule:
- interval: daily
- open-pull-requests-limit: 20
- vendor: true
- - package-ecosystem: docker
- directory: /
- schedule:
- interval: daily
- open-pull-requests-limit: 20
- - package-ecosystem: github-actions
- directory: /
- schedule:
- interval: daily
- open-pull-requests-limit: 20
diff --git a/.github/workflows/add-dependabot-pr-to-project.yml b/.github/workflows/add-dependabot-pr-to-project.yml
deleted file mode 100644
index 235260e7..00000000
--- a/.github/workflows/add-dependabot-pr-to-project.yml
+++ /dev/null
@@ -1,22 +0,0 @@
----
-name: Assign Dependabot PR to Compute Foundation Project
-
-on:
- workflow_dispatch:
- pull_request:
- types: [opened, reopened, labeled]
-
-permissions:
- contents: read
- pull-requests: write
-
-jobs:
- add-to-project:
- name: Add to Compute Foundation Project Board
- runs-on: ubuntu-latest
- steps:
- - uses: actions/add-to-project@v1.0.2
- with:
- project-url: https://github.com/orgs/github/projects/5753/ # Compute Foundation Project Board
- github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
- labeled: dependencies,external-dependency
diff --git a/.github/workflows/generate-dependabot.yml b/.github/workflows/generate-dependabot.yml
deleted file mode 100644
index c623bc1d..00000000
--- a/.github/workflows/generate-dependabot.yml
+++ /dev/null
@@ -1,27 +0,0 @@
----
-name: Generate dependabot.yml
-
-on:
- push:
- repository_dispatch:
- workflow_dispatch:
-
-permissions:
- contents: write
- pull-requests: write
-
-jobs:
- generate:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
-
- - name: Generate dependabot.yml
- uses: Makeshift/generate-dependabot-glob-action@5cd45385ce6519f68d574aab9699832b3a5e5031 # v1.3.4
-
- - name: Create Pull Request
- uses: peter-evans/create-pull-request@6cd32fd93684475c31847837f87bb135d40a2b79 # v7.0.3
- with:
- title: '[Automated] Update dependabot.yml'
- body: |
- This PR was automatically generated by the generate-dependabot.yml workflow.
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index c54fbf97..d6b64a6c 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -1,10 +1,10 @@
name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
- puppet-4-10-10:
+ puppet-8-28-1:
env:
- PUPPET_VERSIONS: "4.10.10"
- PUPPET_VERSION: "4.10.10"
+ PUPPET_VERSIONS: "8.28.1"
+ PUPPET_VERSION: "8.28.1"
RUBOCOP_TEST: false
RSPEC_TEST: true
runs-on: ubuntu-latest
@@ -13,73 +13,10 @@ jobs:
strategy:
fail-fast: false
matrix:
- ruby-version: ["2.6"]
+ ruby-version: ["3.2.11"]
steps:
- name: Checkout code
- uses: actions/checkout@v4
- - name: Build container
- run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- - name: Tests
- run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
-
- puppet-5-5-22:
- env:
- PUPPET_VERSIONS: "5.5.22"
- PUPPET_VERSION: "5.5.22"
- RUBOCOP_TEST: false
- RSPEC_TEST: true
- runs-on: ubuntu-latest
- permissions:
- contents: read
- strategy:
- fail-fast: false
- matrix:
- ruby-version: ["2.6"]
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Build container
- run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- - name: Tests
- run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
-
- puppet-6-18-0:
- env:
- PUPPET_VERSIONS: "6.18.0"
- PUPPET_VERSION: "6.18.0"
- RUBOCOP_TEST: false
- RSPEC_TEST: true
- runs-on: ubuntu-latest
- permissions:
- contents: read
- strategy:
- fail-fast: false
- matrix:
- ruby-version: ["2.6"]
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
- - name: Build container
- run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- - name: Tests
- run: docker run -e PUPPET_VERSION -e PUPPET_VERSIONS -e RSPEC_TEST -e RUBOCOP_TEST -e ENFORCE_COVERAGE octocatalog-diff:ruby${{matrix.ruby-version}} /app/script/cibuild
-
- puppet-7-3-0:
- env:
- PUPPET_VERSIONS: "7.3.0"
- PUPPET_VERSION: "7.3.0"
- RUBOCOP_TEST: false
- RSPEC_TEST: true
- runs-on: ubuntu-latest
- permissions:
- contents: read
- strategy:
- fail-fast: false
- matrix:
- ruby-version: ["2.6"]
- steps:
- - name: Checkout code
- uses: actions/checkout@v4
+ uses: actions/checkout@v7
- name: Build container
run: docker build . --file Dockerfile --tag octocatalog-diff:ruby${{matrix.ruby-version}} --build-arg RUBY_VERSION=${{matrix.ruby-version}} --build-arg PUPPET_VERSION=${{env.PUPPET_VERSION}}
- name: Tests
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 2cb947a2..e90bf05f 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,11 +13,13 @@ jobs:
packages: write
contents: read
steps:
- - uses: actions/checkout@v4
+ - name: Checkout code
+ uses: actions/checkout@v7
- name: Set up Ruby
- uses: ruby/setup-ruby@a6b46b8a08edb18935835849f2a17072d5cc8c73 # v1.192.0
+ uses: ruby/setup-ruby@v1
with:
- ruby-version: '2.6'
+ ruby-version: '3.2.11'
+ bundler-cache: true
- run: bundle install
- name: Publish to GPR
@@ -36,7 +38,7 @@ jobs:
*.gem
fi
- name: Upload gem as action artifact
- uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874
+ uses: actions/upload-artifact@v7
if: ${{ always() }}
with:
path: ./*.gem
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 00000000..a2141502
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,121 @@
+stages:
+ - build
+ - publish
+
+default:
+ image: ruby:3.2.11
+
+variables:
+ FF_SCRIPT_SECTIONS: "true"
+
+build:gem:
+ stage: build
+ rules:
+ - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+ - if: '$CI_COMMIT_TAG'
+ before_script:
+ - export VERSION=$(cat .version | tr -d '[:space:]')
+ - echo "Building octocatalog-diff version ${VERSION}"
+ script:
+ - gem build *.gemspec
+ artifacts:
+ name: "octocatalog-diff-${CI_COMMIT_REF_SLUG}"
+ paths:
+ - "*.gem"
+ expire_in: 1 week
+
+publish:gem:stage:
+ stage: publish
+ rules:
+ # Matches formats like 2.3.1, 2.3.1-syseleven2.0
+ - if: '$CI_COMMIT_TAG =~ /^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$/'
+ dependencies:
+ - build:gem
+ before_script:
+ - export VERSION=$(cat .version | tr -d '[:space:]')
+ - |
+ if [ "${CI_COMMIT_TAG}" != "${VERSION}" ]; then
+ echo "ERROR: Git tag (${CI_COMMIT_TAG}) does not match .version file (${VERSION})!"
+ exit 1
+ fi
+ - |
+ mkdir -p $HOME/.gem
+ touch $HOME/.gem/credentials
+ chmod 0600 $HOME/.gem/credentials
+ printf -- "---\n:gemstash_stage: ${GEMSTASH_STAGE_API_KEY}\n" > $HOME/.gem/credentials
+ script:
+ - echo "Pushing gem ${VERSION} to Gemstash Stage server at ${GEMSTASH_STAGE_URL}..."
+ - |
+ #!/bin/bash
+ set -e
+
+ GEM_FILE=$(ls *.gem)
+ HOST="${GEMSTASH_STAGE_URL}/private"
+ KEY="gemstash_stage"
+
+ echo "Pushing ${GEM_FILE} to ${HOST}..."
+
+ set +e
+ OUTPUT=$(gem push --verbose --key "${KEY}" --host "${HOST}" "${GEM_FILE}" 2>&1)
+ STATUS=$?
+ set -e
+
+ echo "$OUTPUT"
+
+ if [ $STATUS -ne 0 ]; then
+ if echo "$OUTPUT" | grep -q "500 Internal Server Error"; then
+ echo "NOTICE: Gemstash returned 500 - version likely already exists. Skipping push..."
+ exit 0
+ else
+ echo "ERROR: gem push failed unexpectedly."
+ exit 1
+ fi
+ fi
+
+ echo "Push successful."
+
+publish:gem:prod:
+ stage: publish
+ rules:
+ - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH'
+ # when: manual
+ dependencies:
+ - build:gem
+ before_script:
+ - |
+ export VERSION=$(cat .version | tr -d '[:space:]')
+ mkdir -p $HOME/.gem
+ touch $HOME/.gem/credentials
+ chmod 0600 $HOME/.gem/credentials
+ printf -- "---\n:gemstash_prod: ${GEMSTASH_PROD_API_KEY}\n" > $HOME/.gem/credentials
+ script:
+ - echo "Pushing gem ${VERSION} to Gemstash Prod server at ${GEMSTASH_PROD_URL}..."
+ - |
+ #!/bin/bash
+ set -e
+
+ GEM_FILE=$(ls *.gem)
+ HOST="${GEMSTASH_PROD_URL}/private"
+ KEY="gemstash_prod"
+
+ echo "Pushing ${GEM_FILE} to ${HOST}..."
+
+ set +e
+ OUTPUT=$(gem push --verbose --key "${KEY}" --host "${HOST}" "${GEM_FILE}" 2>&1)
+ STATUS=$?
+ set -e
+
+ echo "$OUTPUT"
+
+ if [ $STATUS -ne 0 ]; then
+ if echo "$OUTPUT" | grep -q "500 Internal Server Error"; then
+ echo "NOTICE: Gemstash returned 500 - version likely already exists. Skipping push..."
+ exit 0
+ else
+ echo "ERROR: gem push failed unexpectedly."
+ exit 1
+ fi
+ fi
+
+ echo "Push successful."
diff --git a/.rubocop.yml b/.rubocop.yml
index b606d748..e02aacb6 100644
--- a/.rubocop.yml
+++ b/.rubocop.yml
@@ -1,10 +1,8 @@
AllCops:
- TargetRubyVersion: 2.0
+ TargetRubyVersion: 3.1
DisplayCopNames: true
-
-LineLength:
- Max: 130
- Severity: warning
+ NewCops: enable
+ SuggestExtensions: false
Style/OneLineConditional:
Enabled: true
@@ -13,10 +11,6 @@ Style/StringLiterals:
# Being consistent with Puppet
EnforcedStyle: single_quotes
-# Since we're using Ruby >= 2.0 we can use the new hash syntax
-Style/HashSyntax:
- Enabled: true
-
# We are setting absurdly high limits but should work to tighten these up.
Metrics/AbcSize:
Max: 100
@@ -41,16 +35,20 @@ Metrics/PerceivedComplexity:
Max: 50
Severity: warning
+# To let us use a '-' in the gem name
+Naming/FileName:
+ Enabled: false
+Naming/VariableNumber:
+ Enabled: false
+
# Indentation
-CaseIndentation:
+Layout/CaseIndentation:
IndentOneStep: false
-
-Lint/EndAlignment:
+Layout/EndAlignment:
EnforcedStyleAlignWith: variable
-
-# To let us use a '-' in the gem name
-Style/FileName:
- Enabled: false
+Layout/LineLength:
+ Max: 130
+ Severity: warning
# Sometimes it's cleaner without this
Style/Documentation:
@@ -61,8 +59,6 @@ Style/FormatStringToken:
Enabled: false
Style/PercentLiteralDelimiters:
Enabled: false
-Style/VariableNumber:
- Enabled: false
Security/YAMLLoad:
Enabled: false
Lint/AmbiguousBlockAssociation:
@@ -81,7 +77,5 @@ Layout/HeredocIndentation:
Enabled: false
Layout/ExtraSpacing:
Enabled: false
-Performance/Caller:
- Enabled: false
Style/WordArray:
Enabled: false
diff --git a/.ruby-version b/.ruby-version
new file mode 100644
index 00000000..17ce9180
--- /dev/null
+++ b/.ruby-version
@@ -0,0 +1 @@
+3.2.11
diff --git a/.version b/.version
index 2bf1c1cc..4d4272a6 100644
--- a/.version
+++ b/.version
@@ -1 +1 @@
-2.3.1
+2.3.1-syseleven3.0
diff --git a/Dockerfile b/Dockerfile
index 80c17772..e7d250c2 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,11 +1,12 @@
-ARG RUBY_VERSION="2.6"
+ARG RUBY_VERSION="3.2.11"
+
FROM ruby:${RUBY_VERSION} as ruby
ARG RUBY_VERSION
ENV RUBY_VERSION="${RUBY_VERSION}"
RUN rm -rf $GEM_HOME $BUNDLE_PATH $BUNDLE_BIN $BUNDLE_APP_CONFIG
RUN apt-get update && apt-get install -y cmake openssl libssl-dev
-RUN sed -i'' -e 's/CipherString = DEFAULT@SECLEVEL=2/CipherString = DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
-RUN sed -i'' -e 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
+RUN sed -i 's/\[openssl_init\]/# [openssl_init]/' /etc/ssl/openssl.cnf && \
+ printf "\n[openssl_init]\nproviders = provider_sect\nssl_conf = ssl_configuration\n\n[provider_sect]\ndefault = default_sect\nlegacy = legacy_sect\n\n[default_sect]\nactivate = 1\n\n[legacy_sect]\nactivate = 1\n\n[ssl_configuration]\nsystem_default = tls_system_default\n\n[tls_system_default]\nMinProtocol = TLSv1\nCipherString = DEFAULT@SECLEVEL=0\n" >> /etc/ssl/openssl.cnf
FROM scratch AS app
ARG PUPPET_VERSION
@@ -14,7 +15,6 @@ COPY --from=ruby / /
WORKDIR /app
ENV LANG="C.UTF-8"
COPY . .
-#RUN gem install bundler -v 1.17.2
RUN script/bootstrap
CMD ["/app/script/cibuild"]
diff --git a/Gemfile b/Gemfile
index fa75df15..0fecea24 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,3 +1,13 @@
source 'https://rubygems.org'
gemspec
+
+group :development, :test do
+ gem 'parallel_tests', '~> 4.7'
+ gem 'rake', '~> 13.0'
+ gem 'rspec', '~> 3.13'
+ gem 'rspec-retry', '~> 0.6'
+ gem 'rubocop', '~> 1.66', require: false
+ gem 'simplecov', '~> 0.22'
+ gem 'simplecov-erb', '~> 1.0'
+end
diff --git a/README.md b/README.md
index ba3207b9..96c0ca49 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,8 @@
# octocatalog-diff 
-#### Compile Puppet catalogs from 2 branches, versions, etc., and compare them
+## fork of [github/octocatalog-diff](https://github.com/github/octocatalog-diff)
+
+### Compile Puppet catalogs from 2 branches, versions, etc., and compare them
`octocatalog-diff` is a tool that enables developers to be more efficient when testing changes to Puppet manifests. It is most commonly used to display differences in Puppet catalogs between stable and development branches. It does not require a working Puppet master (or puppetserver), so it is often run by developers on their workstations and in Continuous Integration environments.
@@ -21,6 +23,7 @@ Traditional Puppet development generally takes one of two forms. Frequently, dev
There are some [limitations](doc/limitations.md) to a catalog-based approach, meaning it will never completely replace unit, integration, or deployment testing. However, it does provide substantial time savings in both the development and testing cycle. In this repository, we provide example scripts for using `octocatalog-diff` in development and CI environments.
`octocatalog-diff` is currently able to get catalogs by the following methods:
+
- Compile catalog via the command line with a Puppet agent on your machine (as GitHub uses the tool internally)
- Obtain catalog over the network from PuppetDB
- Obtain catalog over the network using the API to query a Puppet Master / PuppetServer (Puppet 3.x through 6.x supported)
diff --git a/config/puppet-versions.json b/config/puppet-versions.json
deleted file mode 100644
index 4ed39b4b..00000000
--- a/config/puppet-versions.json
+++ /dev/null
@@ -1,24 +0,0 @@
-[
- {
- "minimum_version": "4.0.0",
- "maximum_version": "4.99.99",
- "additional_gems": [
- { "name": "puppetdb-terminus", "version": "3.2.4" }
- ]
- },
- {
- "minimum_version": "5.0.0",
- "maximum_version": "5.99.99",
- "additional_gems": []
- },
- {
- "minimum_version": "6.0.0",
- "maximum_version": "6.99.99",
- "additional_gems": []
- },
- {
- "minimum_version": "7.0.0",
- "maximum_version": "7.99.99",
- "additional_gems": []
- }
-]
diff --git a/lib/octocatalog-diff/catalog-diff/differ.rb b/lib/octocatalog-diff/catalog-diff/differ.rb
index 3d959fa0..0730ade5 100644
--- a/lib/octocatalog-diff/catalog-diff/differ.rb
+++ b/lib/octocatalog-diff/catalog-diff/differ.rb
@@ -371,11 +371,18 @@ def attr_match_rule?(rule, attrib, old_val, new_val)
if rule_attr =~ /\f/
beginning = rule_attr.start_with?("\f") ? '\A' : '(\A|\f)'
ending = '(\f|\Z)'
- rule_attr.gsub!(/^\f+/, '')
- hash_attr_regexp = Regexp.new(beginning + Regexp.escape(rule_attr) + ending, Regexp::IGNORECASE)
- return attrib.match(hash_attr_regexp) && matcher.call(old_val, new_val)
+ rule_attr_clean = rule_attr.gsub(/^\f+/, '')
+ hash_attr_regexp = Regexp.new(beginning + Regexp.escape(rule_attr_clean) + ending, Regexp::IGNORECASE)
+
+ if attrib.is_a?(Array)
+ return attrib.all? { |a| a.match?(hash_attr_regexp) && matcher.call(old_val, new_val) }
+ end
+ return attrib.match?(hash_attr_regexp) && matcher.call(old_val, new_val)
else
- s = attrib.downcase.split(/\f/)
+ s = attrib.is_a?(Array) ? attrib.map(&:downcase) : attrib.downcase.split(/\f/)
+ if attrib.is_a?(Array)
+ return attrib.all? { |a| s.include?(a.downcase) && matcher.call(old_val, new_val) }
+ end
return s.include?(rule_attr.downcase) && matcher.call(old_val, new_val)
end
end
diff --git a/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb b/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb
index 5e2747dd..b105f8ad 100644
--- a/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb
+++ b/lib/octocatalog-diff/catalog-diff/filter/compilation_dir.rb
@@ -66,12 +66,12 @@ def remove_compilation_dir(v, dir)
value
end
- def traverse(a)
+ def traverse(a, &proc)
case a
when Array
- a.map { |v| traverse(v, &Proc.new) }
+ a.map { |v| traverse(v, &proc) }
when Hash
- traverse(a.values, &Proc.new)
+ traverse(a.values, &proc)
else
yield a
end
diff --git a/lib/octocatalog-diff/catalog-diff/filter/yaml.rb b/lib/octocatalog-diff/catalog-diff/filter/yaml.rb
index 16510821..89969702 100644
--- a/lib/octocatalog-diff/catalog-diff/filter/yaml.rb
+++ b/lib/octocatalog-diff/catalog-diff/filter/yaml.rb
@@ -26,8 +26,8 @@ def filtered?(diff, _options = {})
# Attempt to convert the old value and new value into YAML objects. Assuming
# that doesn't error out, the return value is whether or not they're equal.
- obj_old = ::YAML.load(diff.old_value)
- obj_new = ::YAML.load(diff.new_value)
+ obj_old = ::YAML.unsafe_load(diff.old_value)
+ obj_new = ::YAML.unsafe_load(diff.new_value)
obj_old == obj_new
rescue # Rescue everything - if something failed, we aren't sure what's going on, so we'll return false.
false
diff --git a/lib/octocatalog-diff/catalog-util/builddir.rb b/lib/octocatalog-diff/catalog-util/builddir.rb
index f1964066..19a7e105 100644
--- a/lib/octocatalog-diff/catalog-util/builddir.rb
+++ b/lib/octocatalog-diff/catalog-util/builddir.rb
@@ -236,7 +236,7 @@ def install_hiera_config(logger, options)
raise Errno::ENOENT, "hiera.yaml (#{file_src}) wasn't found" unless File.file?(file_src)
# Munge datadir in hiera config file
- obj = YAML.load_file(file_src)
+ obj = YAML.unsafe_load_file(file_src)
version = obj['version'] || obj[:version] || 3
if version.to_i == 5
update_hiera_config_v5(logger, options, obj)
diff --git a/lib/octocatalog-diff/catalog-util/enc.rb b/lib/octocatalog-diff/catalog-util/enc.rb
index 12c00819..f1801a4c 100644
--- a/lib/octocatalog-diff/catalog-util/enc.rb
+++ b/lib/octocatalog-diff/catalog-util/enc.rb
@@ -63,7 +63,7 @@ def execute(logger = nil)
# @param logger [Logger] Logger object
def override_enc_parameters(logger)
return unless @options[:enc_override].is_a?(Array) && @options[:enc_override].any?
- content_structure = YAML.load(content)
+ content_structure = YAML.safe_load(content)
@options[:enc_override].each do |x|
keys = x.key.is_a?(Regexp) ? content_structure.keys.select { |y| x.key.match(y) } : [x.key]
keys.each do |key|
diff --git a/lib/octocatalog-diff/facts/yaml.rb b/lib/octocatalog-diff/facts/yaml.rb
index 35c03342..36a29c99 100644
--- a/lib/octocatalog-diff/facts/yaml.rb
+++ b/lib/octocatalog-diff/facts/yaml.rb
@@ -22,7 +22,7 @@ def self.fact_retriever(options = {}, node = '')
fact_file_data[0] = '---' if fact_file_data[0] =~ /^---/
# Load the parsed fact file.
- parsed = YAML.load(fact_file_data.join("\n"))
+ parsed = YAML.unsafe_load(fact_file_data.join("\n"))
# This is a handler for a YAML file that has just the facts and none of the
# structure. For example if you saved the output of `facter -y` to a file and
diff --git a/lib/octocatalog-diff/util/parallel.rb b/lib/octocatalog-diff/util/parallel.rb
index 4f4197ed..b1fe8a2d 100644
--- a/lib/octocatalog-diff/util/parallel.rb
+++ b/lib/octocatalog-diff/util/parallel.rb
@@ -123,8 +123,16 @@ def self.run_tasks_parallel(result, task_array, logger)
# :nocov:
pidmap[this_pid] = { index: index, start_time: Time.now }
- logger.debug "Launched pid=#{this_pid} for index=#{index}"
- logger.reopen if logger.respond_to?(:reopen)
+ begin
+ logger.debug "Launched pid=#{this_pid} for index=#{index}"
+ rescue IOError
+ # Stream closed in parent/child race during test capture
+ end
+ begin
+ logger.reopen if logger.respond_to?(:reopen)
+ rescue IOError
+ # Ignore closed stream on reopen
+ end
end
# Waiting for children and handling results
@@ -193,25 +201,22 @@ def self.run_tasks_serial(result, task_array, logger)
# @return [OctocatalogDiff::Util::Parallel::Result] Parallel task result
def self.execute_task(task, logger)
begin
- logger.debug("Begin #{task.description}")
+ logger.debug("Begin #{task.description}") rescue IOError nil
output = task.execute(logger)
result = Result.new(output: output, status: true, args: task.args)
rescue => exc
- logger.debug("Failed #{task.description}: #{exc.class} #{exc.message}")
- # Immediately return without running the validation, since this already failed.
+ logger.debug("Failed #{task.description}: #{exc.class} #{exc.message}") rescue IOError nil
return Result.new(exception: exc, status: false, args: task.args)
end
begin
if task.validate(output, logger)
- logger.debug("Success #{task.description}")
+ logger.debug("Success #{task.description}") rescue IOError nil
else
- # Preferably the validator method raised its own exception. However if it
- # simply returned false, raise our own exception here.
raise "Failed #{task.description} validation (unspecified error)"
end
rescue => exc
- logger.warn("Failed #{task.description} validation: #{exc.class} #{exc.message}")
+ logger.warn("Failed #{task.description} validation: #{exc.class} #{exc.message}") rescue IOError nil
result.status = false
result.exception = exc
end
diff --git a/lib/octocatalog-diff/util/scriptrunner.rb b/lib/octocatalog-diff/util/scriptrunner.rb
index 2476eed2..9173b68e 100644
--- a/lib/octocatalog-diff/util/scriptrunner.rb
+++ b/lib/octocatalog-diff/util/scriptrunner.rb
@@ -84,6 +84,8 @@ def output
def log(priority, message, logger = @logger)
return unless logger
logger.send(priority, [message])
+ rescue IOError
+ # Suppress closed stream errors during process capture/fork
end
# PRIVATE: Create a temporary file with the contents of the script and mark the script executable.
diff --git a/octocatalog-diff.gemspec b/octocatalog-diff.gemspec
index 92245a50..610bb51c 100644
--- a/octocatalog-diff.gemspec
+++ b/octocatalog-diff.gemspec
@@ -1,52 +1,39 @@
-require 'json'
-
-DEFAULT_PUPPET_VERSION = '7.32.1'.freeze
-
Gem::Specification.new do |s|
- s.required_ruby_version = '>= 2.6.0'
- puppet_version = ENV['PUPPET_VERSION'] || DEFAULT_PUPPET_VERSION
-
s.name = 'octocatalog-diff'
- s.version = ENV['OCTOCATALOG_DIFF_VERSION'] || File.read(File.join(File.dirname(__FILE__), '.version')).strip
+ s.version = ENV['OCTOCATALOG_DIFF_VERSION'] || File.read(File.join(__dir__, '.version')).strip
s.license = 'MIT'
- s.authors = ['GitHub, Inc.', 'Kevin Paulisse']
- s.email = 'opensource+octocatalog-diff@github.com'
- s.files = Dir.glob('doc/**/*.md') \
- + Dir.glob('lib/**/*') \
- + Dir.glob('scripts/**/*') \
- + %w(LICENSE README.md .version bin/octocatalog-diff)
- s.executables = 'octocatalog-diff'
- s.homepage = 'https://github.com/github/octocatalog-diff'
- s.summary = 'Compile Puppet catalogs from 2 branches, versions, etc., and compare them.'
- s.description = <<-EOF
- Octocatalog-Diff assists with Puppet development and testing by enabling the user to
- compile 2 Puppet catalogs and compare them. It is possible to compare different
- branches, different versions, and different fact values. This is intended to be run
- from a local development environment or in CI.
-EOF
+ s.authors = ['SysEleven GmbH', 'GitHub, Inc.', 'Kevin Paulisse']
+ s.email = ['opensource@syseleven.de']
+ s.homepage = 'https://github.com/syseleven/octocatalog-diff'
+ s.summary = 'Compile OpenVox/Puppet catalogs from 2 branches, versions, etc., and compare them.'
+ s.description = <<~DESC
+ Octocatalog-Diff assists with Puppet/OpenVox development and testing by enabling the
+ user to compile 2 catalogs and compare them. It is possible to compare different
+ branches, different versions, and different fact values. This is intended to be run
+ from a local development environment or in CI. This is the SysEleven fork, updated
+ for OpenVox 8 and Ruby >= 3.2.
+ DESC
+
+ s.files = Dir.glob('doc/**/*.md') \
+ + Dir.glob('lib/**/*') \
+ + Dir.glob('scripts/**/*') \
+ + %w[LICENSE README.md .version bin/octocatalog-diff]
+ s.executables = ['octocatalog-diff']
+
+ s.required_ruby_version = ['>= 3.2', '< 4']
- s.add_runtime_dependency 'diffy', '>= 3.1.0'
- s.add_runtime_dependency 'httparty', '>= 0.21.0'
- s.add_runtime_dependency 'hashdiff', '>= 0.3.0'
- s.add_runtime_dependency 'parallel', '>= 1.12.0'
- s.add_runtime_dependency 'rugged', '>= 0.25.0b2'
- s.add_runtime_dependency 'puppet', '>= 5.5.0'
- s.add_development_dependency 'puppet', '>= 5.5.0'
- s.add_development_dependency 'rspec', '~> 3.4.0'
- s.add_development_dependency 'rake', '12.3.3'
- s.add_development_dependency 'parallel_tests', '2.7.1'
- s.add_development_dependency 'rspec-retry', '0.5.0'
- s.add_development_dependency 'rubocop', '= 0.49.0'
- s.add_development_dependency 'simplecov', '~> 0.14.1'
- s.add_development_dependency 'simplecov-erb', '~> 0.1.1'
+ s.metadata = {
+ 'github_repo' => 'ssh://github.com/syseleven/octocatalog-diff',
+ 'homepage_uri' => 'https://github.com/syseleven/octocatalog-diff',
+ 'source_code_uri' => 'https://github.com/syseleven/octocatalog-diff',
+ 'bug_tracker_uri' => 'https://github.com/syseleven/octocatalog-diff/issues',
+ 'changelog_uri' => 'https://github.com/syseleven/octocatalog-diff/blob/master/doc/CHANGELOG.md',
+ }
- puppet_v = Gem::Version.new(puppet_version)
- version_config = JSON.parse(File.read(File.join(File.dirname(__FILE__), 'config', 'puppet-versions.json')))
- version_config.each do |data|
- next unless puppet_v >= Gem::Version.new(data['minimum_version'])
- next unless puppet_v <= Gem::Version.new(data['maximum_version'])
- data['additional_gems'].each do |additional_gem|
- s.add_development_dependency additional_gem['name'], additional_gem['version']
- end
- end
+ s.add_dependency 'diffy', '>= 3.4', '< 4'
+ s.add_dependency 'hashdiff', '>= 1.0', '< 2'
+ s.add_dependency 'httparty', '~> 0.21'
+ s.add_dependency 'openvox', '>= 8.19', '< 9'
+ s.add_dependency 'parallel', '>= 1.24', '< 2'
+ s.add_dependency 'rugged', '>= 1.6', '< 2'
end
diff --git a/script/bootstrap b/script/bootstrap
index 8807dc62..4c60a452 100755
--- a/script/bootstrap
+++ b/script/bootstrap
@@ -14,8 +14,11 @@ set +e
echo 'Running bundler'
cd "${DIR}" && \
rm -f Gemfile.lock && \
- bundle install --without='' --no-prune --path vendor/bundle --local && \
- bundle binstubs puppet rake rspec-core rubocop parallel_tests && \
+ bundle config set --local no_prune 'true' && \
+ bundle config set --local path 'vendor/bundle' && \
+ bundle config set --local without '' && \
+ bundle install && \
+ bundle binstubs openvox rake rspec-core rubocop parallel_tests && \
chmod 0755 bin/octocatalog-diff
if [ $? -ne 0 ]; then
echo 'bundle install failed - aborting bootstrap'
diff --git a/spec/octocatalog-diff/fixtures/facts/valid-facts.yaml b/spec/octocatalog-diff/fixtures/facts/valid-facts.yaml
index 2fa9a0fa..e45bf8d1 100644
--- a/spec/octocatalog-diff/fixtures/facts/valid-facts.yaml
+++ b/spec/octocatalog-diff/fixtures/facts/valid-facts.yaml
@@ -10,3 +10,5 @@ values:
fqdn: rspec-node.xyz.github.net
ipaddress: 10.20.30.40
kernel: Linux
+ virtual: 'physical'
+ is_virtual: 'false'
diff --git a/spec/octocatalog-diff/integration/pe_enc_spec.rb b/spec/octocatalog-diff/integration/pe_enc_spec.rb
index 6f9b33e8..11c3c5c5 100644
--- a/spec/octocatalog-diff/integration/pe_enc_spec.rb
+++ b/spec/octocatalog-diff/integration/pe_enc_spec.rb
@@ -40,7 +40,7 @@ def self.response(method, uri, _headers, _body)
return respond(404, 'Not Found', nil, '{"error":"Unexpected URL received"}')
end
content = OctocatalogDiff::Spec.fixture_read('enc/puppet-enterprise-enc.yaml').gsub(/\r\n/n, "\n").gsub(/\n/n, "\r\n")
- response_content = YAML.load(content).to_json
+ response_content = YAML.unsafe_load(content).to_json
respond(200, 'OK', 'application/json', response_content)
end
diff --git a/spec/octocatalog-diff/mocks/puppetdb.rb b/spec/octocatalog-diff/mocks/puppetdb.rb
index 23c002fc..0295680b 100644
--- a/spec/octocatalog-diff/mocks/puppetdb.rb
+++ b/spec/octocatalog-diff/mocks/puppetdb.rb
@@ -41,7 +41,7 @@ def facts(hostname)
# so it doesn't try to load in all of puppet.
fact_file = File.read(fixture_file).split(/\n/)
fact_file[0] = '---'
- facts_in = YAML.load(fact_file.join("\n"))
+ facts_in = YAML.unsafe_load(fact_file.join("\n"))
return [] unless facts_in.key?('values') && facts_in['values'].is_a?(Hash)
# Convert the hash into an array of { 'name' => ..., 'value' => ... } pairs
diff --git a/spec/octocatalog-diff/tests/api/v1/config_spec.rb b/spec/octocatalog-diff/tests/api/v1/config_spec.rb
index 61d6f0f3..6a791dd9 100644
--- a/spec/octocatalog-diff/tests/api/v1/config_spec.rb
+++ b/spec/octocatalog-diff/tests/api/v1/config_spec.rb
@@ -124,7 +124,7 @@
exception = exc
end
expect(exception).to be_a_kind_of(SyntaxError)
- expect(exception.message).to match(/unexpected tIDENTIFIER/)
+ expect(exception.message).to match(/syntax error|unexpected/i)
expect(@logger_str.string).to match(/DEBUG -- : Loading octocatalog-diff configuration from/)
expect(@logger_str.string).to match(/FATAL .+ SyntaxError error with .+not-ruby.rb/)
end
diff --git a/spec/octocatalog-diff/tests/api/v1/override_spec.rb b/spec/octocatalog-diff/tests/api/v1/override_spec.rb
index db1122bb..219da78b 100644
--- a/spec/octocatalog-diff/tests/api/v1/override_spec.rb
+++ b/spec/octocatalog-diff/tests/api/v1/override_spec.rb
@@ -260,7 +260,7 @@
arg = 'key=(json){akdsfjalsdkfjasdf}'
expect do
_foo = described_class.create_from_input(arg)
- end.to raise_error(JSON::ParserError, /unexpected token at '\{akdsfjalsdkfjasdf\}'/)
+ end.to raise_error(JSON::ParserError)
end
it 'should raise ArgumentError when unrecognized data type is specified' do
diff --git a/spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb b/spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb
index f9e72282..40435ad9 100644
--- a/spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb
+++ b/spec/octocatalog-diff/tests/catalog-util/builddir_spec.rb
@@ -307,7 +307,7 @@
expect(File.file?(File.join(testobj.tempdir, 'routes.yaml'))).to eq(true)
content = File.read(File.join(testobj.tempdir, 'routes.yaml')).split(/\n/)
expect(content.size).to eq(7)
- routes_yaml = YAML.load_file(File.join(testobj.tempdir, 'routes.yaml'))
+ routes_yaml = YAML.unsafe_load_file(File.join(testobj.tempdir, 'routes.yaml'))
expect(routes_yaml).to eq('master' => {
'facts' => { 'terminus' => 'facter', 'cache' => 'yaml' },
'catalog' => { 'cache' => 'json' }
@@ -333,7 +333,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: '/var/lib/puppet/environments/production/hieradata')
end
@@ -346,7 +346,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: '/var/lib/puppet/environments/production/hieradata')
end
@@ -368,7 +368,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: '/var/lib/puppet/environments/one/hieradata')
end
@@ -379,7 +379,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'one', 'hieradata'))
expect(logger_str.string).not_to match(/Hiera datadir for yaml doesn't seem to exist/)
@@ -402,7 +402,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: '/var/lib/puppet/environments/one/hieradata')
end
@@ -413,7 +413,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'one', 'hieradata'))
expect(logger_str.string).not_to match(/Hiera datadir for yaml doesn't seem to exist/)
@@ -427,7 +427,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: '/var/lib/puppet/environments/production/hieradata')
end
@@ -443,7 +443,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata'))
end
@@ -459,7 +459,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata'))
expect(logger_str.string).not_to match(/Hiera datadir for yaml doesn't seem to exist/)
@@ -488,7 +488,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(['yaml'])
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'aksdfjlkfjk'))
expect(logger_str.string).to match(%r{WARNING: Hiera datadir for yaml.+/environments/production/aksdfjlkfjk})
@@ -505,7 +505,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq(%w(eyaml yaml json))
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata'))
expect(hiera_cfg[:eyaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata'))
@@ -528,7 +528,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:backends]).to eq('yaml')
expect(hiera_cfg[:yaml]).to eq(datadir: File.join(testobj.tempdir, 'environments', 'production', 'hieradata'))
end
@@ -557,7 +557,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg['defaults']).to eq('datadir' => File.join(testobj.tempdir, '/environments/production/hieradata'))
expect(hiera_cfg['hierarchy']).to include('name' => 'fqdn', 'path' => 'servers/%{::fqdn}.yaml')
expect(hiera_cfg['hierarchy']).to include('name' => 'datacenter', 'path' => 'datacenter/%{::datacenter}.yaml')
@@ -584,7 +584,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:defaults]).to eq(datadir: File.join(testobj.tempdir, '/environments/production/hieradata'))
expect(hiera_cfg[:hierarchy]).to include(name: 'fqdn', path: 'servers/%{::fqdn}.yaml')
expect(hiera_cfg[:hierarchy]).to include(name: 'datacenter', path: 'datacenter/%{::datacenter}.yaml')
@@ -602,7 +602,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg['defaults']).to eq('datadir' => File.join(testobj.tempdir, '/environments/production/hieradata'))
expect(hiera_cfg['hierarchy']).to include('name' => 'fqdn', 'path' => 'servers/%{::fqdn}.yaml')
expect(hiera_cfg['hierarchy']).to include('name' => 'datacenter', 'path' => 'datacenter/%{::datacenter}.yaml')
@@ -620,7 +620,7 @@
testobj = OctocatalogDiff::CatalogUtil::BuildDir.new(options, logger)
hiera_yaml = File.join(testobj.tempdir, 'hiera.yaml')
expect(File.file?(hiera_yaml)).to eq(true)
- hiera_cfg = YAML.load_file(hiera_yaml)
+ hiera_cfg = YAML.unsafe_load_file(hiera_yaml)
expect(hiera_cfg[:defaults]).to eq(datadir: File.join(testobj.tempdir, '/environments/production/hieradata'))
expect(hiera_cfg[:hierarchy]).to include(name: 'fqdn', path: 'servers/%{::fqdn}.yaml')
expect(hiera_cfg[:hierarchy]).to include(name: 'datacenter', path: 'datacenter/%{::datacenter}.yaml')
@@ -650,7 +650,7 @@
expect(yaml_content[0]).to eq('--- !ruby/object:Puppet::Node::Facts')
yaml_content[0] = '---' # To avoid need for puppet gem
- factobj = YAML.load(yaml_content.join("\n"))
+ factobj = YAML.unsafe_load(yaml_content.join("\n"))
expect(factobj).to be_a_kind_of(Hash)
expect(factobj['name']).to eq('rspec-node.github.net')
expect(factobj['values']).to be_a_kind_of(Hash)
@@ -676,7 +676,7 @@
expect(yaml_content[0]).to eq('--- !ruby/object:Puppet::Node::Facts')
yaml_content[0] = '---' # To avoid need for puppet gem
- factobj = YAML.load(yaml_content.join("\n"))
+ factobj = YAML.unsafe_load(yaml_content.join("\n"))
expect(factobj).to be_a_kind_of(Hash)
expect(factobj['name']).to eq('rspec-node.github.net')
expect(factobj['values']).to be_a_kind_of(Hash)
@@ -705,7 +705,7 @@
expect(yaml_content[0]).to eq('--- !ruby/object:Puppet::Node::Facts')
yaml_content[0] = '---' # To avoid need for puppet gem
- factobj = YAML.load(yaml_content.join("\n"))
+ factobj = YAML.unsafe_load(yaml_content.join("\n"))
expect(factobj).to be_a_kind_of(Hash)
expect(factobj['name']).to eq('rspec-node.github.net')
expect(factobj['values']).to be_a_kind_of(Hash)
@@ -734,7 +734,7 @@
expect(yaml_content[0]).to eq('--- !ruby/object:Puppet::Node::Facts')
yaml_content[0] = '---' # To avoid need for puppet gem
- factobj = YAML.load(yaml_content.join("\n"))
+ factobj = YAML.unsafe_load(yaml_content.join("\n"))
expect(factobj).to be_a_kind_of(Hash)
expect(factobj['name']).to eq('rspec-node.github.net')
expect(factobj['values']).to be_a_kind_of(Hash)
diff --git a/spec/octocatalog-diff/tests/catalog_spec.rb b/spec/octocatalog-diff/tests/catalog_spec.rb
index 34dc598b..8ef86686 100644
--- a/spec/octocatalog-diff/tests/catalog_spec.rb
+++ b/spec/octocatalog-diff/tests/catalog_spec.rb
@@ -183,7 +183,7 @@
it 'should return error message from catalog compilation' do
catalog_opts = { json: '{not json}', compare_file_text: false }
catalog = OctocatalogDiff::Catalog.create(catalog_opts)
- expect(catalog.error_message).to match(/unexpected token at '{not json}'/)
+ expect(catalog.error_message).to match(/Catalog JSON input failed to parse/i)
end
it 'should return nil if there was no error in catalog compilation' do
diff --git a/spec/octocatalog-diff/tests/spec_helper.rb b/spec/octocatalog-diff/tests/spec_helper.rb
index 4cef0918..c1c21b75 100644
--- a/spec/octocatalog-diff/tests/spec_helper.rb
+++ b/spec/octocatalog-diff/tests/spec_helper.rb
@@ -281,7 +281,7 @@ def self.mock_puppetdb_fact_response(hostname)
# so it doesn't try to load in all of puppet.
fact_file = File.read(fixture_file).split(/\n/)
fact_file[0] = '---'
- facts_in = YAML.load(fact_file.join("\n"))
+ facts_in = YAML.unsafe_load(fact_file.join("\n"))
return [] unless facts_in.key?('values') && facts_in['values'].is_a?(Hash)
# Convert the hash into an array of { 'name' => ..., 'value' => ... } pairs
diff --git a/spec/octocatalog-diff/tests/util/catalogs_spec.rb b/spec/octocatalog-diff/tests/util/catalogs_spec.rb
index 27f3e2ca..151e1889 100644
--- a/spec/octocatalog-diff/tests/util/catalogs_spec.rb
+++ b/spec/octocatalog-diff/tests/util/catalogs_spec.rb
@@ -170,7 +170,7 @@ def valid?
pending 'bash, git, and/or tar are required for most tests' unless @has_git && @has_tar && @has_bash
bootstrap_result = File.join(@dir1, 'bootstrap_result.yaml')
expect(File.file?(bootstrap_result)).to eq(true)
- yaml_content = YAML.load_file(bootstrap_result)
+ yaml_content = YAML.unsafe_load_file(bootstrap_result)
expect(yaml_content).to be_a_kind_of(Hash)
expect(yaml_content['env::path']).to eq('/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/usr/local/sbin')
expect(yaml_content['env::pwd']).to eq(@dir1)
@@ -182,7 +182,7 @@ def valid?
pending 'bash, git, and/or tar are required for most tests' unless @has_git && @has_tar && @has_bash
bootstrap_result = File.join(@dir2, 'bootstrap_result.yaml')
expect(File.file?(bootstrap_result)).to eq(true)
- yaml_content = YAML.load_file(bootstrap_result)
+ yaml_content = YAML.unsafe_load_file(bootstrap_result)
expect(yaml_content).to be_a_kind_of(Hash)
expect(yaml_content['env::path']).to eq('/usr/sbin:/sbin:/usr/bin:/bin:/usr/local/bin:/usr/local/sbin')
expect(yaml_content['env::pwd']).to eq(@dir2)
diff --git a/vendor/cache/CFPropertyList-2.2.8.gem b/vendor/cache/CFPropertyList-2.2.8.gem
deleted file mode 100644
index adf1cf0c..00000000
Binary files a/vendor/cache/CFPropertyList-2.2.8.gem and /dev/null differ
diff --git a/vendor/cache/ast-2.4.2.gem b/vendor/cache/ast-2.4.2.gem
deleted file mode 100644
index abe16436..00000000
Binary files a/vendor/cache/ast-2.4.2.gem and /dev/null differ
diff --git a/vendor/cache/concurrent-ruby-1.1.7.gem b/vendor/cache/concurrent-ruby-1.1.7.gem
deleted file mode 100644
index ae9b3702..00000000
Binary files a/vendor/cache/concurrent-ruby-1.1.7.gem and /dev/null differ
diff --git a/vendor/cache/deep_merge-1.2.1.gem b/vendor/cache/deep_merge-1.2.1.gem
deleted file mode 100644
index ee9d198f..00000000
Binary files a/vendor/cache/deep_merge-1.2.1.gem and /dev/null differ
diff --git a/vendor/cache/diff-lcs-1.5.1.gem b/vendor/cache/diff-lcs-1.5.1.gem
deleted file mode 100644
index c070cb0d..00000000
Binary files a/vendor/cache/diff-lcs-1.5.1.gem and /dev/null differ
diff --git a/vendor/cache/diffy-3.4.2.gem b/vendor/cache/diffy-3.4.2.gem
deleted file mode 100644
index f6c83e44..00000000
Binary files a/vendor/cache/diffy-3.4.2.gem and /dev/null differ
diff --git a/vendor/cache/docile-1.1.5.gem b/vendor/cache/docile-1.1.5.gem
deleted file mode 100644
index 4eb5de66..00000000
Binary files a/vendor/cache/docile-1.1.5.gem and /dev/null differ
diff --git a/vendor/cache/facter-2.5.7.gem b/vendor/cache/facter-2.5.7.gem
deleted file mode 100644
index 0c49e7c5..00000000
Binary files a/vendor/cache/facter-2.5.7.gem and /dev/null differ
diff --git a/vendor/cache/fast_gettext-1.1.2.gem b/vendor/cache/fast_gettext-1.1.2.gem
deleted file mode 100644
index 9dac89ed..00000000
Binary files a/vendor/cache/fast_gettext-1.1.2.gem and /dev/null differ
diff --git a/vendor/cache/gettext-3.2.6.gem b/vendor/cache/gettext-3.2.6.gem
deleted file mode 100644
index c36484ce..00000000
Binary files a/vendor/cache/gettext-3.2.6.gem and /dev/null differ
diff --git a/vendor/cache/gettext-setup-0.30.gem b/vendor/cache/gettext-setup-0.30.gem
deleted file mode 100644
index 44e32ad4..00000000
Binary files a/vendor/cache/gettext-setup-0.30.gem and /dev/null differ
diff --git a/vendor/cache/hashdiff-1.1.1.gem b/vendor/cache/hashdiff-1.1.1.gem
deleted file mode 100644
index f0a3f1b8..00000000
Binary files a/vendor/cache/hashdiff-1.1.1.gem and /dev/null differ
diff --git a/vendor/cache/hiera-3.12.0.gem b/vendor/cache/hiera-3.12.0.gem
deleted file mode 100644
index 2a01d965..00000000
Binary files a/vendor/cache/hiera-3.12.0.gem and /dev/null differ
diff --git a/vendor/cache/hocon-1.3.1.gem b/vendor/cache/hocon-1.3.1.gem
deleted file mode 100644
index e474ff66..00000000
Binary files a/vendor/cache/hocon-1.3.1.gem and /dev/null differ
diff --git a/vendor/cache/httparty-0.21.0.gem b/vendor/cache/httparty-0.21.0.gem
deleted file mode 100644
index 7c216b03..00000000
Binary files a/vendor/cache/httparty-0.21.0.gem and /dev/null differ
diff --git a/vendor/cache/httpclient-2.8.3.gem b/vendor/cache/httpclient-2.8.3.gem
deleted file mode 100644
index 9c19ad46..00000000
Binary files a/vendor/cache/httpclient-2.8.3.gem and /dev/null differ
diff --git a/vendor/cache/json-2.7.2.gem b/vendor/cache/json-2.7.2.gem
deleted file mode 100644
index 1c3c4680..00000000
Binary files a/vendor/cache/json-2.7.2.gem and /dev/null differ
diff --git a/vendor/cache/json_pure-1.8.6.gem b/vendor/cache/json_pure-1.8.6.gem
deleted file mode 100644
index 7380e49d..00000000
Binary files a/vendor/cache/json_pure-1.8.6.gem and /dev/null differ
diff --git a/vendor/cache/json_pure-2.0.2.gem b/vendor/cache/json_pure-2.0.2.gem
deleted file mode 100644
index 6716fb4b..00000000
Binary files a/vendor/cache/json_pure-2.0.2.gem and /dev/null differ
diff --git a/vendor/cache/locale-2.1.4.gem b/vendor/cache/locale-2.1.4.gem
deleted file mode 100644
index 60fd62df..00000000
Binary files a/vendor/cache/locale-2.1.4.gem and /dev/null differ
diff --git a/vendor/cache/mime-types-3.5.2.gem b/vendor/cache/mime-types-3.5.2.gem
deleted file mode 100644
index 57a6ae2f..00000000
Binary files a/vendor/cache/mime-types-3.5.2.gem and /dev/null differ
diff --git a/vendor/cache/mime-types-data-3.2023.1205.gem b/vendor/cache/mime-types-data-3.2023.1205.gem
deleted file mode 100644
index dbe83e66..00000000
Binary files a/vendor/cache/mime-types-data-3.2023.1205.gem and /dev/null differ
diff --git a/vendor/cache/mini_mime-1.1.5.gem b/vendor/cache/mini_mime-1.1.5.gem
deleted file mode 100644
index b16e88f5..00000000
Binary files a/vendor/cache/mini_mime-1.1.5.gem and /dev/null differ
diff --git a/vendor/cache/multi_json-1.15.0.gem b/vendor/cache/multi_json-1.15.0.gem
deleted file mode 100644
index 8348d7b7..00000000
Binary files a/vendor/cache/multi_json-1.15.0.gem and /dev/null differ
diff --git a/vendor/cache/multi_xml-0.6.0.gem b/vendor/cache/multi_xml-0.6.0.gem
deleted file mode 100644
index 77c5d002..00000000
Binary files a/vendor/cache/multi_xml-0.6.0.gem and /dev/null differ
diff --git a/vendor/cache/parallel-1.24.0.gem b/vendor/cache/parallel-1.24.0.gem
deleted file mode 100644
index f2b99ea2..00000000
Binary files a/vendor/cache/parallel-1.24.0.gem and /dev/null differ
diff --git a/vendor/cache/parallel_tests-2.7.1.gem b/vendor/cache/parallel_tests-2.7.1.gem
deleted file mode 100644
index 47be61ed..00000000
Binary files a/vendor/cache/parallel_tests-2.7.1.gem and /dev/null differ
diff --git a/vendor/cache/parser-2.7.2.0.gem b/vendor/cache/parser-2.7.2.0.gem
deleted file mode 100644
index 66f82f11..00000000
Binary files a/vendor/cache/parser-2.7.2.0.gem and /dev/null differ
diff --git a/vendor/cache/powerpack-0.1.3.gem b/vendor/cache/powerpack-0.1.3.gem
deleted file mode 100644
index c8c1496e..00000000
Binary files a/vendor/cache/powerpack-0.1.3.gem and /dev/null differ
diff --git a/vendor/cache/puppet-4.10.10.gem b/vendor/cache/puppet-4.10.10.gem
deleted file mode 100644
index a98710dc..00000000
Binary files a/vendor/cache/puppet-4.10.10.gem and /dev/null differ
diff --git a/vendor/cache/puppet-5.5.22.gem b/vendor/cache/puppet-5.5.22.gem
deleted file mode 100644
index 66fc27d9..00000000
Binary files a/vendor/cache/puppet-5.5.22.gem and /dev/null differ
diff --git a/vendor/cache/puppet-5.5.8.gem b/vendor/cache/puppet-5.5.8.gem
deleted file mode 100644
index 38cd7dc7..00000000
Binary files a/vendor/cache/puppet-5.5.8.gem and /dev/null differ
diff --git a/vendor/cache/puppet-6.18.0.gem b/vendor/cache/puppet-6.18.0.gem
deleted file mode 100644
index c3bcc148..00000000
Binary files a/vendor/cache/puppet-6.18.0.gem and /dev/null differ
diff --git a/vendor/cache/puppet-7.3.0.gem b/vendor/cache/puppet-7.3.0.gem
deleted file mode 100644
index 7c2705be..00000000
Binary files a/vendor/cache/puppet-7.3.0.gem and /dev/null differ
diff --git a/vendor/cache/puppet-7.32.1.gem b/vendor/cache/puppet-7.32.1.gem
deleted file mode 100644
index 2cc2ff23..00000000
Binary files a/vendor/cache/puppet-7.32.1.gem and /dev/null differ
diff --git a/vendor/cache/puppet-resource_api-1.8.13.gem b/vendor/cache/puppet-resource_api-1.8.13.gem
deleted file mode 100644
index 13f8c5ab..00000000
Binary files a/vendor/cache/puppet-resource_api-1.8.13.gem and /dev/null differ
diff --git a/vendor/cache/puppetdb-terminus-3.2.4.gem b/vendor/cache/puppetdb-terminus-3.2.4.gem
deleted file mode 100644
index 0da55b98..00000000
Binary files a/vendor/cache/puppetdb-terminus-3.2.4.gem and /dev/null differ
diff --git a/vendor/cache/rainbow-2.2.2.gem b/vendor/cache/rainbow-2.2.2.gem
deleted file mode 100644
index e5e00df0..00000000
Binary files a/vendor/cache/rainbow-2.2.2.gem and /dev/null differ
diff --git a/vendor/cache/rake-12.3.3.gem b/vendor/cache/rake-12.3.3.gem
deleted file mode 100644
index e21bbafe..00000000
Binary files a/vendor/cache/rake-12.3.3.gem and /dev/null differ
diff --git a/vendor/cache/rspec-3.4.0.gem b/vendor/cache/rspec-3.4.0.gem
deleted file mode 100644
index fd33b66c..00000000
Binary files a/vendor/cache/rspec-3.4.0.gem and /dev/null differ
diff --git a/vendor/cache/rspec-core-3.4.4.gem b/vendor/cache/rspec-core-3.4.4.gem
deleted file mode 100644
index e9fd0165..00000000
Binary files a/vendor/cache/rspec-core-3.4.4.gem and /dev/null differ
diff --git a/vendor/cache/rspec-expectations-3.4.0.gem b/vendor/cache/rspec-expectations-3.4.0.gem
deleted file mode 100644
index 03cd4f86..00000000
Binary files a/vendor/cache/rspec-expectations-3.4.0.gem and /dev/null differ
diff --git a/vendor/cache/rspec-mocks-3.4.1.gem b/vendor/cache/rspec-mocks-3.4.1.gem
deleted file mode 100644
index cdd9f75d..00000000
Binary files a/vendor/cache/rspec-mocks-3.4.1.gem and /dev/null differ
diff --git a/vendor/cache/rspec-retry-0.5.0.gem b/vendor/cache/rspec-retry-0.5.0.gem
deleted file mode 100644
index bb3b92db..00000000
Binary files a/vendor/cache/rspec-retry-0.5.0.gem and /dev/null differ
diff --git a/vendor/cache/rspec-support-3.4.1.gem b/vendor/cache/rspec-support-3.4.1.gem
deleted file mode 100644
index 93873e3e..00000000
Binary files a/vendor/cache/rspec-support-3.4.1.gem and /dev/null differ
diff --git a/vendor/cache/rubocop-0.49.0.gem b/vendor/cache/rubocop-0.49.0.gem
deleted file mode 100644
index ad7fa4ca..00000000
Binary files a/vendor/cache/rubocop-0.49.0.gem and /dev/null differ
diff --git a/vendor/cache/ruby-progressbar-1.13.0.gem b/vendor/cache/ruby-progressbar-1.13.0.gem
deleted file mode 100644
index c50b94b2..00000000
Binary files a/vendor/cache/ruby-progressbar-1.13.0.gem and /dev/null differ
diff --git a/vendor/cache/rugged-0.27.5.gem b/vendor/cache/rugged-0.27.5.gem
deleted file mode 100644
index 79bb2eff..00000000
Binary files a/vendor/cache/rugged-0.27.5.gem and /dev/null differ
diff --git a/vendor/cache/rugged-1.7.2.gem b/vendor/cache/rugged-1.7.2.gem
deleted file mode 100644
index 5e4af1b1..00000000
Binary files a/vendor/cache/rugged-1.7.2.gem and /dev/null differ
diff --git a/vendor/cache/safe_yaml-1.0.4.gem b/vendor/cache/safe_yaml-1.0.4.gem
deleted file mode 100644
index 7da49f5e..00000000
Binary files a/vendor/cache/safe_yaml-1.0.4.gem and /dev/null differ
diff --git a/vendor/cache/scanf-1.0.0.gem b/vendor/cache/scanf-1.0.0.gem
deleted file mode 100644
index 39a1e821..00000000
Binary files a/vendor/cache/scanf-1.0.0.gem and /dev/null differ
diff --git a/vendor/cache/semantic_puppet-1.0.2.gem b/vendor/cache/semantic_puppet-1.0.2.gem
deleted file mode 100644
index 305b4e61..00000000
Binary files a/vendor/cache/semantic_puppet-1.0.2.gem and /dev/null differ
diff --git a/vendor/cache/simplecov-0.14.1.gem b/vendor/cache/simplecov-0.14.1.gem
deleted file mode 100644
index df5aa06d..00000000
Binary files a/vendor/cache/simplecov-0.14.1.gem and /dev/null differ
diff --git a/vendor/cache/simplecov-erb-0.1.1.gem b/vendor/cache/simplecov-erb-0.1.1.gem
deleted file mode 100644
index aaffcf1a..00000000
Binary files a/vendor/cache/simplecov-erb-0.1.1.gem and /dev/null differ
diff --git a/vendor/cache/simplecov-html-0.10.2.gem b/vendor/cache/simplecov-html-0.10.2.gem
deleted file mode 100644
index 363619b2..00000000
Binary files a/vendor/cache/simplecov-html-0.10.2.gem and /dev/null differ
diff --git a/vendor/cache/text-1.3.1.gem b/vendor/cache/text-1.3.1.gem
deleted file mode 100644
index 341f3455..00000000
Binary files a/vendor/cache/text-1.3.1.gem and /dev/null differ
diff --git a/vendor/cache/unicode-display_width-1.8.0.gem b/vendor/cache/unicode-display_width-1.8.0.gem
deleted file mode 100644
index 75166d4d..00000000
Binary files a/vendor/cache/unicode-display_width-1.8.0.gem and /dev/null differ