Sha256: ee7f5c02a8e8c9e4165bbfd3e1902de4bbc2357e9263d53f030a20e2b55f3051

Contents?: true

Size: 690 Bytes

Versions: 16

Compression:

Stored size: 690 Bytes

Contents

# @since 4.9.0
#
Puppet::Functions.create_function(:hocon_data) do
  unless Puppet.features.hocon?
    raise Puppet::DataBinding::LookupError, 'Lookup using Hocon data_hash function is not supported without hocon library'
  end

  require 'hocon'
  require 'hocon/config_error'

  dispatch :hocon_data do
    param 'Struct[{path=>String[1]}]', :options
    param 'Puppet::LookupContext', :context
  end

  def hocon_data(options, context)
    path = options['path']
    begin
      Hocon.parse(Puppet::FileSystem.read(path, :encoding => 'utf-8'))
    rescue Hocon::ConfigError => ex
      raise Puppet::DataBinding::LookupError, "Unable to parse (#{path}): #{ex.message}"
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
puppet-4.9.3 lib/puppet/functions/hocon_data.rb
puppet-4.9.3-x86-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.3-x64-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.3-universal-darwin lib/puppet/functions/hocon_data.rb
puppet-4.9.2 lib/puppet/functions/hocon_data.rb
puppet-4.9.2-x86-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.2-x64-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.2-universal-darwin lib/puppet/functions/hocon_data.rb
puppet-4.9.1 lib/puppet/functions/hocon_data.rb
puppet-4.9.1-x86-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.1-x64-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.1-universal-darwin lib/puppet/functions/hocon_data.rb
puppet-4.9.0 lib/puppet/functions/hocon_data.rb
puppet-4.9.0-x86-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.0-x64-mingw32 lib/puppet/functions/hocon_data.rb
puppet-4.9.0-universal-darwin lib/puppet/functions/hocon_data.rb