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

adding metadata support for vapp too

This commit is contained in:
Rodrigo Estebanez 2013-08-26 16:57:58 +02:00
parent b9159ed569
commit 30adc65597
7 changed files with 15 additions and 9 deletions

View file

@ -95,10 +95,10 @@ module Fog
request :put_vm_disks
request :get_vm_network
request :put_vm_network
request :get_vm_metadata
request :get_metadata
request :post_vm_metadata
request :put_vm_metadata_value
request :delete_vm_metadata
request :put_metadata_value
request :delete_metadata
request :post_vm_poweron
request :get_request
request :get_href

View file

@ -15,14 +15,14 @@ module Fog
not_first_set = !value.nil?
attributes[:value] = new_value
if not_first_set && has_changed
response = service.put_vm_metadata_value(vm.id, id, value)
response = service.put_metadata_value(vm.id, id, value)
service.process_task(response.body)
end
end
def destroy
response = service.delete_vm_metadata(vm.id, id)
response = service.delete_metadata(vm.id, id)
service.process_task(response.body)
end

View file

@ -38,7 +38,7 @@ module Fog
# private
def item_list
@tags = service.get_vm_metadata(vm.id).body
@tags = service.get_metadata(vm.id).body
@items =[]
@tags[:metadata].each_pair{ |k,v| @items << {:id => k, :value => v }.merge(:vm => vm) }
@items

View file

@ -26,6 +26,12 @@ module Fog
service.vms(:vapp => self)
end
def tags
requires :id
service.tags(:vm => self)
end
end
end
end

View file

@ -3,7 +3,7 @@ module Fog
class Vcloudng
class Real
def delete_vm_metadata(vm_id, metadata_key)
def delete_metadata(vm_id, metadata_key)
require 'fog/vcloudng/parsers/compute/metadata'
request(

View file

@ -3,7 +3,7 @@ module Fog
class Vcloudng
class Real
def get_vm_metadata(vm_id)
def get_metadata(vm_id)
require 'fog/vcloudng/parsers/compute/metadata'
request(

View file

@ -3,7 +3,7 @@ module Fog
class Vcloudng
class Real
def put_vm_metadata_value(vm_id, metadata_key, metadata_value)
def put_metadata_value(vm_id, metadata_key, metadata_value)
body="
<MetadataValue xmlns=\"http://www.vmware.com/vcloud/v1.5\">
<Value>#{metadata_value}</Value>