Module: Yutani::Hiera
Defined Under Namespace
Classes: NonExistentKeyException
Class Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Class Attribute Details
.hiera(config_override = {}) ⇒ Object
Returns the value of attribute hiera.
17
18
19
|
# File 'lib/yutani/hiera.rb', line 17
def hiera
@hiera
end
|
.scopes ⇒ Object
Returns the value of attribute scopes.
17
18
19
|
# File 'lib/yutani/hiera.rb', line 17
def scopes
@scopes
end
|
Class Method Details
.init_hiera(override = {}) ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/yutani/hiera.rb', line 38
def init_hiera(override={})
conf = Yutani.config(override)
::Hiera.new(config:
conf.fetch('hiera_config_file', conf['hiera_config'])
)
end
|
.lookup(k) ⇒ Object
47
48
49
50
51
52
53
54
55
56
|
# File 'lib/yutani/hiera.rb', line 47
def lookup(k)
v = hiera.lookup(k.to_s, nil, scope)
raise NonExistentKeyException.new(v) if v.nil?
Yutani::Utils.convert_nested_hash_to_indifferent_access(v)
end
|
.pop ⇒ Object
30
31
32
|
# File 'lib/yutani/hiera.rb', line 30
def pop
@scopes.pop
end
|
.push(kv) ⇒ Object
23
24
25
26
27
28
|
# File 'lib/yutani/hiera.rb', line 23
def push(kv)
@scopes.push Yutani::Utils.convert_symbols_to_strings_in_flat_hash(kv)
Yutani.logger.debug "hiera scope: %s" % scope
end
|
.scope ⇒ Object
19
20
21
|
# File 'lib/yutani/hiera.rb', line 19
def scope
@scopes.inject({}){|h,scope| h.merge(scope) }
end
|
Instance Method Details
#hiera(k) ⇒ Object
12
13
14
|
# File 'lib/yutani/hiera.rb', line 12
def hiera(k)
Hiera.lookup(k)
end
|