Sha256: 6ae5bc9e21d42d1a5899ad7e63de2ebc7364e9951036886df7ca1b3b59f08307

Contents?: true

Size: 542 Bytes

Versions: 6

Compression:

Stored size: 542 Bytes

Contents

require 'yaml'

module Puppet::Util::Yaml
  if defined?(::Psych::SyntaxError)
    YamlLoadExceptions = [::StandardError, ::Psych::SyntaxError]
  else
    YamlLoadExceptions = [::StandardError]
  end

  class YamlLoadError < Puppet::Error; end

  def self.load_file(filename)
    YAML.load_file(filename)
  rescue *YamlLoadExceptions => detail
    raise YamlLoadError.new(detail.message, detail)
  end

  def self.dump(structure, filename)
    Puppet::Util.replace_file(filename, 0660) do |fh|
      YAML.dump(structure, fh)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
puppet-3.4.0.rc1 lib/puppet/util/yaml.rb
puppet-3.3.2 lib/puppet/util/yaml.rb
puppet-3.3.1 lib/puppet/util/yaml.rb
puppet-3.3.1.rc3 lib/puppet/util/yaml.rb
puppet-3.3.1.rc2 lib/puppet/util/yaml.rb
puppet-3.3.1.rc1 lib/puppet/util/yaml.rb