Return-Path: X-Original-To: apmail-deltacloud-commits-archive@www.apache.org Delivered-To: apmail-deltacloud-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7521310CC2 for ; Tue, 16 Jul 2013 11:38:03 +0000 (UTC) Received: (qmail 35446 invoked by uid 500); 16 Jul 2013 11:38:03 -0000 Delivered-To: apmail-deltacloud-commits-archive@deltacloud.apache.org Received: (qmail 35415 invoked by uid 500); 16 Jul 2013 11:38:01 -0000 Mailing-List: contact commits-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list commits@deltacloud.apache.org Received: (qmail 35398 invoked by uid 99); 16 Jul 2013 11:38:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Jul 2013 11:38:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id E9FC28A8FCA; Tue, 16 Jul 2013 11:38:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dkoper@apache.org To: commits@deltacloud.apache.org Date: Tue, 16 Jul 2013 11:38:02 -0000 Message-Id: In-Reply-To: <6c8bc18bf93940eea1488a5d61c3c373@git.apache.org> References: <6c8bc18bf93940eea1488a5d61c3c373@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [3/3] git commit: CIMI: allow 202 from system creation & machine deletion and fix copy & paste error in machine restart in client UI 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 Authored: Tue Jul 16 20:47:58 2013 +1000 Committer: Dies Koper 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