Sha256: c650f093c1747adb1182beebc80800a4d23726bc94a478aa6319f88de45cc192
Contents?: true
Size: 1 KB
Versions: 12
Compression:
Stored size: 1 KB
Contents
# This file is loaded by the autoloader, and it does not find the data function support unless required relative # require 'yaml' require_relative 'hiera_interpolate' module Puppet::DataProviders class YamlDataProviderFactory < Puppet::Plugins::DataProviders::FileBasedDataProviderFactory def create(name, paths, parent_data_provider) YamlDataProvider.new(name, paths, parent_data_provider) end def path_extension '.yaml' end end class YamlDataProvider < Puppet::Plugins::DataProviders::PathBasedDataProvider include HieraInterpolate def initialize_data(path, lookup_invocation) HieraConfig.symkeys_to_string(YAML.load_file(path)) rescue YAML::SyntaxError => ex # Psych errors includes the absolute path to the file, so no need to add that # to the message raise Puppet::DataBinding::LookupError, "Unable to parse #{ex.message}" end def post_process(value, lookup_invocation) interpolate(value, lookup_invocation, true) end end end
Version data entries
12 entries across 12 versions & 1 rubygems