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

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



From: Dan Walsh <dwalsh redhat com>

If a user specifies a path that already exists, we should just
use the path.
---
 bin/virt-sandbox-service | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bin/virt-sandbox-service b/bin/virt-sandbox-service
index 6524a05..308b871 100755
--- a/bin/virt-sandbox-service
+++ b/bin/virt-sandbox-service
@@ -258,7 +258,8 @@ class Container:
 
     def create(self):
         self.connect()
-        os.mkdir(self.dest)
+        if not os.path.exists(self.dest):
+            os.mkdir(self.dest)
 
     def connect(self):
         if not self.conn:
-- 
1.8.2


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