incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1147069 - /incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
Date Fri, 15 Jul 2011 09:54:49 GMT
Author: mfojtik
Date: Fri Jul 15 09:54:49 2011
New Revision: 1147069

URL: http://svn.apache.org/viewvc?rev=1147069&view=rev
Log:
Create MAPPER_STORAGE_ROOT for VSphere driver when this directory doesn't exists.

Modified:
    incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb

Modified: incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb?rev=1147069&r1=1147068&r2=1147069&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb (original)
+++ incubator/deltacloud/trunk/server/lib/deltacloud/drivers/vsphere/vsphere_driver.rb Fri
Jul 15 09:54:49 2011
@@ -299,6 +299,7 @@ module Deltacloud::Drivers::VSphere
     end
 
     def map_task_to_instance(task_key, new_instance)
+      FileUtils::mkdir_p(MAPPER_STORAGE_ROOT) unless File::directory?(MAPPER_STORAGE_ROOT)
       File::open(File::join(MAPPER_STORAGE_ROOT, task_key), "w") do |f|
         f.puts(YAML::dump(new_instance))
       end
@@ -311,6 +312,7 @@ module Deltacloud::Drivers::VSphere
 
     # Yield all tasks if they are included in mapper storage directory.
     def stored_tasks(vsphere)
+      FileUtils::mkdir_p(MAPPER_STORAGE_ROOT) unless File::directory?(MAPPER_STORAGE_ROOT)
       tasks = Dir[File::join(MAPPER_STORAGE_ROOT, '*')].collect { |file| File::basename(file)
}
       vsphere.serviceInstance.content.taskManager.recentTask.each do |task|
         if tasks.include?(task.info.key)



Mime
View raw message