1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #1078 from kliuchnikau/cloudstack_register_template

Cloudstack: added registerTemplate request
This commit is contained in:
bdorry 2012-08-10 07:18:48 -07:00
commit 354ac075d8
2 changed files with 39 additions and 1 deletions

View file

@ -120,6 +120,7 @@ module Fog
request :recover_virtual_machine
request :register_ssh_key_pair
request :register_user_keys
request :register_template
request :remove_from_load_balancer_rule
request :reset_password_for_virtual_machine
request :revoke_security_group_ingress
@ -364,7 +365,9 @@ module Fog
"domain" => "ROOT",
"domainid" => "6023b6fe-5bef-4358-bc76-9f4e75afa52f",
"isextractable" => true,
"checksum" => "905cec879afd9c9d22ecc8036131a180"}},
"checksum" => "905cec879afd9c9d22ecc8036131a180",
"hypervisor" => "Xen"
}},
:flavors => { flavor_id => {
"id" => flavor_id,
"name" => "Medium Instance",

View file

@ -0,0 +1,35 @@
module Fog
module Compute
class Cloudstack
class Real
# Registers an existing template into the cloud.
#
# {CloudStack API Reference}[http://download.cloud.com/releases/3.0.0/api_3.0.0/user/registerTemplate.html]
def register_template(options={})
options.merge!(
'command' => 'registerTemplate'
)
request(options)
end
end # Real
class Mock
def register_template(options={})
mock_template_id = self.data[:images].keys.first
registered_template = self.data[:images][mock_template_id]
{
'registertemplateresponse' =>
{
'count' => 1,
'template' => [registered_template]
}
}
end
end # Mock
end # Cloudstack
end # Compute
end #Fog