Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: Rename /etc/sysconfig/ovirt-engine
......................................................................

packaging: setup: Rename /etc/sysconfig/ovirt-engine

During upgrade, after updating packages, we rename
/etc/sysconfig/ovirt-engine.rpmsave to /etc/sysconfig/ovirt-engine,
for preparation to a rollback if it's needed.

This change renames it back during closeup, after the transaction is
committed and we know we won't need it anymore.

Change-Id: Icab6f89ac0346db08591c8ede7a3bf68abeb8c40
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
1 file changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/60/18760/1

diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py 
b/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
index 8e00e93..7e40b99 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/config.py
@@ -125,6 +125,9 @@
         legacy_rpmsave = legacy + '.rpmsave'
         legacy_confd = legacy + '.d'
 
+        # yum update renamed it. Here we rename back, so that if a failure
+        # causes a rollback to previous packages, the conf file will already
+        # be in place.
         if os.path.exists(legacy_rpmsave) and not os.path.exists(legacy):
             os.rename(legacy_rpmsave, legacy)
 
@@ -146,5 +149,19 @@
                         )
                     )
 
+    @plugin.event(
+        stage=plugin.Stages.STAGE_CLOSEUP,
+        condition=lambda self: self.environment[
+            osetupcons.CoreEnv.UPGRADE_FROM_LEGACY
+        ],
+    )
+    def _closeup(self):
+        legacy = osetupcons.FileLocations.LEGACY_OVIRT_ENGINE_SYSCONFIG
+        legacy_rpmsave = legacy + '.rpmsave'
+
+        # Here we don't need it anymore, and rename back
+        if os.path.exists(legacy) and not os.path.exists(legacy_rpmsave):
+            os.rename(legacy, legacy_rpmsave)
+
 
 # vim: expandtab tabstop=4 shiftwidth=4


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Icab6f89ac0346db08591c8ede7a3bf68abeb8c40
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <d...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to