Class: Coral::PuppetEvent
- Defined in:
- lib/coral_core/event/puppet_event.rb
Constant Summary collapse
- TYPE =
Properties
:puppet
Instance Attribute Summary
Attributes inherited from Event
Attributes inherited from Core
Instance Method Summary collapse
-
#check(source) ⇒ Object
—————————————————————————– Event handling.
-
#element ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#element=(element) ⇒ Object
—.
-
#export ⇒ Object
—————————————————————————– Import / Export.
-
#initialize(options = {}) ⇒ PuppetEvent
constructor
—————————————————————————– Constructor / Destructor.
-
#message ⇒ Object
–.
-
#message=(message) ⇒ Object
—.
-
#operation ⇒ Object
—.
-
#operation=(operation) ⇒ Object
—.
Methods inherited from Event
build_info, build_info!, create, instance, instance!, #property, #set_properties, #set_property, split_event_string, #type
Methods inherited from Core
#inspect, logger, #logger, logger=, ui
Methods inherited from Config
#[], #[]=, array, #array, #clear, #defaults, #delete, ensure, filter, #filter, #get, #get_array, #get_hash, hash, #hash, #import, #init, init, init_flat, #set, string, #string, string_map, #string_map, #symbol, symbol, #symbol_map, symbol_map, test, #test
Methods included from Mixin::ConfigOptions
#clear_options, #contexts, #get_options, #set_options
Methods included from Mixin::ConfigCollection
#all_properties, #clear_properties, #delete_property, #get_property, #save_properties, #set_property
Methods included from Mixin::Lookup
#hiera, #hiera_config, #initialized?, #lookup, #lookup_array, #lookup_hash, #normalize
Methods included from Mixin::ConfigOps
Constructor Details
#initialize(options = {}) ⇒ PuppetEvent
Constructor / Destructor
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/coral_core/event/puppet_event.rb', line 12 def initialize( = {}) [:type] = TYPE super() if .has_key?(:string) items = [:string].split(':') self.element = items[0] self.operation = items[1] self. = items[2] end end |
Instance Method Details
#check(source) ⇒ Object
Event handling
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/coral_core/event/puppet_event.rb', line 72 def check(source) if source.match(/notice:\s+(.+?):\s+(.+)\s*/i) source_element = $1 source_operation = '' = $2 source_elements = source_element.split('/') source_operation = source_elements.pop.strip unless source_elements.last.match(/[\[\]]/) if source_operation source_element = source_elements.join('/').strip logger.debug("#{source_element} includes: #{element} -- " + ( source_element.include?(element) ? 'true' : 'false' )) logger.debug("#{source_operation} is: #{operation} -- " + ( source_operation == operation ? 'true' : 'false' )) logger.debug("#{} includes: #{} -- " + ( .include?() ? 'true' : 'false' )) if source_element.include?(element) && source_operation == operation && .include?() logger.debug("MATCH! -> #{element} - #{operation} - #{}") return true end end end logger.debug("nothing -> #{element} - #{operation} - #{}") return false end |
#element ⇒ Object
Property accessors / modifiers
28 29 30 |
# File 'lib/coral_core/event/puppet_event.rb', line 28 def element return property(:element, '', :string) end |
#element=(element) ⇒ Object
34 35 36 |
# File 'lib/coral_core/event/puppet_event.rb', line 34 def element=element set_property(:element, string(element)) end |
#export ⇒ Object
Import / Export
65 66 67 |
# File 'lib/coral_core/event/puppet_event.rb', line 65 def export return "#{type}:#{element}:#{operation}:#{}" end |
#message ⇒ Object
–
52 53 54 |
# File 'lib/coral_core/event/puppet_event.rb', line 52 def return property(:message, '', :string) end |
#message=(message) ⇒ Object
58 59 60 |
# File 'lib/coral_core/event/puppet_event.rb', line 58 def set_property(:message, string()) end |
#operation ⇒ Object
40 41 42 |
# File 'lib/coral_core/event/puppet_event.rb', line 40 def operation return property(:operation, '', :string) end |
#operation=(operation) ⇒ Object
46 47 48 |
# File 'lib/coral_core/event/puppet_event.rb', line 46 def operation=operation set_property(:operation, string(operation)) end |