]> git.openstreetmap.org Git - nominatim.git/blobdiff - nominatim/tools/check_database.py
Ported createCountryNames() to python and added tests
[nominatim.git] / nominatim / tools / check_database.py
index 3031026b8cbeba3f01edd1d164187e7d8242b9c2..d8ab08ccd7a8593bdf149235a9e91c36482bebc7 100644 (file)
@@ -60,7 +60,7 @@ def check_database(config):
     """ Run a number of checks on the database and return the status.
     """
     try:
     """ 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))
 
     except UsageError as err:
         conn = _BadConnection(str(err))
 
@@ -70,7 +70,7 @@ def check_database(config):
         if ret == CheckState.FATAL:
             conn.close()
             return 1
         if ret == CheckState.FATAL:
             conn.close()
             return 1
-        if ret != CheckState.OK:
+        if ret in (CheckState.FATAL, CheckState.FAIL):
             overall_result = 1
 
     conn.close()
             overall_result = 1
 
     conn.close()