class Transaction::Event

A simple struct for storing what happens on the system.

Constants

ATTRIBUTES
EVENT_STATUSES
YAML_ATTRIBUTES

Attributes

default_log_level[R]
tags[W]
time[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/puppet/transaction/event.rb, line 21
def initialize(options = {})
  @audited = false
  set_options(options)
  @time = Time.now
end

Public Instance Methods

property=(prop) click to toggle source
# File lib/puppet/transaction/event.rb, line 27
def property=(prop)
  @property = prop.to_s
end
resource=(res) click to toggle source
# File lib/puppet/transaction/event.rb, line 31
def resource=(res)
  begin
    # In Ruby 1.8 looking up a symbol on a string gives nil; in 1.9 it will
    # raise a TypeError, which we then catch.  This should work on both
    # versions, for all that it is a bit naff. --daniel 2012-03-11
    if res.respond_to?(:[]) and level = res[:loglevel]
      @default_log_level = level
    end
  rescue TypeError => e
    raise unless e.to_s == "can't convert Symbol into Integer"
  end
  @resource = res.to_s
end
send_log() click to toggle source
Calls superclass method Puppet::Util::Logging#send_log
# File lib/puppet/transaction/event.rb, line 45
def send_log
  super(log_level, message)
end
status=(value) click to toggle source
# File lib/puppet/transaction/event.rb, line 49
def status=(value)
  raise ArgumentError, "Event status can only be #{EVENT_STATUSES.join(', ')}" unless EVENT_STATUSES.include?(value)
  @status = value
end
to_s() click to toggle source
# File lib/puppet/transaction/event.rb, line 54
def to_s
  message
end
to_yaml_properties() click to toggle source
# File lib/puppet/transaction/event.rb, line 58
def to_yaml_properties
  YAML_ATTRIBUTES & instance_variables
end