Alon Bar-Lev has uploaded a new change for review.

Change subject: packaging: pythonlib: service: improvements
......................................................................

packaging: pythonlib: service: improvements

1. support with x as.

2. support random directory.

3. allow wrapped directory retrieval via property.

Related-To: https://bugzilla.redhat.com/show_bug.cgi?id=1059480
Change-Id: I1144a58d98760168ed24a93daae225ba769f42b7
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/pythonlib/ovirt_engine/service.py
1 file changed, 9 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/78/23878/1

diff --git a/packaging/pythonlib/ovirt_engine/service.py 
b/packaging/pythonlib/ovirt_engine/service.py
index 0638363..e50af18 100644
--- a/packaging/pythonlib/ovirt_engine/service.py
+++ b/packaging/pythonlib/ovirt_engine/service.py
@@ -23,6 +23,7 @@
 import subprocess
 import sys
 import time
+import tempfile
 import resource
 import gettext
 _ = lambda m: gettext.dgettext(message=m, domain='ovirt-engine')
@@ -91,14 +92,20 @@
             pass
     """
 
+    @property
+    def directory(self):
+        return self._dir
+
     def _clear(self):
         self.logger.debug("removing directory '%s'", self._dir)
         if os.path.exists(self._dir):
             shutil.rmtree(self._dir)
 
-    def __init__(self, dir):
+    def __init__(self, dir=None):
         super(TempDir, self).__init__()
         self._dir = dir
+        if self._dir is None:
+            self._dir = tempfile.mkdtemp()
 
     def create(self):
         self._clear()
@@ -118,6 +125,7 @@
 
     def __enter__(self):
         self.create()
+        return self
 
     def __exit__(self, exc_type, exc_value, traceback):
         self.destroy()


-- 
To view, visit http://gerrit.ovirt.org/23878
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1144a58d98760168ed24a93daae225ba769f42b7
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: ovirt-engine-3.3
Gerrit-Owner: Alon Bar-Lev <alo...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to