Sha256: 8bc5b83d005f89aa6d7208d846fefcaa7aee2d03ccc029cc7cb3aa29007da65d

Contents?: true

Size: 799 Bytes

Versions: 30

Compression:

Stored size: 799 Bytes

Contents

require 'puppet/indirector/terminus'

class Puppet::Indirector::Hiera < Puppet::Indirector::Terminus
  def initialize(*args)
    if ! Puppet.features.hiera?
      raise "Hiera terminus not supported without hiera library"
    end
    super
  end

  def find(request)
    hiera.lookup(request.key, nil, request.options[:variables], nil, nil)
  end

  private

  def self.hiera_config
    hiera_config = Puppet.settings[:hiera_config]
    config = {}

    if File.exist?(hiera_config)
      config = Hiera::Config.load(hiera_config)
    else
      Puppet.warning "Config file #{hiera_config} not found, using Hiera defaults"
    end

    config[:logger] = 'puppet'
    config
  end

  def self.hiera
    @hiera ||= Hiera.new(:config => hiera_config)
  end

  def hiera
    self.class.hiera
  end
end

Version data entries

30 entries across 30 versions & 2 rubygems

Version Path
puppet-3.3.2 lib/puppet/indirector/hiera.rb
puppet-3.3.1 lib/puppet/indirector/hiera.rb
puppet-3.3.1.rc3 lib/puppet/indirector/hiera.rb
puppet-3.3.1.rc2 lib/puppet/indirector/hiera.rb
puppet-3.3.1.rc1 lib/puppet/indirector/hiera.rb
puppet-3.3.0 lib/puppet/indirector/hiera.rb
puppet-3.3.0.rc3 lib/puppet/indirector/hiera.rb
puppet-3.3.0.rc2 lib/puppet/indirector/hiera.rb
puppet-3.2.4 lib/puppet/indirector/hiera.rb
puppet-3.2.3 lib/puppet/indirector/hiera.rb
puppet-3.2.3.rc1 lib/puppet/indirector/hiera.rb
puppet-3.2.2 lib/puppet/indirector/hiera.rb
puppet-3.2.1 lib/puppet/indirector/hiera.rb
puppet-3.2.1.rc1 lib/puppet/indirector/hiera.rb
puppet-3.2.0.rc2 lib/puppet/indirector/hiera.rb
librarian-puppet-0.9.9 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/indirector/hiera.rb
puppet-3.2.0.rc1 lib/puppet/indirector/hiera.rb
puppet-3.1.1 lib/puppet/indirector/hiera.rb
librarian-puppet-0.9.8 vendor/gems/ruby/1.9.1/gems/puppet-3.1.0/lib/puppet/indirector/hiera.rb
puppet-3.1.0 lib/puppet/indirector/hiera.rb