deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject git commit: cimi: don't depend on created to have a value as it's optional in cimi
Date Wed, 05 Dec 2012 06:19:00 GMT
Updated Branches:
  refs/heads/master 70a00e422 -> 5b8c5ddc5


cimi: don't depend on created to have a value as it's optional in cimi


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/5b8c5ddc
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/5b8c5ddc
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/5b8c5ddc

Branch: refs/heads/master
Commit: 5b8c5ddc578fe016cccc58b5d07811162753348f
Parents: 70a00e4
Author: Dies Koper <diesk@fast.au.fujitsu.com>
Authored: Wed Dec 5 13:52:43 2012 +0900
Committer: David Lutterkort <lutter@redhat.com>
Committed: Tue Dec 4 22:18:29 2012 -0800

----------------------------------------------------------------------
 server/lib/cimi/models/machine_volume.rb |    4 ++--
 server/lib/cimi/models/volume_image.rb   |    2 +-
 tests/cimi/part5_test.rb                 |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5b8c5ddc/server/lib/cimi/models/machine_volume.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/machine_volume.rb b/server/lib/cimi/models/machine_volume.rb
index bb6a8a1..7631138 100644
--- a/server/lib/cimi/models/machine_volume.rb
+++ b/server/lib/cimi/models/machine_volume.rb
@@ -31,7 +31,7 @@ class CIMI::Model::MachineVolume < CIMI::Model::Base
           :id => id,
           :name => vol.id,
           :description => "MachineVolume #{vol.id} for Machine #{instance_id}",
-          :created => Time.parse(vol.created).xmlschema,
+          :created => vol.created.nil? ? nil : Time.parse(vol.created).xmlschema,
           :initial_location => vol.device,
           :volume => {:href=>context.volume_url(vol.id)},
           :operations => [{:href=>id, :rel => "delete" }]
@@ -46,7 +46,7 @@ class CIMI::Model::MachineVolume < CIMI::Model::Base
         :id => id,
         :name => vol.id,
         :description => "MachineVolume #{vol.id} for Machine #{instance_id}",
-        :created => Time.parse(vol.created).xmlschema,
+        :created => vol.created.nil? ? nil : Time.parse(vol.created).xmlschema,
         :initial_location => vol.device,
         :volume => {:href=>context.volume_url(vol.id)},
         :operations => [{:href=>id, :rel => "delete" }]

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5b8c5ddc/server/lib/cimi/models/volume_image.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/models/volume_image.rb b/server/lib/cimi/models/volume_image.rb
index 3ca839e..29f8188 100644
--- a/server/lib/cimi/models/volume_image.rb
+++ b/server/lib/cimi/models/volume_image.rb
@@ -44,7 +44,7 @@ class CIMI::Model::VolumeImage < CIMI::Model::Base
     self.new( {
                :name => snapshot.id,
                :description => snapshot.id,
-               :created => Time.parse(snapshot.created).xmlschema,
+               :created => snapshot.created.nil? ? nil : Time.parse(snapshot.created).xmlschema,
                :id => context.volume_image_url(snapshot.id),
                :image_location => {:href=>context.volume_url(snapshot.storage_volume_id)},
                :bootable => "false"  #FIXME

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/5b8c5ddc/tests/cimi/part5_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/part5_test.rb b/tests/cimi/part5_test.rb
index 185668a..8742cbb 100644
--- a/tests/cimi/part5_test.rb
+++ b/tests/cimi/part5_test.rb
@@ -68,8 +68,8 @@ class ManipulateAMachine < CIMI::Test::Spec
    machine.id.must_include api.cep_url.gsub("cloudEntryPoint", "machines/")
   end
 
-  it "should have a valid creation time" do
-    Time.parse(machine.created.to_s()) < Time.now
+  it "should have a valid creation time if specified" do
+    Time.parse(machine.created.to_s()) < Time.now if machine.created
   end
 
   it "should have numerical values for memory and cpu" do


Mime
View raw message