incubator-deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Lalancette <clala...@redhat.com>
Subject Re: [PATCH core] Added OPTIONS call to get all constraints associated to parameters for given operation in collection
Date Thu, 23 Jun 2011 14:56:47 GMT
On 06/21/11 - 01:59:10PM, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mfojtik@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mfojtik@redhat.com>

I took a quick look at this.  Overall, the code looks sane (though see a couple
of minor nits below).  What I'm wondering about is how useful this will be to
clients.  At the moment I don't see condor/libdeltacloud using this as the
only constraint we are interested in (user_name max_length) can be fetched via
api -> instance link -> feature name='user_name' -> constraint.  While this
patch gives a more full range of parameters, I don't know how clients would use
it exactly.

> ---
>  server/lib/sinatra/rabbit.rb          |    7 ++++++-
>  server/views/api/constraints.xml.haml |   24 ++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 1 deletions(-)
>  create mode 100644 server/views/api/constraints.xml.haml
> 
> diff --git a/server/lib/sinatra/rabbit.rb b/server/lib/sinatra/rabbit.rb
> index 5c1d757..007ba2f 100644
> --- a/server/lib/sinatra/rabbit.rb
> +++ b/server/lib/sinatra/rabbit.rb
> @@ -221,7 +221,12 @@ module Sinatra
>          ::Sinatra::Application.options("#{Sinatra::UrlForHelper::DEFAULT_URI_PREFIX}/#{name}")
do
>            operations_allowed = current_collection.operations.collect { |o| o[0] }.join(',')
>            headers 'X-Operations-Allowed' => operations_allowed
> -          [200, '']
> +          @collection = current_collection
> +          @operations = @collection.operations
> +          @features = driver.features(@collection.name)
> +          respond_to do |format|
> +            format.xml { haml :'api/constraints'}
> +          end
>          end
>        end

A couple of nits here.
1)  Would we want to add an HTML/JSON output?
2)  This code looks very similar to the next function (generate_documentation).
Maybe we can have a common function that can do both?  (not a huge deal, but
I did notice the redundancy)

-- 
Chris Lalancette

Mime
View raw message