Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B0EC9DAA6 for ; Mon, 24 Sep 2012 12:23:19 +0000 (UTC) Received: (qmail 60580 invoked by uid 500); 24 Sep 2012 12:23:19 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 60430 invoked by uid 500); 24 Sep 2012 12:23:19 -0000 Mailing-List: contact dev-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 dev@deltacloud.apache.org Received: (qmail 60413 invoked by uid 99); 24 Sep 2012 12:23:18 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Sep 2012 12:23:18 +0000 X-ASF-Spam-Status: No, hits=-5.0 required=5.0 tests=RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of mfojtik@redhat.com designates 209.132.183.28 as permitted sender) Received: from [209.132.183.28] (HELO mx1.redhat.com) (209.132.183.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 24 Sep 2012 12:23:12 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q8OCMpxg027700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Sep 2012 08:22:51 -0400 Received: from dhcp-29-121.brq.redhat.com (dhcp-29-121.brq.redhat.com [10.34.29.121]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q8OCMmFw015418 for ; Mon, 24 Sep 2012 08:22:50 -0400 From: mfojtik@redhat.com To: dev@deltacloud.apache.org Subject: [PATCH core 2/2] Various fixes in CIMI collections Date: Mon, 24 Sep 2012 14:23:39 +0200 Message-Id: <1348489419-63813-2-git-send-email-mfojtik@redhat.com> In-Reply-To: <1348489419-63813-1-git-send-email-mfojtik@redhat.com> References: <1348489419-63813-1-git-send-email-mfojtik@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-Virus-Checked: Checked by ClamAV on apache.org From: Michal Fojtik * Removed duplicated :id parameters used in some destroy operations * Added :id parameters to non-standard operations Signed-off-by: Michal fojtik --- server/lib/cimi/collections/machines.rb | 8 +++++++- server/lib/cimi/collections/network_ports.rb | 1 + server/lib/cimi/collections/networks.rb | 5 ++++- server/lib/cimi/collections/volumes.rb | 1 - 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/server/lib/cimi/collections/machines.rb b/server/lib/cimi/collections/machines.rb index 74a31dc..89806fa 100644 --- a/server/lib/cimi/collections/machines.rb +++ b/server/lib/cimi/collections/machines.rb @@ -62,7 +62,6 @@ module CIMI::Collections operation :destroy, :with_capability => :destroy_instance do description "Delete a specified machine." - param :id, :string, :required control do Machine.delete!(params[:id], self) no_content_with_status(200) @@ -71,6 +70,7 @@ module CIMI::Collections action :stop, :with_capability => :stop_instance do description "Stop specific machine." + param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("+json") @@ -87,6 +87,7 @@ module CIMI::Collections action :restart, :with_capability => :restart_instance do description "Start specific machine." + param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("+json") @@ -103,6 +104,7 @@ module CIMI::Collections action :start, :with_capability => :start_instance do description "Start specific machine." + param :id, :string, :required control do machine = Machine.find(params[:id], self) if request.content_type.end_with?("+json") @@ -119,6 +121,7 @@ module CIMI::Collections operation :disks, :with_capability => :hardware_profiles do description "Retrieve the Machine's DiskCollection" + param :id, :string, :required control do disks = DiskCollection.default(params[:id], self) respond_to do |format| @@ -130,6 +133,7 @@ module CIMI::Collections operation :volumes, :with_capability => :storage_volumes do description "Retrieve the Machine's MachineVolumeCollection" + param :id, :string, :required control do volumes = MachineVolumeCollection.default(params[:id], self) respond_to do |format| @@ -144,6 +148,7 @@ module CIMI::Collections #with inclusion/ommission of the volumes you want [att|det]ached action :attach_volume, :http_method => :put, :with_capability => :attach_storage_volume do description "Attach CIMI Volume(s) to a machine." + param :id, :string, :required control do if request.content_type.end_with?("+json") volumes_to_attach = Volume.find_to_attach_from_json(request.body.read, self) @@ -160,6 +165,7 @@ module CIMI::Collections action :detach_volume, :http_method => :put, :with_capability => :detach_storage_volume do description "Detach CIMI Volume(s) from a machine." + param :id, :string, :required control do if request.content_type.end_with?("+json") volumes_to_detach = Volume.find_to_attach_from_json(request.body.read, self) diff --git a/server/lib/cimi/collections/network_ports.rb b/server/lib/cimi/collections/network_ports.rb index ef6e240..e739f11 100644 --- a/server/lib/cimi/collections/network_ports.rb +++ b/server/lib/cimi/collections/network_ports.rb @@ -88,6 +88,7 @@ module CIMI::Collections action :stop, :with_capability => :stop_network_port do description "Stop specific NetworkPort." + param :id, :string, :required control do network_port = NetworkPort.find(params[:id], self) report_error(404) unless network_port diff --git a/server/lib/cimi/collections/networks.rb b/server/lib/cimi/collections/networks.rb index c11e188..1fac7ad 100644 --- a/server/lib/cimi/collections/networks.rb +++ b/server/lib/cimi/collections/networks.rb @@ -61,7 +61,6 @@ module CIMI::Collections operation :destroy, :with_capability => :delete_network do description "Delete a specified Network" - param :id, :string, :required control do Network.delete!(params[:id], self) no_content_with_status(200) @@ -70,6 +69,7 @@ module CIMI::Collections action :start, :with_capability => :start_network do description "Start specific network." + param :id, :string, :required control do network = Network.find(params[:id], self) report_error(404) unless network @@ -87,6 +87,7 @@ module CIMI::Collections action :stop, :with_capability => :stop_network do description "Stop specific network." + param :id, :string, :required control do network = Network.find(params[:id], self) report_error(404) unless network @@ -104,6 +105,7 @@ module CIMI::Collections action :suspend, :with_capability => :suspend_network do description "Suspend specific network." + param :id, :string, :required control do network = Network.find(params[:id], self) report_error(404) unless network @@ -121,6 +123,7 @@ module CIMI::Collections operation :network_ports, :with_capability => :network_ports do description "Retrieve the Network's NetworkPortCollection" + param :id, :string, :required control do network_ports = NetworkPortCollection.for_network(params[:id], self) respond_to do |format| diff --git a/server/lib/cimi/collections/volumes.rb b/server/lib/cimi/collections/volumes.rb index 80350de..0baea47 100644 --- a/server/lib/cimi/collections/volumes.rb +++ b/server/lib/cimi/collections/volumes.rb @@ -67,7 +67,6 @@ module CIMI::Collections operation :destroy do description "Delete a specified Volume" - param :id, :string, :required control do Volume.delete!(params[:id], self) no_content_with_status(200) -- 1.7.10.2