Method: Puppet::Provider::ParsedFile.flush

Defined in:
lib/vendor/puppet/provider/parsedfile.rb

.flush(record) ⇒ Object

Flush all of the targets for which there are modified records. The only reason we pass a record here is so that we can add it to the stack if necessary – it’s passed from the instance calling ‘flush’.



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vendor/puppet/provider/parsedfile.rb', line 53

def self.flush(record)
  # Make sure this record is on the list to be flushed.
  unless record[:on_disk]
    record[:on_disk] = true
    @records << record

    # If we've just added the record, then make sure our
    # target will get flushed.
    modified(record[:target] || default_target)
  end

  return unless defined?(@modified) and ! @modified.empty?

  flushed = []
  @modified.sort { |a,b| a.to_s <=> b.to_s }.uniq.each do |target|
    Puppet.debug "Flushing #{@resource_type.name} provider target #{target}"
    flush_target(target)
    flushed << target
  end

  @modified.reject! { |t| flushed.include?(t) }
end