Sandro Bonazzola has uploaded a new change for review.

Change subject: packaging: setup: fixed uninstall files handling
......................................................................

packaging: setup: fixed uninstall files handling

- don't fail if we have empty uninstall file during cleanup
- avoid to write an empty uninstall file while aborting setup

Change-Id: Icc0135799f939327ec90adeafba67d47002c800a
Signed-off-by: Sandro Bonazzola <sbona...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-remove/files/simple.py
M packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
2 files changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/21/15121/1

diff --git a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py 
b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
index f3cf9da..1ddf8e8 100644
--- a/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
+++ b/packaging/setup/plugins/ovirt-engine-remove/files/simple.py
@@ -205,7 +205,8 @@
                     self._lines.update(
                         getLines(uninstall_section)
                     )
-            unremovable.update(getFiles('unremovable'))
+            if config.has_section('unremovable'):
+                unremovable.update(getFiles('unremovable'))
 
         self._toremove = set(self._files.keys()) - set(unremovable.keys())
         self._tomodifylines = self._lines.keys()
diff --git a/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py 
b/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
index 016575f..3023cc4 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/core/uninstall.py
@@ -234,8 +234,10 @@
         )
         if not os.path.exists(os.path.dirname(output)):
             os.makedirs(os.path.dirname(output))
-        with open(output, 'w') as f:
-            config.write(f)
+        if config.sections():
+            #avoid to create empty uninstall files
+            with open(output, 'w') as f:
+                config.write(f)
 
 
 # vim: expandtab tabstop=4 shiftwidth=4


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icc0135799f939327ec90adeafba67d47002c800a
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Sandro Bonazzola <sbona...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to