You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by mf...@redhat.com on 2012/12/05 18:06:19 UTC

[PATCH core 1/2] CIMI: Fix $select filter to undercore attributes (DTACLOUD-391)

From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/cimi/models/base.rb | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
index 2b13367..2988459 100644
--- a/server/lib/cimi/models/base.rb
+++ b/server/lib/cimi/models/base.rb
@@ -279,7 +279,8 @@ class CIMI::Model::Base < CIMI::Model::Resource
 
   def filter_attributes(attr_list)
     attrs = attr_list.inject({}) do |result, attr|
-      result[attr] = self.send(attr) if self.respond_to?(attr)
+      attr = attr.to_s.underscore
+      result[attr.to_sym] = self.send(attr) if self.respond_to?(attr)
       result
     end
     self.class.new(attrs)
-- 
1.8.0.1


Re: [PATCH core 1/2] CIMI: Fix $select filter to undercore attributes (DTACLOUD-391)

Posted by "marios@redhat.com" <ma...@redhat.com>.
ACK both - JIRA seems down for maintenance right now so can't
ACK/resolve the relevant tickets 391 and 388

marios

On 05/12/12 19:06, mfojtik@redhat.com wrote:
> From: Michal Fojtik <mf...@redhat.com>
> 
> 
> Signed-off-by: Michal fojtik <mf...@redhat.com>
> ---
>  server/lib/cimi/models/base.rb | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/server/lib/cimi/models/base.rb b/server/lib/cimi/models/base.rb
> index 2b13367..2988459 100644
> --- a/server/lib/cimi/models/base.rb
> +++ b/server/lib/cimi/models/base.rb
> @@ -279,7 +279,8 @@ class CIMI::Model::Base < CIMI::Model::Resource
>  
>    def filter_attributes(attr_list)
>      attrs = attr_list.inject({}) do |result, attr|
> -      result[attr] = self.send(attr) if self.respond_to?(attr)
> +      attr = attr.to_s.underscore
> +      result[attr.to_sym] = self.send(attr) if self.respond_to?(attr)
>        result
>      end
>      self.class.new(attrs)
> 


[PATCH core 2/2] SBC: Make sure the hwp_id is not Nil when creating new instance (DTACLOUD-388)

Posted by mf...@redhat.com.
From: Michal Fojtik <mf...@redhat.com>


Signed-off-by: Michal fojtik <mf...@redhat.com>
---
 server/lib/deltacloud/drivers/sbc/sbc_driver.rb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/server/lib/deltacloud/drivers/sbc/sbc_driver.rb b/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
index 2e09a15..c994064 100644
--- a/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
+++ b/server/lib/deltacloud/drivers/sbc/sbc_driver.rb
@@ -87,7 +87,11 @@ class SbcDriver < Deltacloud::BaseDriver
     # Map DeltaCloud keywords to SBC
     body['imageID'] = opts[:image_id]
     body['location'] = opts[:realm_id] || @last_image['location']
-    body['instanceType'] = opts[:hwp_id].gsub('-', '/') || @last_image['supportedInstanceTypes'][0]['id']
+    if opts[:hwp_id]
+      body['instanceType'] = opts[:hwp_id].gsub('-', '/')
+    else
+      body['instanceType'] = @last_image['supportedInstanceTypes'][0]['id']
+    end
 
     if not body['name']
       body['name'] = Time.now.to_i.to_s
-- 
1.8.0.1