Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: less strict parsing of pg_hba.conf ......................................................................
packaging: setup: less strict parsing of pg_hba.conf When checking the 'local' line, do not check exact spaces. Code partially copied from engine. Related-To: https://bugzilla.redhat.com/1084760 Change-Id: I25124c36de491de9aad0917f60b8f420168aa316 Signed-off-by: Yedidyah Bar David <[email protected]> --- M packaging/common_utils.py 1 file changed, 19 insertions(+), 16 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-reports refs/changes/29/26529/1 diff --git a/packaging/common_utils.py b/packaging/common_utils.py index 5a24b36..49fe988 100755 --- a/packaging/common_utils.py +++ b/packaging/common_utils.py @@ -1143,28 +1143,31 @@ stdIn=stdIn, ) +_RE_POSTGRES_PGHBA_LOCAL = re.compile( + flags=re.VERBOSE, + pattern=r""" + ^ + (?P<host>local) + \s+ + .* + \s+ + (?P<param>\w+) + $ + """, +) + def configHbaIdent(orig='md5', newval='ident'): content = [] logging.debug('Updating pghba postgres use') - contentline = ( - 'local ' - 'all ' - 'all ' - '{value}' - ) with open(FILE_PG_HBA, 'r') as pghba: for line in pghba.read().splitlines(): - if line.startswith( - contentline.format(value=newval) - ): - return False - - if line.startswith( - contentline.format(value=orig) - ): - line=contentline.format(value=newval) - + matcher = _RE_POSTGRES_PGHBA_LOCAL.match(line) + if matcher is not None: + if matcher.group('param') == newval: + return False + if matcher.group('param') == orig: + line = line.replace(matcher.group('param'), newval) content.append(line) with open(FILE_PG_HBA, 'w') as pghba: -- To view, visit http://gerrit.ovirt.org/26529 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I25124c36de491de9aad0917f60b8f420168aa316 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-reports Gerrit-Branch: ovirt-3.3 Gerrit-Owner: Yedidyah Bar David <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
