deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [7/11] git commit: CIMI: Adds Network delete (+mock deltacloud mock driver method)
Date Wed, 11 Apr 2012 15:33:08 GMT
CIMI: Adds Network delete (+mock deltacloud mock driver method)


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

Branch: refs/heads/master
Commit: 2a47c78e76d2c2a333399b1e11e047df400b5d0e
Parents: 769051e
Author: marios <marios@redhat.com>
Authored: Fri Mar 30 15:33:52 2012 +0300
Committer: marios <marios@redhat.com>
Committed: Wed Apr 11 18:32:07 2012 +0300

----------------------------------------------------------------------
 server/lib/cimi/model/network.rb                   |    1 +
 server/lib/deltacloud/drivers/mock/mock_client.rb  |    5 +++++
 .../drivers/mock/mock_driver_cimi_methods.rb       |    5 +++++
 3 files changed, 11 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a47c78e/server/lib/cimi/model/network.rb
----------------------------------------------------------------------
diff --git a/server/lib/cimi/model/network.rb b/server/lib/cimi/model/network.rb
index 5d95919..8ecc8a1 100644
--- a/server/lib/cimi/model/network.rb
+++ b/server/lib/cimi/model/network.rb
@@ -69,6 +69,7 @@ class CIMI::Model::Network < CIMI::Model::Base
   end
 
   def self.delete!(id, context)
+    context.driver.delete_network(context.credentials, id)
   end
 
 #FIXME

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a47c78e/server/lib/deltacloud/drivers/mock/mock_client.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_client.rb b/server/lib/deltacloud/drivers/mock/mock_client.rb
index b27b84d..7d446db 100644
--- a/server/lib/deltacloud/drivers/mock/mock_client.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_client.rb
@@ -96,6 +96,11 @@ module Deltacloud::Drivers::Mock
       File::open(cimi_file(collection, obj["name"]), "w") { |f| f.write(JSON.generate(obj))
}
     end
 
+    def destroy_cimi(collection, id)
+      fname = cimi_file(collection, id)
+      FileUtils.rm(fname) if File::exists?(fname)
+    end
+
     def load_all_cimi(model_name)
         model_files = Dir[File::join(cimi_dir(model_name), "*.json")]
         model_files.map{|f| File.read(f)}

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/2a47c78e/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
----------------------------------------------------------------------
diff --git a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
index 1330d84..8ffaa23 100644
--- a/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
+++ b/server/lib/deltacloud/drivers/mock/mock_driver_cimi_methods.rb
@@ -53,6 +53,11 @@ module Deltacloud::Drivers::Mock
       CIMI::Model::Network.from_json(@client.load_cimi(:network, opts[:name]))
     end
 
+    def delete_network(credentials, id)
+      check_credentials(credentials)
+      @client.destroy_cimi(:network, id)
+    end
+
     def network_configurations(credentials, opts={})
       check_credentials(credentials)
       if opts[:id].nil?


Mime
View raw message