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

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

 



From: Dan Walsh <dwalsh@xxxxxxxxxx>

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]