deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Lutterkort <lut...@redhat.com>
Subject Re: [PATCH core 1/3] CIMI: Fixed error when collection used as value for $select (DTACLOUD-432)
Date Sat, 26 Jan 2013 00:58:02 GMT
On Wed, 2013-01-23 at 16:51 +0100, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mfojtik@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> ---
>  server/lib/cimi/models/collection.rb | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/server/lib/cimi/models/collection.rb b/server/lib/cimi/models/collection.rb
> index 0f2a89e..aafa6a5 100644
> --- a/server/lib/cimi/models/collection.rb
> +++ b/server/lib/cimi/models/collection.rb
> @@ -24,11 +24,15 @@ module CIMI::Model
>      self.schema
>  
>      def initialize(values = {})
> -      if values[:entries]
> -        values[self.class.entry_name] = values.delete(:entries)
> +      if values.kind_of?(Hash) 
> +        if values[:entries]
> +          values[self.class.entry_name] = values.delete(:entries)
> +        end
> +        values[self.class.entry_name] ||= []
> +        super(values)
> +      else
> +        super

It would be good to add a comment what other objects, besides hashes can
be passed in here and why.

Also, this needs a test that verifies that issue 432 is really fixed.

NACK based on the missing test and the problems described in JIRA 432.

David



Mime
View raw message