Class: Puppet::Transaction::Event
- Includes:
- Util::Logging, Util::Tagging
- Defined in:
- lib/vendor/puppet/transaction/event.rb
Overview
A simple struct for storing what happens on the system.
Constant Summary collapse
- ATTRIBUTES =
[:name, :resource, :property, :previous_value, :desired_value, :historical_value, :status, :message, :file, :line, :source_description, :audited]
- YAML_ATTRIBUTES =
%w{@audited @property @previous_value @desired_value @historical_value @message @name @status @time}
- EVENT_STATUSES =
%w{noop success failure audit}
Instance Attribute Summary collapse
-
#default_log_level ⇒ Object
readonly
Returns the value of attribute default_log_level.
-
#tags ⇒ Object
writeonly
Sets the attribute tags.
-
#time ⇒ Object
Returns the value of attribute time.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Event
constructor
A new instance of Event.
- #property=(prop) ⇒ Object
- #resource=(res) ⇒ Object
- #send_log ⇒ Object
- #status=(value) ⇒ Object
- #to_s ⇒ Object
- #to_yaml_properties ⇒ Object
Methods included from Util::Logging
#clear_deprecation_warnings, #deprecation_warning
Methods included from Util::Tagging
Constructor Details
Instance Attribute Details
#default_log_level ⇒ Object (readonly)
Returns the value of attribute default_log_level.
15 16 17 |
# File 'lib/vendor/puppet/transaction/event.rb', line 15 def default_log_level @default_log_level end |
#tags=(value) ⇒ Object (writeonly)
Sets the attribute tags
13 14 15 |
# File 'lib/vendor/puppet/transaction/event.rb', line 13 def (value) @tags = value end |
#time ⇒ Object
Returns the value of attribute time.
14 15 16 |
# File 'lib/vendor/puppet/transaction/event.rb', line 14 def time @time end |
Instance Method Details
#property=(prop) ⇒ Object
26 27 28 |
# File 'lib/vendor/puppet/transaction/event.rb', line 26 def property=(prop) @property = prop.to_s end |
#resource=(res) ⇒ Object
30 31 32 33 34 35 |
# File 'lib/vendor/puppet/transaction/event.rb', line 30 def resource=(res) if res.respond_to?(:[]) and level = res[:loglevel] @default_log_level = level end @resource = res.to_s end |
#send_log ⇒ Object
37 38 39 |
# File 'lib/vendor/puppet/transaction/event.rb', line 37 def send_log super(log_level, ) end |
#status=(value) ⇒ Object
41 42 43 44 |
# File 'lib/vendor/puppet/transaction/event.rb', line 41 def status=(value) raise ArgumentError, "Event status can only be #{EVENT_STATUSES.join(', ')}" unless EVENT_STATUSES.include?(value) @status = value end |
#to_s ⇒ Object
46 47 48 |
# File 'lib/vendor/puppet/transaction/event.rb', line 46 def to_s end |
#to_yaml_properties ⇒ Object
50 51 52 |
# File 'lib/vendor/puppet/transaction/event.rb', line 50 def to_yaml_properties YAML_ATTRIBUTES & instance_variables end |