Return-Path: X-Original-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-deltacloud-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7DE0A74F9 for ; Sat, 19 Nov 2011 18:06:11 +0000 (UTC) Received: (qmail 11035 invoked by uid 500); 19 Nov 2011 18:06:11 -0000 Delivered-To: apmail-incubator-deltacloud-dev-archive@incubator.apache.org Received: (qmail 11020 invoked by uid 500); 19 Nov 2011 18:06:11 -0000 Mailing-List: contact deltacloud-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: deltacloud-dev@incubator.apache.org Delivered-To: mailing list deltacloud-dev@incubator.apache.org Received: (qmail 11012 invoked by uid 99); 19 Nov 2011 18:06:11 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Nov 2011 18:06:11 +0000 X-ASF-Spam-Status: No, hits=0.3 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (athena.apache.org: transitioning domain of mi@mifo.sk does not designate 209.85.214.47 as permitted sender) Received: from [209.85.214.47] (HELO mail-bw0-f47.google.com) (209.85.214.47) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Nov 2011 18:06:06 +0000 Received: by bkbzs2 with SMTP id zs2so4662743bkb.6 for ; Sat, 19 Nov 2011 10:05:44 -0800 (PST) Received: by 10.204.38.16 with SMTP id z16mr8240062bkd.66.1321725944653; Sat, 19 Nov 2011 10:05:44 -0800 (PST) Received: from [192.168.1.141] ([109.81.43.141]) by mx.google.com with ESMTPS id k26sm9451145fab.8.2011.11.19.10.05.43 (version=SSLv3 cipher=OTHER); Sat, 19 Nov 2011 10:05:43 -0800 (PST) Message-ID: <4EC7EFF4.7020407@mifo.sk> Date: Sat, 19 Nov 2011 19:05:40 +0100 From: Michal Fojtik Reply-To: mi@mifo.sk User-Agent: Postbox 3.0.0 (Macintosh/20111031) MIME-Version: 1.0 To: deltacloud-dev@incubator.apache.org Subject: Re: [PATCH core 2/2] Core: Added support for dynamic provider list in /api/drivers/:id References: <1320939167-1056-1-git-send-email-mfojtik@redhat.com> <1320939167-1056-3-git-send-email-mfojtik@redhat.com> In-Reply-To: <1320939167-1056-3-git-send-email-mfojtik@redhat.com> X-Enigmail-Version: 1.2 OpenPGP: id=94153B98 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Ping. Anyone willing to review this? -- Michal mfojtik@redhat.com wrote: > From: Michal Fojtik > > > Signed-off-by: Michal fojtik --- > server/lib/deltacloud/base_driver/base_driver.rb | 1 + > server/lib/deltacloud/models.rb | 1 + > server/lib/deltacloud/models/provider.rb | 27 > ++++++++++++++++++++++ server/lib/deltacloud/server.rb > | 1 + server/views/drivers/show.xml.haml | 13 > +++++++--- 5 files changed, 39 insertions(+), 4 deletions(-) create > mode 100644 server/lib/deltacloud/models/provider.rb > > diff --git a/server/lib/deltacloud/base_driver/base_driver.rb > b/server/lib/deltacloud/base_driver/base_driver.rb index > 931ef5c..1aa68e1 100644 --- > a/server/lib/deltacloud/base_driver/base_driver.rb +++ > b/server/lib/deltacloud/base_driver/base_driver.rb @@ -155,6 +155,7 > @@ module Deltacloud # def delete_firewall(credentials, opts) # def > create_firewall_rule(credentials, opts) # def > delete_firewall_rule(credentials, opts) + # def > providers(credentials) def realm(credentials, opts) realms = > realms(credentials, opts).first if has_capability?(:realms) end diff > --git a/server/lib/deltacloud/models.rb > b/server/lib/deltacloud/models.rb index e8cd035..a794192 100644 --- > a/server/lib/deltacloud/models.rb +++ > b/server/lib/deltacloud/models.rb @@ -29,3 +29,4 @@ require > 'deltacloud/models/blob' require 'deltacloud/models/load_balancer' > require 'deltacloud/models/firewall' require > 'deltacloud/models/firewall_rule' +require > 'deltacloud/models/provider' diff --git > a/server/lib/deltacloud/models/provider.rb > b/server/lib/deltacloud/models/provider.rb new file mode 100644 index > 0000000..1fc2c7d --- /dev/null +++ > b/server/lib/deltacloud/models/provider.rb @@ -0,0 +1,27 @@ +# > Licensed to the Apache Software Foundation (ASF) under one or more +# > contributor license agreements. See the NOTICE file distributed > with +# this work for additional information regarding copyright > ownership. The +# ASF licenses this file to you under the Apache > License, Version 2.0 (the +# "License"); you may not use this file > except in compliance with the +# License. You may obtain a copy of > the License at +# +# > http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by > applicable law or agreed to in writing, software +# distributed under > the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES > OR CONDITIONS OF ANY KIND, either express or implied. See the +# > License for the specific language governing permissions and > limitations +# under the License. + +# Model to store the hardware > profile applied to an instance together with +# any instance-specific > overrides + +class Provider < BaseModel + attr_accessor :url + > attr_accessor :name + + def initialize(opts={}) + super(opts) + > end + +end diff --git a/server/lib/deltacloud/server.rb > b/server/lib/deltacloud/server.rb index 2a5d481..3124659 100644 --- > a/server/lib/deltacloud/server.rb +++ > b/server/lib/deltacloud/server.rb @@ -148,6 +148,7 @@ EOS param :id, > :string control do @name = params[:id].to_sym + @providers = > driver.providers(credentials) if driver.respond_to? :providers > @driver = settings.drivers[@name] return [404, "Driver #{@name} not > found"] unless @driver respond_to do |format| diff --git > a/server/views/drivers/show.xml.haml > b/server/views/drivers/show.xml.haml index ea5f508..3734c4d 100644 > --- a/server/views/drivers/show.xml.haml +++ > b/server/views/drivers/show.xml.haml @@ -1,7 +1,12 @@ %driver{ :href > => driver_url(@name), :id => @name } %name< = @driver[:name] - - > driver_provider(@driver).each do |prov, details| - %provider{ :id > => prov } - - details.each do |kind, url| - %entrypoint{ > :kind => kind }<=cdata(url) + - if @providers.nil? + - > driver_provider(@driver).each do |prov, details| + %provider{ > :id => prov } + - details.each do |kind, url| + > %entrypoint{ :kind => kind }<=cdata(url) + - else + - > @providers.each do |p| + %provider{ :id => p.id } + > %entrypoint{ :kind => p.name }<=p.url - -- - ---------------------------------------------------------------- Michal Fojtik deltacloud.org - Deltacloud API -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJOx+/zAAoJEBGIkweUFTuYAaIIAIrit0n/5qKd7zHjaJ0Q+ed6 9oYyCWRh5DiTzEAbZbfLRGqtHT4npbeX4vY1IT2pbxmNX7YI9T/vN+/tJEq1U1J5 nrwrLjK4XVRXDbMItNubYHiLR02MKIut65wwJtJHJ324JOmzUvyvVTa6AmP8tlw8 0YUp2eqlS1hHCaMxr0egagFnMlU4JqpC83hGe3m0+gEurxUAm+u6h+OHHnDZ1ddE vUxBKxBjTxhlI5dhFnxMYvoYgKzVuMBmtuTdO+YNLZTDbL+DG+RlhG0CEC7rENEl rZhGsa48A4kL1jacn9A7nl4L/FQhanVBJbXxp5OyR0TELrnZeSP80v/IMOJljhA= =tdC2 -----END PGP SIGNATURE-----