deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "marios@redhat.com" <mandr...@redhat.com>
Subject Re: [PATCH core 2/6] CIMI: Minor cleanup in entity_metadata
Date Tue, 17 Jan 2012 15:58:26 GMT
ack

On 17/01/12 13:52, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mfojtik@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mfojtik@redhat.com>
> ---
>  server/lib/cimi/model/entity_metadata.rb |   18 +++++++++---------
>  1 files changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/server/lib/cimi/model/entity_metadata.rb b/server/lib/cimi/model/entity_metadata.rb
> index 922df1f..d6356f6 100644
> --- a/server/lib/cimi/model/entity_metadata.rb
> +++ b/server/lib/cimi/model/entity_metadata.rb
> @@ -40,20 +40,21 @@ text :type_uri
>      if id == :all
>        CIMI::Model.root_entities.each do |entity|
>          entity_class = CIMI::Model.const_get("#{entity.singularize}")
> -        entity_metadata << entity_class.create_entity_metadata(context) if entity_class.respond_to?("create_entity_metadata")
> +        entity_metadata << entity_class.create_entity_metadata(context) if entity_class.respond_to?(:create_entity_metadata)
>        end
>        return entity_metadata
>      else
>        entity_class = CIMI::Model.const_get("#{id.camelize}")
> -      entity_metadata << entity_class.create_entity_metadata(context) if entity_class.respond_to?("create_entity_metadata")
> -      return entity_metadata.first
> +      if entity_class.respond_to?(:create_entity_metadata)
> +        entity_class.create_entity_metadata(context)
> +      end
>      end
>    end
>  
>    def self.metadata_from_deltacloud_features(cimi_entity, dcloud_entity, context)
> -      deltacloud_features = context.driver.features(dcloud_entity)
> -      metadata_attributes = deltacloud_features.map{|f| attributes_from_feature(f)}
> -      from_feature(cimi_entity, context, metadata_attributes.flatten!)
> +    deltacloud_features = context.driver.features(dcloud_entity)
> +    metadata_attributes = deltacloud_features.map{|f| attributes_from_feature(f)}
> +    from_feature(cimi_entity, context, metadata_attributes.flatten!)
>    end
>  
>    def includes_attribute?(attribute)
> @@ -72,13 +73,12 @@ text :type_uri
>          :constraints=> (feature.constraints.empty? ? (feature.description.nil? ?
"" : feature.description): feature.constraints)
>        }
>      end
> -    attributes
>    end
>  
>    def self.from_feature(cimi_entity, context, metadata_attributes)
>      self.new(:name => cimi_entity, :uri=>"#{context.entity_metadata_url}/#{cimi_entity.underscore}",
> -            :type_uri=> context.send("#{cimi_entity.pluralize.underscore}_url"),
> -            :attributes => metadata_attributes   )
> +             :type_uri=> context.send("#{cimi_entity.pluralize.underscore}_url"),
> +             :attributes => metadata_attributes)
>    end
>  
>  end


Mime
View raw message