Skip to content

Commit 9adac7f

Browse files
committed
(PUP-11621) Remove Hiera 3 requirement
1 parent 5e6f1ea commit 9adac7f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

lib/hiera_puppet.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require 'hiera'
1+
Puppet.features.hiera?
22
require 'hiera/scope'
33
require_relative 'puppet'
44

lib/puppet/pops/lookup/hiera_config.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,9 @@ def name
282282
end
283283

284284
def create_hiera3_backend_provider(name, backend, parent_data_provider, datadir, paths, hiera3_config)
285-
# Custom backend. Hiera v3 must be installed, it's logger configured, and it must be made aware of the loaded config
286-
require 'hiera'
285+
# Custom backend. Hiera 3 must be installed, its logger configured, and it must be made aware of the loaded config
286+
raise Puppet::DataBinding::LookupError, 'Hiera 3 is not installed' if !Puppet.features.hiera?
287+
287288
if Hiera::Config.instance_variable_defined?(:@config) && (current_config = Hiera::Config.instance_variable_get(:@config)).is_a?(Hash)
288289
current_config.each_pair do |key, val|
289290
case key

0 commit comments

Comments
 (0)