Sha256: 5583b906cb2848bfd27d152266728bb41c997d81fc5374f2af2c5b686950b1b9
Contents?: true
Size: 827 Bytes
Versions: 14
Compression:
Stored size: 827 Bytes
Contents
# A Backend implementation capable of reading YAML syntax class Puppet::Pops::Binder::Hiera2::YamlBackend < Puppetx::Puppet::Hiera2Backend def read_data(module_dir, source) begin source_file = File.join(module_dir, "#{source}.yaml") # if file is present but empty or has only "---", YAML.load_file returns false, # in which case fall back to returning an empty hash YAML.load_file(source_file) || {} rescue TypeError => e # SafeYaml chokes when trying to load using utf-8 and the file is empty raise e if File.size?(source_file) {} rescue Errno::ENOTDIR # This is OK, the file doesn't need to be present. Return an empty hash {} rescue Errno::ENOENT # This is OK, the file doesn't need to be present. Return an empty hash {} end end end
Version data entries
14 entries across 14 versions & 1 rubygems