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

Change subject: packaging: setup: do not use with tarfile
......................................................................

packaging: setup: do not use with tarfile

unsupported in python-2.6.

Change-Id: Icc11922f13e858455f04a7f06895041b1243a339
Signed-off-by: Alon Bar-Lev <[email protected]>
---
M packaging/setup/plugins/ovirt-engine-remove/config/ca.py
1 file changed, 11 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/03/16103/1

diff --git a/packaging/setup/plugins/ovirt-engine-remove/config/ca.py 
b/packaging/setup/plugins/ovirt-engine-remove/config/ca.py
index c7b4896..f2badd5 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/config/ca.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/config/ca.py
@@ -76,16 +76,22 @@
         os.fchmod(fd, 0o600)
         with os.fdopen(fd, 'wb') as fileobj:
             #fileobj is not closed, when TarFile is closed
-            with tarfile.open(
-                mode='w:gz',
-                fileobj=fileobj
-            ) as f:
+            # cannot use with tarfile.open() <python-2.7
+            tar = None
+            try:
+                tar = tarfile.open(
+                    mode='w:gz',
+                    fileobj=fileobj
+                )
                 for n in (
                     osetupcons.FileLocations.OVIRT_ENGINE_SERVICE_CONFIG_PKI,
                     osetupcons.FileLocations.OVIRT_ENGINE_PKIDIR,
                 ):
                     if os.path.exists(n):
-                        f.add(n)
+                        tar.add(n)
+            finally:
+                if tar is not None:
+                    tar.close()
 
     @plugin.event(
         stage=plugin.Stages.STAGE_CLOSEUP,


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc11922f13e858455f04a7f06895041b1243a339
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alon Bar-Lev <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to