Class: Cloudkeeper::One::Opennebula::TemplateHandler

Inherits:
ApplianceHandler show all
Defined in:
lib/cloudkeeper/one/opennebula/template_handler.rb

Constant Summary

Constants inherited from ApplianceHandler

ApplianceHandler::LEAVE_ID_AS_IS, ApplianceHandler::ONEADMIN_ID

Constants inherited from Handler

Handler::API_POLLING_WAIT

Constants included from Helper

Helper::ERRORS

Instance Attribute Summary

Attributes inherited from ApplianceHandler

#identifier

Attributes inherited from Handler

#client, #pool

Instance Method Summary collapse

Methods inherited from ApplianceHandler

#chgrp, #chmod, #delete, #find_by_appliance_id, #find_by_image_list_id, #update

Methods inherited from Handler

#exist?, #find_all, #find_by_id, #find_by_name, #find_one

Methods included from Helper

#decode_error, #handle_opennebula_error

Constructor Details

#initializeTemplateHandler

Returns a new instance of TemplateHandler.



5
6
7
8
# File 'lib/cloudkeeper/one/opennebula/template_handler.rb', line 5

def initialize
  super
  @pool = OpenNebula::TemplatePool.new client
end

Instance Method Details

#register(template_template, group) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/cloudkeeper/one/opennebula/template_handler.rb', line 10

def register(template_template, group)
  template_alloc = OpenNebula::Template.build_xml
  template = OpenNebula::Template.new(template_alloc, client)

  handle_opennebula_error { template.allocate template_template }

  chmod template, Cloudkeeper::One::Settings[:'appliances-permissions']
  chgrp template, group

  template
end