Class: Nifty::Events::Opennebula::ExpirationEvent

Inherits:
Event
  • Object
show all
Includes:
Utils::EventsCommon
Defined in:
lib/nifty/events/opennebula/expiration_event.rb

Overview

OpenNebula expiration event

Author:

  • Michal Kimle

Instance Attribute Summary collapse

Attributes inherited from Event

#client, #datastores, #parameters

Attributes inherited from Event

#appliance, #transfer_method

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Utils::EventsCommon

#expire_appliance, #groups

Constructor Details

#initialize(appliance, transfer_method, client, datastores, parameters) ⇒ ExpirationEvent

Returns a new instance of ExpirationEvent.



17
18
19
20
21
22
# File 'lib/nifty/events/opennebula/expiration_event.rb', line 17

def initialize(appliance, transfer_method, client, datastores, parameters)
  super(appliance, transfer_method, client, datastores, parameters)

  @image_handler = Nifty::Backends::Utils::Opennebula::ImageHandler.new(client)
  @template_handler = Nifty::Backends::Utils::Opennebula::TemplateHandler.new(client)
end

Instance Attribute Details

#image_handlerObject

Returns the value of attribute image_handler.



12
13
14
# File 'lib/nifty/events/opennebula/expiration_event.rb', line 12

def image_handler
  @image_handler
end

#template_handlerObject

Returns the value of attribute template_handler.



12
13
14
# File 'lib/nifty/events/opennebula/expiration_event.rb', line 12

def template_handler
  @template_handler
end

Class Method Details

.event?Boolean

Returns:

  • (Boolean)

See Also:

  • Event#event?


8
9
10
# File 'lib/nifty/events/opennebula/expiration_event.rb', line 8

def self.event?
  true
end

Instance Method Details

#runObject

See Also:



25
26
27
28
29
30
31
# File 'lib/nifty/events/opennebula/expiration_event.rb', line 25

def run
  logger.debug("Runnig event #{self.inspect}")

  expire_appliance(template_handler, image_handler, appliance, parameters)
rescue Nifty::Errors::Backends::OpennebulaError, Nifty::Errors::ApiCallTimeoutError => ex
  fail Nifty::Errors::Events::EventError, ex
end