""" Run a number of checks on the database and return the status.
"""
try:
- conn = connect(config.get_libpq_dsn())
+ conn = connect(config.get_libpq_dsn()).connection
except UsageError as err:
conn = _BadConnection(str(err))
if ret == CheckState.FATAL:
conn.close()
return 1
- if ret != CheckState.OK:
+ if ret in (CheckState.FATAL, CheckState.FAIL):
overall_result = 1
conn.close()