module ErbHiera::Hiera

Public Class Methods

get_binding() click to toggle source
# File lib/erb-hiera/hiera.rb, line 47
def self.get_binding
  binding
end
hiera(key) click to toggle source
# File lib/erb-hiera/hiera.rb, line 5
def self.hiera(key)
  hiera = ::Hiera.new(:config => ErbHiera.options[:hiera_config])
  ::Hiera.logger = "noop"
  value = hiera.lookup(key, nil, ErbHiera.scope, nil, :priority)

  unless value
    puts "\nerror: cannot find value for key: #{key}"
    exit 1
  end

  puts "# #{key}: #{value}" if ErbHiera.options[:verbose]
  value
end
hiera_array(key) click to toggle source
# File lib/erb-hiera/hiera.rb, line 19
def self.hiera_array(key)
  hiera = ::Hiera.new(:config => ErbHiera.options[:hiera_config])
  ::Hiera.logger = "noop"
  value = hiera.lookup(key, nil, ErbHiera.scope, nil, :array)

  unless value
    puts "\nerror: cannot find value for key: #{key}"
    exit 1
  end

  puts "# #{key}: #{value}" if ErbHiera.options[:verbose]
  value
end
hiera_hash(key) click to toggle source
# File lib/erb-hiera/hiera.rb, line 33
def self.hiera_hash(key)
  hiera = ::Hiera.new(:config => ErbHiera.options[:hiera_config])
  ::Hiera.logger = "noop"
  value = hiera.lookup(key, nil, ErbHiera.scope, nil, :hash)

  unless value
    puts "\nerror: cannot find value for key: #{key}"
    exit 1
  end

  puts "# #{key}: #{value}" if ErbHiera.options[:verbose]
  value
end