class Cloudkeeper::One::CoreConnector
Constants
- STATUS_CODES
Attributes
datastore_handler[R]
image_handler[R]
template_handler[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/cloudkeeper/one/core_connector.rb, line 24 def initialize super @image_handler = Cloudkeeper::One::Opennebula::ImageHandler.new @template_handler = Cloudkeeper::One::Opennebula::TemplateHandler.new @datastore_handler = Cloudkeeper::One::Opennebula::DatastoreHandler.new end
Public Instance Methods
add_appliance(appliance, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 42 def add_appliance(appliance, _call) logger.debug "Registering appliance #{appliance.identifier.inspect}" call_backend { register_or_update_appliance appliance } end
appliances(image_list_identifier, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 72 def appliances(image_list_identifier, _call) logger.debug "Retrieving appliances from image list #{image_list_identifier.image_list_identifier.inspect} " \ 'registered in OpenNebula' call_backend(use_return_value: true) { list_appliances(image_list_identifier.image_list_identifier).each } end
image_lists(_empty, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 67 def image_lists(_empty, _call) logger.debug 'Retrieving image lists registered in OpenNebula' call_backend(use_return_value: true) { list_image_lists.each } end
post_action(_empty, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 37 def post_action(_empty, _call) logger.debug 'Running \'post-action\'...' Google::Protobuf::Empty.new end
pre_action(_empty, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 32 def pre_action(_empty, _call) logger.debug 'Running \'pre-action\'...' Google::Protobuf::Empty.new end
remove_appliance(appliance, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 57 def remove_appliance(appliance, _call) logger.debug "Removing appliance #{appliance.identifier.inspect}" call_backend { discard_appliance appliance.identifier } end
remove_expired_appliances(_empty, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 78 def remove_expired_appliances(_empty, _call) logger.debug 'Removing expired appliances' call_backend { discard_expired } end
remove_image_list(image_list_identifier, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 62 def remove_image_list(image_list_identifier, _call) logger.debug "Removing appliances from image list #{image_list_identifier.image_list_identifier.inspect}" call_backend { discard_image_list image_list_identifier.image_list_identifier } end
update_appliance(appliance, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 47 def update_appliance(appliance, _call) logger.debug "Updating appliance #{appliance.identifier.inspect}" call_backend { register_or_update_appliance appliance } end
update_appliance_metadata(appliance, _call)
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 52 def update_appliance_metadata(appliance, _call) logger.debug "Updating appliance metadata of #{appliance.identifier.inspect}" call_backend { update_metadata appliance } end
Private Instance Methods
call_backend(use_return_value: false) { || ... }
click to toggle source
# File lib/cloudkeeper/one/core_connector.rb, line 86 def call_backend(use_return_value: false) raise Cloudkeeper::One::Errors::ArgumentError, 'Error handler was called without a block!' unless block_given? return_value = yield use_return_value ? return_value : Google::Protobuf::Empty.new rescue Cloudkeeper::One::Errors::StandardError => ex logger.error "#{ex.class.inspect}: #{ex.message}" raise GRPC::BadStatus.new(STATUS_CODES[ex.class], ex.message) end