[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [sandbox PATCH 2/3] Only create the destination path if it does not exist.



From: Dan Walsh <dwalsh redhat com>

OpenShift will be creating the path within its management layer.
---
 bin/virt-sandbox-service | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 31aa6a1..dd30993 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -272,7 +272,8 @@ class Container:
     def create(self):
         self.connect()
         self.config.set_shell(True)
-        os.mkdir(self.dest)
+        if not os.path.exists(self.dest):
+            os.mkdir(self.dest)
 
     def connect(self):
         if not self.conn:
@@ -331,6 +332,9 @@ class GenericContainer(Container):
         self.save_config()
 
     def create(self):
+        config_path = self.get_config_path()
+        if os.path.exists(config_path):
+            raise ValueError([_("%s already exists") % config_path ])
         try:
             self.create_generic()
         except Exception, e:
-- 
1.8.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]