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

Change subject: packaging: services: ovirt-engine: cleanup tmpdir usage
......................................................................

packaging: services: ovirt-engine: cleanup tmpdir usage

Change-Id: Id4af2c23ca669bea2d05a5e82f84aa20d84c9cf2
Signed-off-by: Alon Bar-Lev <alo...@redhat.com>
---
M packaging/services/ovirt-engine/ovirt-engine.py
1 file changed, 12 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/28/22828/1

diff --git a/packaging/services/ovirt-engine/ovirt-engine.py 
b/packaging/services/ovirt-engine/ovirt-engine.py
index 8e53194..a0fecea 100755
--- a/packaging/services/ovirt-engine/ovirt-engine.py
+++ b/packaging/services/ovirt-engine/ovirt-engine.py
@@ -39,6 +39,7 @@
 
     def __init__(self):
         super(Daemon, self).__init__()
+        self._tempDir = None
         self._defaults = os.path.abspath(
             os.path.join(
                 os.path.dirname(sys.argv[0]),
@@ -57,7 +58,7 @@
             f.write(str(Template(file=template, searchList=[self._config])))
         return out
 
-    def _linkModules(self, modulePath):
+    def _linkModules(self, directory, modulePath):
         """
         Link all the JBoss modules into a temporary directory.
         This required because jboss tries to automatically update
@@ -67,8 +68,7 @@
         modifiedModulePath = []
         for index, element in enumerate(modulePath.split(':')):
             modulesTmpDir = os.path.join(
-                self._config.get('ENGINE_TMP'),
-                'modules',
+                directory,
                 '%02d-%s' % (
                     index,
                     '-'.join(element.split(os.sep)[-2:]),
@@ -293,16 +293,20 @@
         self._setupEngineApps()
 
         jbossTempDir = os.path.join(
-            self._config.get('ENGINE_TMP'),
+            self._tempDir.directory,
             'tmp',
         )
 
         jbossConfigDir = os.path.join(
-            self._config.get('ENGINE_TMP'),
+            self._tempDir.directory,
             'config',
         )
 
         javaModulePath = self._linkModules(
+            os.path.join(
+                self._tempDir.directory,
+                'modules',
+            ),
             '%s:%s' % (
                 self._config.get('ENGINE_JAVA_MODULEPATH'),
                 os.path.join(
@@ -430,7 +434,7 @@
             'ENGINE_VARS': config.ENGINE_VARS,
             'ENGINE_ETC': self._config.get('ENGINE_ETC'),
             'ENGINE_LOG': self._config.get('ENGINE_LOG'),
-            'ENGINE_TMP': self._config.get('ENGINE_TMP'),
+            'ENGINE_TMP': self._tempDir.directory,
             'ENGINE_USR': self._config.get('ENGINE_USR'),
             'ENGINE_VAR': self._config.get('ENGINE_VAR'),
             'ENGINE_CACHE': self._config.get('ENGINE_CACHE'),
@@ -473,7 +477,8 @@
                 os.remove(self._config.get('ENGINE_UP_MARK'))
 
     def daemonCleanup(self):
-        self._tempDir.destroy()
+        if self._tempDir:
+            self._tempDir.destroy()
 
 
 if __name__ == '__main__':


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4af2c23ca669bea2d05a5e82f84aa20d84c9cf2
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
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