mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[vcloud|compute] Fix setting of description.
This commit is contained in:
parent
a84a145829
commit
9aeeb5abe1
4 changed files with 57 additions and 1 deletions
|
@ -153,6 +153,16 @@ module Fog
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def description=(description)
|
||||||
|
@description_changed = true unless attributes[:description] == description || attributes[:description] == nil
|
||||||
|
attributes[:description] = description
|
||||||
|
end
|
||||||
|
|
||||||
|
def name=(name)
|
||||||
|
@name_changed = true unless attributes[:name] == name || attributes[:name] == nil
|
||||||
|
attributes[:name] = name
|
||||||
|
end
|
||||||
|
|
||||||
def reload
|
def reload
|
||||||
reset_tracking
|
reset_tracking
|
||||||
super
|
super
|
||||||
|
@ -184,7 +194,11 @@ module Fog
|
||||||
data << @add_disk
|
data << @add_disk
|
||||||
connection.configure_vm_disks(vm_href, data)
|
connection.configure_vm_disks(vm_href, data)
|
||||||
end
|
end
|
||||||
#connection.configure_vapp( href, _compose_vapp_data )
|
if @name_changed || @description_changed
|
||||||
|
edit_uri = links.select {|i| i[:rel] == 'edit'}
|
||||||
|
edit_uri = edit_uri.kind_of?(Array) ? edit_uri.flatten[0][:href] : edit_uri[:href]
|
||||||
|
connection.configure_vm_name_description(edit_uri, self.name, self.description)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
reset_tracking
|
reset_tracking
|
||||||
true
|
true
|
||||||
|
@ -216,6 +230,8 @@ module Fog
|
||||||
@disk_change = false
|
@disk_change = false
|
||||||
@changed = false
|
@changed = false
|
||||||
@update_memory_value = nil
|
@update_memory_value = nil
|
||||||
|
@name_changed = false
|
||||||
|
@description_changed = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
def _compose_vapp_data
|
def _compose_vapp_data
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
module Fog
|
||||||
|
module Vcloud
|
||||||
|
class Compute
|
||||||
|
class Real
|
||||||
|
|
||||||
|
def configure_vm_name_description(edit_href, name, description)
|
||||||
|
|
||||||
|
body = <<EOF
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<VApp xmlns="http://www.vmware.com/vcloud/v1" name="#{name}" type="application/vnd.vmware.vcloud.vApp+xml">
|
||||||
|
<Description>#{description}</Description>
|
||||||
|
</VApp>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
request(
|
||||||
|
:body => body,
|
||||||
|
:expects => 202,
|
||||||
|
:headers => {'Content-Type' => "application/vnd.vmware.vcloud.vApp+xml"},
|
||||||
|
:method => 'PUT',
|
||||||
|
:uri => edit_href,
|
||||||
|
:parse => true
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -90,6 +90,7 @@ module Fog
|
||||||
request :configure_network_ip
|
request :configure_network_ip
|
||||||
request :configure_vapp
|
request :configure_vapp
|
||||||
request :configure_vm_memory
|
request :configure_vm_memory
|
||||||
|
request :configure_vm_name_description
|
||||||
request :configure_vm_disks
|
request :configure_vm_disks
|
||||||
request :delete_vapp
|
request :delete_vapp
|
||||||
request :get_catalog
|
request :get_catalog
|
||||||
|
|
|
@ -17,6 +17,15 @@ Shindo.tests("Vcloud::Compute | servers", ['vcloud']) do
|
||||||
@svr.on?
|
@svr.on?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
tests("#svr.description(\"testing\")").returns("testing") do
|
||||||
|
pending if Fog.mocking?
|
||||||
|
@svr.wait_for { ready? }
|
||||||
|
@svr.description = "testing"
|
||||||
|
@svr.save
|
||||||
|
@svr.wait_for { ready? }
|
||||||
|
@svr.description
|
||||||
|
end
|
||||||
|
|
||||||
# Power off only stops the OS, doesn't free up resources. #undeploy is for this.
|
# Power off only stops the OS, doesn't free up resources. #undeploy is for this.
|
||||||
tests("#svr.undeploy()").returns(true) do
|
tests("#svr.undeploy()").returns(true) do
|
||||||
pending if Fog.mocking?
|
pending if Fog.mocking?
|
||||||
|
|
Loading…
Add table
Reference in a new issue