Class: Nucleon::Event::Puppet
- Inherits:
-
Object
- Object
- Nucleon::Event::Puppet
- Defined in:
- lib/nucleon/event/puppet.rb
Instance Method Summary collapse
-
#check(source) ⇒ Object
—.
-
#element(default = '') ⇒ Object
—————————————————————————– Property accessors / modifiers.
-
#element=(element) ⇒ Object
—.
-
#message(default = '') ⇒ Object
–.
-
#message=(message) ⇒ Object
—.
-
#normalize(reload) ⇒ Object
—————————————————————————– Puppet event interface.
-
#operation(default = '') ⇒ Object
—.
-
#operation=(operation) ⇒ Object
—.
-
#render ⇒ Object
—————————————————————————– Operations.
Instance Method Details
#check(source) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/nucleon/event/puppet.rb', line 66 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 success = ( source_element.include?(element) && source_operation == operation && .include?() ) logger.debug("Checking puppet event with source #{source_element} #{source_operation} #{}: #{success.inspect}") return success else logger.warn("Can not check puppet event because it is missing an operation") end end return false end |
#element(default = '') ⇒ Object
Property accessors / modifiers
23 24 25 |
# File 'lib/nucleon/event/puppet.rb', line 23 def element(default = '') return get(:element, default, :string) end |
#element=(element) ⇒ Object
29 30 31 |
# File 'lib/nucleon/event/puppet.rb', line 29 def element=element set(:element, string(element)) end |
#message(default = '') ⇒ Object
–
47 48 49 |
# File 'lib/nucleon/event/puppet.rb', line 47 def (default = '') return get(:message, default, :string) end |
#message=(message) ⇒ Object
53 54 55 |
# File 'lib/nucleon/event/puppet.rb', line 53 def set(:message, string()) end |
#normalize(reload) ⇒ Object
Puppet event interface
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nucleon/event/puppet.rb', line 9 def normalize(reload) super if get(:string) items = string(delete(:string)).split(':') myself.element = items[0] myself.operation = items[1] myself. = items[2] end end |
#operation(default = '') ⇒ Object
35 36 37 |
# File 'lib/nucleon/event/puppet.rb', line 35 def operation(default = '') return get(:operation, default, :string) end |
#operation=(operation) ⇒ Object
41 42 43 |
# File 'lib/nucleon/event/puppet.rb', line 41 def operation=operation set(:operation, string(operation)) end |
#render ⇒ Object
Operations
60 61 62 |
# File 'lib/nucleon/event/puppet.rb', line 60 def render return "#{name}:#{element}:#{operation}:#{}" end |