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