Module: Cloudkeeper::One::ApplianceActions::Discard

Included in:
Registration, CoreConnector
Defined in:
lib/cloudkeeper/one/appliance_actions/discard.rb

Instance Method Summary collapse

Instance Method Details

#discard_appliance(appliance_id) ⇒ Object



5
6
7
8
9
10
# File 'lib/cloudkeeper/one/appliance_actions/discard.rb', line 5

def discard_appliance(appliance_id)
  logger.debug "Removing templates for appliance #{appliance_id.inspect}"
  discard_templates :find_by_appliance_id, appliance_id
  logger.debug "Removing images for appliance #{appliance_id.inspect}"
  discard_images :find_by_appliance_id, appliance_id
end

#discard_expiredObject



19
20
21
22
# File 'lib/cloudkeeper/one/appliance_actions/discard.rb', line 19

def discard_expired
  logger.debug 'Removing expired images...'
  handle_iteration(image_handler.expired) { |item| image_handler.delete item }
end

#discard_image_list(image_list_id) ⇒ Object



12
13
14
15
16
17
# File 'lib/cloudkeeper/one/appliance_actions/discard.rb', line 12

def discard_image_list(image_list_id)
  logger.debug "Removing templates for image list #{image_list_id.inspect}"
  discard_templates :find_by_image_list_id, image_list_id
  logger.debug "Removing images for image list #{image_list_id.inspect}"
  discard_images :find_by_image_list_id, image_list_id
end

#discard_images(method, value) ⇒ Object



28
29
30
31
32
33
# File 'lib/cloudkeeper/one/appliance_actions/discard.rb', line 28

def discard_images(method, value)
  handle_iteration(image_handler.send(method, value)) do |item|
    image_handler.expire item
    image_handler.delete item
  end
end

#discard_templates(method, value) ⇒ Object



24
25
26
# File 'lib/cloudkeeper/one/appliance_actions/discard.rb', line 24

def discard_templates(method, value)
  handle_iteration(template_handler.send(method, value)) { |item| template_handler.delete item }
end