Yedidyah Bar David has uploaded a new change for review. Change subject: packaging: setup: weird message on cleanup if no db ......................................................................
packaging: setup: weird message on cleanup if no db Make engine-cleanup continue gracefully if the database was manually deleted. This is an alternative implementation. First one was http://gerrit.ovirt.org/19840 Change-Id: Iaba0ba1563acbf8c0ef900b304aa577a3dd1f615 Bug-Url: https://bugzilla.redhat.com/1015037 Signed-off-by: Yedidyah Bar David <d...@redhat.com> --- M packaging/setup/plugins/ovirt-engine-common/db/pgpass.py 1 file changed, 19 insertions(+), 14 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/19886/1 diff --git a/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py b/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py index 916da2a..222200b 100644 --- a/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py +++ b/packaging/setup/plugins/ovirt-engine-common/db/pgpass.py @@ -54,21 +54,26 @@ ) os.close(fd) os.chmod(pgpass, 0o600) - with open(pgpass, 'w') as f: - f.write( - ( - '# DB USER credentials.\n' - '{host}:{port}:{database}:{user}:{password}\n' - ).format( - host=self.environment[osetupcons.DBEnv.HOST], - port=self.environment[osetupcons.DBEnv.PORT], - database=self.environment[osetupcons.DBEnv.DATABASE], - user=self.environment[osetupcons.DBEnv.USER], - password=osetuputil.escape( - self.environment[osetupcons.DBEnv.PASSWORD], - ':\\', + if self.environment[osetupcons.DBEnv.PASSWORD] is not None: + with open(pgpass, 'w') as f: + f.write( + ( + '# DB USER credentials.\n' + '{host}:{port}:{database}:{user}:{password}\n' + ).format( + host=self.environment[osetupcons.DBEnv.HOST], + port=self.environment[osetupcons.DBEnv.PORT], + database=self.environment[osetupcons.DBEnv.DATABASE], + user=self.environment[osetupcons.DBEnv.USER], + password=osetuputil.escape( + self.environment[osetupcons.DBEnv.PASSWORD], + ':\\', + ), ), - ), + ) + else: + self.logger.debug( + 'Not creating temp pgpass because password is not known' ) self.environment[ -- To view, visit http://gerrit.ovirt.org/19886 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iaba0ba1563acbf8c0ef900b304aa577a3dd1f615 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