Alon Bar-Lev has posted comments on this change.
Change subject: packaging: setup: partial cleanup - db only
......................................................................
Patch Set 2:
(5 comments)
....................................................
File packaging/setup/plugins/ovirt-engine-setup/core/misc.py
Line 82: if (
Line 83: self.environment[osetupcons.DBEnv.NEW_DATABASE] and
Line 84: self.environment[
Line 85: osetupcons.CoreEnv.ACTION
Line 86: ] == osetupcons.Const.ACTION_UPGRADE
we can drop this condition, and relay only on new database, no?
Line 87: ):
Line 88: self.logger.debug(
Line 89: 'Changing ACTION from UPGRADE to SETUP because we are '
Line 90: 'creating a new database'
Line 85: osetupcons.CoreEnv.ACTION
Line 86: ] == osetupcons.Const.ACTION_UPGRADE
Line 87: ):
Line 88: self.logger.debug(
Line 89: 'Changing ACTION from UPGRADE to SETUP because we are '
Changing->Forcing
Line 90: 'creating a new database'
Line 91: )
Line 92: self.environment[
Line 93: osetupcons.CoreEnv.ACTION
....................................................
File packaging/setup/plugins/ovirt-engine-setup/legacy/database.py
Line 73
Line 74
Line 75
Line 76
Line 77
I would have not updated new database here but bellow if isNewDatabase returns
False (no need for condition as you throw exception anyway).
self.environment[osetupcons.DBEnv.NEW_DATABASE] = True
As default should be True...
Line 87: if dbovirtutils.isNewDatabase():
Line 88: raise RuntimeError(
Line 89: _('Unexpected empty database during upgrade')
Line 90: )
Line 91: except (psycopg2.InterfaceError, RuntimeError) as e:
Why not catch Exception?
The problem with blank except is that you catch stuff that you do not want,
like exit exception.
Line 92: self.logger.debug(
Line 93: 'Database connection failed while trying to upgrade
from '
Line 94: 'legacy, creating a new database',
Line 95: exc_info=True,
Line 88: raise RuntimeError(
Line 89: _('Unexpected empty database during upgrade')
Line 90: )
Line 91: except (psycopg2.InterfaceError, RuntimeError) as e:
Line 92: self.logger.debug(
usually I mark each parameter explicitly, in this case:
self.logger.debug(
(
'bla bla bla bla'
'bla bla bla bla'
),
exc_info=True,
)
Easier to know which parameters belongs to function.
But it may be only me...
Line 93: 'Database connection failed while trying to upgrade
from '
Line 94: 'legacy, creating a new database',
Line 95: exc_info=True,
Line 96: )
--
To view, visit http://gerrit.ovirt.org/19689
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Id9aa1791eb7ccdbc8c679e72ed6eaa4f72ac29c6
Gerrit-PatchSet: 2
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
Gerrit-Reviewer: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Ofer Schreiber <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
Gerrit-Reviewer: Yedidyah Bar David <[email protected]>
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches