mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
- make tags model to use post_undeploy_vapp
- fix syntax error in post_undeploy_vapp method - remove post_vm_metadata
This commit is contained in:
parent
ed54f452ef
commit
d5dadbca74
4 changed files with 9 additions and 48 deletions
|
@ -223,7 +223,6 @@ module Fog
|
||||||
request :post_upgrade_hw_version
|
request :post_upgrade_hw_version
|
||||||
request :post_upload_media
|
request :post_upload_media
|
||||||
request :post_upload_vapp_template
|
request :post_upload_vapp_template
|
||||||
request :post_vm_metadata # deprecated
|
|
||||||
request :put_catalog_item_metadata_item_metadata
|
request :put_catalog_item_metadata_item_metadata
|
||||||
request :put_cpu
|
request :put_cpu
|
||||||
request :put_disk_metadata_item_metadata
|
request :put_disk_metadata_item_metadata
|
||||||
|
|
|
@ -14,16 +14,13 @@ module Fog
|
||||||
get(tag_name)
|
get(tag_name)
|
||||||
end
|
end
|
||||||
|
|
||||||
def create(key,value)
|
def get_by_id(item_id)
|
||||||
item_list unless @tags
|
item_list unless @items
|
||||||
metadata_klass = case service.api_version
|
@items.detect{ |i| i[:id] == item_id}
|
||||||
when '5.1' ; Fog::Generators::Compute::VcloudDirector::MetadataV51
|
|
||||||
when '1.5' ; Fog::Generators::Compute::VcloudDirector::MetadataV15
|
|
||||||
else raise "API version: #{api_version} not supported"
|
|
||||||
end
|
end
|
||||||
data = metadata_klass.new(@tags)
|
|
||||||
data.add_item(key, value)
|
def create(key,value)
|
||||||
response = service.post_vapp_metadata_item_metadata(vm.id, data.attrs)
|
response = service.post_update_vapp_metadata(vm.id, { key => value} )
|
||||||
service.process_task(response.body)
|
service.process_task(response.body)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -32,7 +29,7 @@ module Fog
|
||||||
@tags[:metadata]
|
@tags[:metadata]
|
||||||
end
|
end
|
||||||
|
|
||||||
# private
|
private
|
||||||
|
|
||||||
def item_list
|
def item_list
|
||||||
@items =[]
|
@items =[]
|
||||||
|
@ -40,11 +37,6 @@ module Fog
|
||||||
@items
|
@items
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_by_id(item_id)
|
|
||||||
item_list unless @items
|
|
||||||
@items.detect{ |i| i[:id] == item_id}
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -37,7 +37,7 @@ module Fog
|
||||||
:xmlns => 'http://www.vmware.com/vcloud/v1.5'
|
:xmlns => 'http://www.vmware.com/vcloud/v1.5'
|
||||||
}
|
}
|
||||||
UndeployVAppParams(attrs) {
|
UndeployVAppParams(attrs) {
|
||||||
if options.key?[:UndeployPowerAction]
|
if options[:UndeployPowerAction]
|
||||||
UndeployPowerAction options[:UndeployPowerAction]
|
UndeployPowerAction options[:UndeployPowerAction]
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
module Fog
|
|
||||||
module Compute
|
|
||||||
class VcloudDirector
|
|
||||||
class Real
|
|
||||||
require 'fog/vcloud_director/generators/compute/metadata'
|
|
||||||
|
|
||||||
# @deprecated Use {#post_update_vapp_metadata} instead.
|
|
||||||
def post_vm_metadata(vm_id, metadata={})
|
|
||||||
Fog::Logger.deprecation("#{self} => ##{post_vm_metadata} is deprecated, use ##{post_update_vapp_metadata} instead [light_black](#{caller.first})[/]")
|
|
||||||
|
|
||||||
metadata_klass = case api_version
|
|
||||||
when '5.1' ; Fog::Generators::Compute::VcloudDirector::MetadataV51
|
|
||||||
when '1.5' ; Fog::Generators::Compute::VcloudDirector::MetadataV15
|
|
||||||
else raise "API version: #{api_version} not supported"
|
|
||||||
end
|
|
||||||
data = metadata_klass.new(metadata)
|
|
||||||
|
|
||||||
request(
|
|
||||||
:body => data.generate_xml,
|
|
||||||
:expects => 202,
|
|
||||||
:headers => {'Content-Type' => 'application/vnd.vmware.vcloud.metadata+xml'},
|
|
||||||
:method => 'POST',
|
|
||||||
:parser => Fog::ToHashDocument.new,
|
|
||||||
:path => "vApp/#{vm_id}/metadata/"
|
|
||||||
)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
Reference in a new issue