From 3761eedbbb9b6dfb6bffe9e392057fe30c18e352 Mon Sep 17 00:00:00 2001 From: David Roetzel Date: Mon, 30 Dec 2024 16:12:01 +0100 Subject: [PATCH 1/2] Ignore `classifier_data` hierarchies (#497) * Ignore `classifier_data` hierarchies Signed-off-by: David Roetzel * Fix test Signed-off-by: David Roetzel --------- Signed-off-by: David Roetzel --- app/models/hiera_data/config.rb | 12 +++++++----- .../files/puppet/environments/enterprise/hiera.yaml | 6 ++++++ test/models/environment_test.rb | 1 + test/models/hiera_data/config_test.rb | 9 +++++++++ 4 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 test/fixtures/files/puppet/environments/enterprise/hiera.yaml diff --git a/app/models/hiera_data/config.rb b/app/models/hiera_data/config.rb index 82128f8c..b4d57a94 100644 --- a/app/models/hiera_data/config.rb +++ b/app/models/hiera_data/config.rb @@ -29,11 +29,13 @@ def load_content end def initialize_hierarchies - @hierarchies = content['hierarchy'].map do |hierarchy| - Hierarchy.new( - raw_hash: content['defaults'].merge(hierarchy), - base_path: @base_path - ) + @hierarchies = content['hierarchy'].filter_map do |hierarchy| + unless hierarchy['data_hash'] == 'classifier_data' + Hierarchy.new( + raw_hash: content['defaults'].merge(hierarchy), + base_path: @base_path + ) + end end end end diff --git a/test/fixtures/files/puppet/environments/enterprise/hiera.yaml b/test/fixtures/files/puppet/environments/enterprise/hiera.yaml new file mode 100644 index 00000000..4791cccd --- /dev/null +++ b/test/fixtures/files/puppet/environments/enterprise/hiera.yaml @@ -0,0 +1,6 @@ +--- +version: 5 + +hierarchy: + - name: Classifier Configuration Data + data_hash: classifier_data diff --git a/test/models/environment_test.rb b/test/models/environment_test.rb index 367e6db2..effd3b1e 100644 --- a/test/models/environment_test.rb +++ b/test/models/environment_test.rb @@ -6,6 +6,7 @@ class EnvironmentTest < ActiveSupport::TestCase development dynamic_datadir empty_defaults + enterprise eyaml globs hdm diff --git a/test/models/hiera_data/config_test.rb b/test/models/hiera_data/config_test.rb index 6159dc71..83da58c9 100644 --- a/test/models/hiera_data/config_test.rb +++ b/test/models/hiera_data/config_test.rb @@ -70,5 +70,14 @@ def base_path Pathname.new(Rails.configuration.hdm["config_dir"]).join("environments", "empty_defaults") end end + + class ConfigWithClassifierDataHierarchyTest < ActiveSupport::TestCase + test "`classifier_data` hierarchy is being ignored" do + base_path = Pathname.new(Rails.configuration.hdm["config_dir"]).join("environments", "enterprise") + config = HieraData::Config.new(base_path.join("hiera.yaml")) + + assert_equal [], config.hierarchies + end + end end end From b3a7d13d515aeefad514db116920d146aa056f5a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 27 Jan 2025 13:33:52 +0000 Subject: [PATCH 2/2] build(deps): bump dependabot/fetch-metadata from 2.2.0 to 2.3.0 Bumps [dependabot/fetch-metadata](https://github.com/dependabot/fetch-metadata) from 2.2.0 to 2.3.0. - [Release notes](https://github.com/dependabot/fetch-metadata/releases) - [Commits](https://github.com/dependabot/fetch-metadata/compare/v2.2.0...v2.3.0) --- updated-dependencies: - dependency-name: dependabot/fetch-metadata dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4e14ca00..a4c3628b 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -86,7 +86,7 @@ jobs: steps: - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v2.2.0 + uses: dependabot/fetch-metadata@v2.3.0 with: github-token: '${{ secrets.GITHUB_TOKEN }}'