Class: HieraLoader
- Inherits:
-
Object
- Object
- HieraLoader
- Defined in:
- lib/hiera_loader.rb
Instance Attribute Summary collapse
-
#hiera ⇒ Object
Returns the value of attribute hiera.
-
#scope ⇒ Object
Returns the value of attribute scope.
Instance Method Summary collapse
- #get_config(key, is_required = true) ⇒ Object
-
#initialize(scope, config = 'hiera.yaml') ⇒ HieraLoader
constructor
A new instance of HieraLoader.
Constructor Details
#initialize(scope, config = 'hiera.yaml') ⇒ HieraLoader
Returns a new instance of HieraLoader.
21 22 23 24 |
# File 'lib/hiera_loader.rb', line 21 def initialize(scope, config = 'hiera.yaml') @hiera = Hiera.new(:config => config) @scope = scope end |
Instance Attribute Details
#hiera ⇒ Object
Returns the value of attribute hiera.
19 20 21 |
# File 'lib/hiera_loader.rb', line 19 def hiera @hiera end |
#scope ⇒ Object
Returns the value of attribute scope.
19 20 21 |
# File 'lib/hiera_loader.rb', line 19 def scope @scope end |
Instance Method Details
#get_config(key, is_required = true) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/hiera_loader.rb', line 26 def get_config(key, is_required=true) val = @hiera.lookup(key, nil, @scope) if is_required == true and !val puts "Required config #{key} not found. Please provide." raise "Required config #{key} not found. Please provide." end val end |