Sha256: 5370c2f9cb45743b5d63f87e70d6bf751531253f0943647fbbf5cdd63bd089c8

Contents?: true

Size: 1019 Bytes

Versions: 100

Compression:

Stored size: 1019 Bytes

Contents

require 'puppet/transaction/report'
require 'puppet/indirector/yaml'

class Puppet::Transaction::Report::Yaml < Puppet::Indirector::Yaml
  include Puppet::Util::SymbolicFileMode

  desc "Store last report as a flat file, serialized using YAML."

  # Force report to be saved there
  def path(name,ext='.yaml')
    Puppet[:lastrunreport]
  end

  def save(request)
    filename = path(request.key)
    mode = Puppet.settings.setting(:lastrunreport).mode

    unless valid_symbolic_mode?(mode)
      raise Puppet::DevError, _("replace_file mode: %{mode} is invalid") % { mode: mode }
    end

    mode = symbolic_mode_to_int(normalize_symbolic_mode(mode))

    FileUtils.mkdir_p(File.dirname(filename))

    begin
      Puppet::FileSystem.replace_file(filename, mode) do |fh|
        fh.print YAML.dump(request.instance)
      end
    rescue TypeError => detail
      Puppet.err _("Could not save %{indirection} %{request}: %{detail}") % { indirection: self.name, request: request.key, detail: detail }
    end
  end
end

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
puppet-6.29.0 lib/puppet/indirector/report/yaml.rb
puppet-6.29.0-x86-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.29.0-x64-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.29.0-universal-darwin lib/puppet/indirector/report/yaml.rb
puppet-6.28.0 lib/puppet/indirector/report/yaml.rb
puppet-6.28.0-x86-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.28.0-x64-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.28.0-universal-darwin lib/puppet/indirector/report/yaml.rb
puppet-6.27.0 lib/puppet/indirector/report/yaml.rb
puppet-6.27.0-x86-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.27.0-x64-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.27.0-universal-darwin lib/puppet/indirector/report/yaml.rb
puppet-6.26.0 lib/puppet/indirector/report/yaml.rb
puppet-6.26.0-x86-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.26.0-x64-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.26.0-universal-darwin lib/puppet/indirector/report/yaml.rb
puppet-6.25.1 lib/puppet/indirector/report/yaml.rb
puppet-6.25.1-x86-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.25.1-x64-mingw32 lib/puppet/indirector/report/yaml.rb
puppet-6.25.1-universal-darwin lib/puppet/indirector/report/yaml.rb