deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@redhat.com
Subject [PATCH 5/6] CIMI deal with nilpointers in convert storage volumes (+swap volume=>device)
Date Fri, 23 Dec 2011 16:31:23 GMT
From: marios <marios@redhat.com>


Signed-off-by: marios <marios@redhat.com>
---
 server/lib/cimi/model/machine.rb |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/server/lib/cimi/model/machine.rb b/server/lib/cimi/model/machine.rb
index fddadd7..c55c4eb 100644
--- a/server/lib/cimi/model/machine.rb
+++ b/server/lib/cimi/model/machine.rb
@@ -219,8 +219,9 @@ class CIMI::Model::Machine < CIMI::Model::Base
   end
 
   def self.convert_storage_volumes(instance, context)
-    instance.storage_volumes.map{|vol| {:href=>context.volume_url(vol.values.first),
-                                       :attachment_point=>vol.keys.first} }
+    instance.storage_volumes ||= [] #deal with nilpointers
+    instance.storage_volumes.map{|vol| {:href=>context.volume_url(vol.keys.first),
+                                       :attachment_point=>vol.values.first} }
   end
 
 end
-- 
1.7.6.4


Mime
View raw message