class Berta::EntityHandler
Class for handeling entities in OpenNebula
Attributes
email[R]
handle[R]
id[R]
name[R]
type[R]
Public Class Methods
new(handle)
click to toggle source
# File lib/berta/entity_handler.rb, line 6 def initialize(handle) @handle = handle @type = handle.class.name.split('::').last @name = handle['NAME'] @email = handle['TEMPLATE/EMAIL'] @id = handle['ID'] end
Public Instance Methods
notify(vms)
click to toggle source
# File lib/berta/entity_handler.rb, line 14 def notify(vms) notification = Berta::Notification.new(name, email, type) to_notify = vms.keep_if(&:should_notify?) if to_notify.empty? logger.debug { "No notifications for #{type} #{name} with id #{id}" } return end notification.notify(to_notify) to_notify.each(&:update_notified) rescue Berta::Errors::Entities::NoEmailError logger.debug { "#{type} #{id} has no email, skipping" } end