deltacloud-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@redhat.com
Subject [PATCH core] CIMI: Added 'created' attribute to MachineTemplate
Date Fri, 14 Dec 2012 12:21:31 GMT
From: Michal Fojtik <mfojtik@redhat.com>

- New dependency: dm-timestamps

Signed-off-by: Michal fojtik <mfojtik@redhat.com>
---
 server/deltacloud-core.gemspec             | 1 +
 server/lib/cimi/models/machine_template.rb | 1 +
 server/lib/db/entity.rb                    | 2 ++
 3 files changed, 4 insertions(+)

diff --git a/server/deltacloud-core.gemspec b/server/deltacloud-core.gemspec
index 1c36e2f..fccdaa8 100644
--- a/server/deltacloud-core.gemspec
+++ b/server/deltacloud-core.gemspec
@@ -80,6 +80,7 @@ Gem::Specification.new do |s|
 
   s.add_dependency('data_mapper')
   s.add_dependency('dm-sqlite-adapter')
+  s.add_dependency('dm-timestamps')
 
   # dependencies for various cloud providers:
 
diff --git a/server/lib/cimi/models/machine_template.rb b/server/lib/cimi/models/machine_template.rb
index 9d6dac4..f290ada 100644
--- a/server/lib/cimi/models/machine_template.rb
+++ b/server/lib/cimi/models/machine_template.rb
@@ -103,6 +103,7 @@ class CIMI::Model::MachineTemplate < CIMI::Model::Base
         :machine_config => { :href => model.machine_config },
         :machine_image => { :href => model.machine_image },
         :property => model.ent_properties,
+        :created => Time.parse(model.created_at.to_s).xmlschema,
         :operations => [
           { :href => context.destroy_machine_template_url(model.id), :rel => 'http://schemas.dmtf.org/cimi/1/action/delete'
}
         ]
diff --git a/server/lib/db/entity.rb b/server/lib/db/entity.rb
index c9845a4..2f2afd7 100644
--- a/server/lib/db/entity.rb
+++ b/server/lib/db/entity.rb
@@ -12,6 +12,8 @@ module Deltacloud
       property :be_kind, String, :required => true # => Machine, MachineImage, ...
       property :be_id, String, :required => true # => Original Machine 'id'
 
+      property :created_at, DateTime
+      property :updated_at, DateTime
     end
 
     class Entity < BaseEntity
-- 
1.8.0.2


Mime
View raw message