deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dko...@apache.org
Subject [2/3] git commit: CIMI: take entity start/stop/import/etc. action url from CEP
Date Tue, 16 Jul 2013 11:38:01 GMT
CIMI: take entity start/stop/import/etc. action url from CEP


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/11778909
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/11778909
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/11778909

Branch: refs/heads/master
Commit: 117789093a58583c8d804bceb74a56312ba9713d
Parents: 78ee64e
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Mon Jul 15 23:18:06 2013 +1000
Committer: Dies Koper <diesk@fast.au.fujitsu.com>
Committed: Tue Jul 16 21:06:05 2013 +1000

----------------------------------------------------------------------
 clients/cimi/lib/client.rb | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/11778909/clients/cimi/lib/client.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/client.rb b/clients/cimi/lib/client.rb
index 7a9ba60..f169b75 100644
--- a/clients/cimi/lib/client.rb
+++ b/clients/cimi/lib/client.rb
@@ -60,8 +60,10 @@ module CIMI
       def entity_action(entity_type, action, body, credentials, id=nil)
         entity_href = get_entity_collection_href(entity_type, credentials)
         raise RestClient::ResourceNotFound if not entity_href
-        url = id ? '%s/%s/%s' % [entity_href, id, action.to_s] : '%s/%s' % [entity_href,
action.to_s]
-        RestClient::Resource.new(url).post(body, auth_header(credentials).merge(:content_type
=> 'application/xml'))
+        url = id ? '%s/%s' % [entity_href, id] : '%s' % [entity_href]
+        response_xml = RestClient::Resource.new(url).get(auth_header(credentials))
+        op_url = XmlSimple.xml_in(response_xml)['operation'].find {|o| o['rel'] == "http://schemas.dmtf.org/cimi/1/action/#{action}"
}['href']
+        RestClient::Resource.new(op_url).post(body, auth_header(credentials).merge(:content_type
=> 'application/xml'))
       end
 
       def provider_header(credentials)


Mime
View raw message