Yedidyah Bar David has uploaded a new change for review.

Change subject: packaging: setup: partial cleanup - db only
......................................................................

packaging: setup: partial cleanup - db only

Before this change, if during cleanup the user only asked to delete
only the database, then ran setup again, setup wrongly identified
the system as being legacy 3.2 and tried to upgrade, which failed.

This change makes the setup code in such a situation continue as a
new setup. Some existing configuration will be used (by existing code,
not in this change).

Bug-Url: https://bugzilla.redhat.com/987939
Change-Id: Id9aa1791eb7ccdbc8c679e72ed6eaa4f72ac29c6
Signed-off-by: Yedidyah Bar David <d...@redhat.com>
---
M packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
1 file changed, 15 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/89/19689/1

diff --git a/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py 
b/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
index 201d7a4..4b6b4dc 100644
--- a/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
+++ b/packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
@@ -76,16 +76,22 @@
                                 osetupcons.DBEnv.PASSWORD: d[4],
                                 osetupcons.DBEnv.NEW_DATABASE: False,
                             })
-                            dbovirtutils = database.OvirtUtils(plugin=self)
-                            dbovirtutils.tryDatabaseConnect()
-                            if dbovirtutils.isNewDatabase():
-                                raise RuntimeError(
-                                    _(
-                                        'Unexpected empty database '
-                                        'during upgrade'
-                                    )
-                                )
                             break
 
+        try:
+            dbovirtutils = database.OvirtUtils(plugin=self)
+            dbovirtutils.tryDatabaseConnect(environment=environment)
+            if dbovirtutils.isNewDatabase():
+                raise
+        except:
+            self.logger.debug(
+                'Database connection failed while trying to upgrade from '
+                'legacy, continuing as a new setup'
+            )
+            self.environment[osetupcons.CoreEnv.UPGRADE_FROM_LEGACY] = False
+            self.environment[
+                osetupcons.CoreEnv.ACTION
+            ] = osetupcons.Const.ACTION_SETUP
+
 
 # vim: expandtab tabstop=4 shiftwidth=4


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9aa1791eb7ccdbc8c679e72ed6eaa4f72ac29c6
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