Class: Itchy::EventHandlers::AvailablePostfixEventHandler
- Inherits:
-
BaseEventHandler
- Object
- BaseEventHandler
- Itchy::EventHandlers::AvailablePostfixEventHandler
- Defined in:
- lib/itchy/event_handlers/available_postfix_event_handler.rb
Overview
Handler for AvailablePostfix event (image available).
Constant Summary
Constants inherited from BaseEventHandler
BaseEventHandler::EVENT_FILE_REGEXP, BaseEventHandler::TEMPFILE_BASE
Instance Attribute Summary
Attributes inherited from BaseEventHandler
#options, #vmcatcher_configuration
Instance Method Summary collapse
-
#handle!(vmcatcher_event, event_name) ⇒ Object
Handles an AvailablePostfix event.
Methods inherited from BaseEventHandler
#archive!, #initialize, #save_descriptor, #set_file_permissions
Constructor Details
This class inherits a constructor from Itchy::EventHandlers::BaseEventHandler
Instance Method Details
#handle!(vmcatcher_event, event_name) ⇒ Object
Handles an AvailablePostfix event.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/itchy/event_handlers/available_postfix_event_handler.rb', line 8 def handle!(vmcatcher_event, event_name) super Itchy::Log.info "[#{self.class.name}] Handling updated image " \ "for #{vmcatcher_event.dc_identifier.inspect}" begin image_transformer_instance = Itchy::ImageTransformer.new(@options) new_file_name = image_transformer_instance.transform!(vmcatcher_event, vmcatcher_configuration) save_descriptor(create_descriptor(vmcatcher_event, new_file_name), event_name) # file permissions for image (File.join(@options.output_dir, new_file_name)) rescue Itchy::Errors::PrepareEnvError, ArgumentError, Itchy::Errors::ImageTransformationError => ex Itchy::Log.error "[#{self.class.name}] Problem with handling event #{event_name}" \ "Event handling failed with #{ex.}" fail Itchy::Errors::EventHandleError, ex end end |