deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dko...@apache.org
Subject [3/3] git commit: CIMI: allow 202 from system creation & machine deletion and fix copy & paste error in machine restart in client UI
Date Tue, 16 Jul 2013 11:38:02 GMT
CIMI: allow 202 from system creation & machine deletion
and fix copy & paste error in machine restart in client UI


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

Branch: refs/heads/master
Commit: 625221771248c4e64fdbf9e53fb9f9a09ce7aa9f
Parents: 08d8de9
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Tue Jul 16 20:47:58 2013 +1000
Committer: Dies Koper <diesk@fast.au.fujitsu.com>
Committed: Tue Jul 16 21:06:06 2013 +1000

----------------------------------------------------------------------
 clients/cimi/lib/entities/machine.rb | 5 ++++-
 clients/cimi/lib/entities/system.rb  | 9 +++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/62522177/clients/cimi/lib/entities/machine.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/machine.rb b/clients/cimi/lib/entities/machine.rb
index 44e3b26..44d0283 100644
--- a/clients/cimi/lib/entities/machine.rb
+++ b/clients/cimi/lib/entities/machine.rb
@@ -58,6 +58,9 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
     if result.code == 200
       flash[:success] = "Machine '#{params[:id]}' was successfully destroyed."
       redirect '/cimi/machines'
+    elsif result.code == 202
+      flash[:success] = "Deletion of Machine '#{params[:id]}' was successfully initiated."
+      redirect '/cimi/machines'
     else
       flash[:error] = "Unable to destroy machine #{params[:id]}"
     end
@@ -91,7 +94,7 @@ class CIMI::Frontend::Machine < CIMI::Frontend::Entity
         xml.action "http://schemas.dmtf.org/cimi/1/action/restart"
       }
     end.to_xml
-    entity_action 'machines', 'restart', action_xml, credentials, action_xml
+    entity_action 'machines', 'restart', action_xml, credentials, params[:id]
     flash[:success] = "Machine successfully restarted."
     redirect '/cimi/machines/%s' % params[:id]
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/62522177/clients/cimi/lib/entities/system.rb
----------------------------------------------------------------------
diff --git a/clients/cimi/lib/entities/system.rb b/clients/cimi/lib/entities/system.rb
index 665fcfd..a15d222 100644
--- a/clients/cimi/lib/entities/system.rb
+++ b/clients/cimi/lib/entities/system.rb
@@ -175,9 +175,14 @@ class CIMI::Frontend::System < CIMI::Frontend::Entity
     end.to_xml
     begin
       result = create_entity('systems', system_xml, credentials)
-      system = collection_class_for(:system).from_xml(result)
       flash[:success] = "System create was successfully initiated."
-      redirect "/cimi/systems/#{href_to_id(system.id)}"
+      location = result.headers[:location]
+      if location
+        redirect "/cimi/systems/#{href_to_id location}"
+      else
+        system = collection_class_for(:system).from_xml(result)
+        redirect "/cimi/systems/#{href_to_id system.id}"
+      end
     rescue => e
       flash[:error] = "System cannot be created: #{e.message}"
     end


Mime
View raw message