Skip to content

Commit

Permalink
Ignore classifier_data hierarchies
Browse files Browse the repository at this point in the history
Signed-off-by: David Roetzel <david@roetzel.de>
  • Loading branch information
oneiros committed Dec 30, 2024
1 parent e3d54d4 commit bb16fdb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/models/hiera_data/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/files/puppet/environments/enterprise/hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
version: 5

hierarchy:
- name: Classifier Configuration Data
data_hash: classifier_data
9 changes: 9 additions & 0 deletions test/models/hiera_data/config_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit bb16fdb

Please sign in to comment.