Alon Bar-Lev has posted comments on this change.
Change subject: packaging: Validating DB encoding during setup and upgrade
......................................................................
Patch Set 8: (4 inline comments)
....................................................
File packaging/setup/plugins/ovirt-engine-setup/db/connection.py
Line 73: try:
Line 74: statement = database.Statement(environment=environment)
Line 75: encoding = statement.execute(
Line 76: statement="""
Line 77: SELECT pg_encoding_to_char(encoding)
please use lower case.
Line 78: FROM pg_database WHERE datname = 'template1'
Line 79: """,
Line 80: ownConnection=True,
Line 81: transaction=False,
Line 74: statement = database.Statement(environment=environment)
Line 75: encoding = statement.execute(
Line 76: statement="""
Line 77: SELECT pg_encoding_to_char(encoding)
Line 78: FROM pg_database WHERE datname = 'template1'
are you sure pg_database is available for engine user?
Also you should have used %(database)s and provide dictionary as parameters.
Line 79: """,
Line 80: ownConnection=True,
Line 81: transaction=False,
Line 82: database="template1",
Line 78: FROM pg_database WHERE datname = 'template1'
Line 79: """,
Line 80: ownConnection=True,
Line 81: transaction=False,
Line 82: database="template1",
we do not access template1 in otopi installation. You need to find a different
way to check encoding, such as putting utf and see that it is received.
Line 83: )[0]['pg_encoding_to_char']
Line 84: if 'utf8' in encoding.lower():
Line 85: self.logger.debug('Default encoding is UTF8')
Line 86: else:
Line 96: ).format(
Line 97: encoding=encoding,
Line 98: )
Line 99: )
Line 100: except psycopg2.OperationalError as e:
why do you need this?
Line 101: self.logger.debug('Connection failed', exc_info=True)
Line 102: raise RuntimeError(
Line 103: _('Cannot connect to database: {error}').format(
Line 104: error=e,
--
To view, visit http://gerrit.ovirt.org/14615
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I583b115cf60142cafc5ba66b0dc22e92b4807c84
Gerrit-PatchSet: 8
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alex Lourie <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Eli Mesika <[email protected]>
Gerrit-Reviewer: Juan Hernandez <[email protected]>
Gerrit-Reviewer: Moran Goldboim <[email protected]>
Gerrit-Reviewer: Ofer Schreiber <[email protected]>
Gerrit-Reviewer: Sandro Bonazzola <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches