Skip to content
Snippets Groups Projects
Select Git revision
  • ebdf99c01356a66c8f40c8b6c9eda775d2c1852c
  • develop default protected
  • ical-export
  • feature/audit_log
  • fix/index
  • badge-redeem-404
  • 720-schedule_source
  • room-docu
  • chore/event-views
  • 511-schedule-foo-fixed
  • 607-schedule-versions
  • deploy/curl-verbose
  • fix/public-badge-access-rights
  • 445-schedule-redirects
  • 623-wiki-im-baustellenmodus-sollte-mal-als-wiki-admin-trotzdem-seiten-anlegen-bearbeiten-konnen
  • fix/registration_mail_subject
  • feature/conference-query-set
  • feature/568-habitatmanagement
  • feat/unit-integration-tests
  • camp23-prod
  • production
  • prod-2024-12-27_20-15
  • prod-2024-12-27_16-37
  • prod-2024-12-27_16-01
  • prod-2024-12-27_13-29
  • prod-2024-12-27_00-34
  • prod-2024-12-26_21-45
  • prod-2024-12-26_13-12
  • prod-2024-12-26_00-21
  • prod-2024-12-25_21-04
  • prod-2024-12-25_15-54
  • prod-2024-12-25_01-29
  • prod-2024-12-24_14-48
  • prod-2024-12-23_23-39
  • prod-2024-12-22_21-12
  • prod-2024-12-22_17-25
  • prod-2024-12-22_01-34
  • prod-2024-12-22_00-55
  • prod-2024-12-21_13-42
  • prod-2024-12-21_10-44
  • prod-2024-12-20_12-25
41 results

check_psql.py

Blame
  • Forked from hub / hub
    195 commits behind the upstream repository.
    Lucas Brandstaetter's avatar
    Roang authored
    * Use psycopg v3 instead of psycopg2
    * Direct import of used fuctions
    * Fix linting errors
    639d1dcb
    History
    check_psql.py 655 B
    #!/usr/bin/env python3
    
    import os
    import sys
    
    from psycopg import connect
    from psycopg.errors import OperationalError
    
    URL = os.getenv('DATABASE_URL')
    if URL is None or URL == '':
        print('No DATABASE_URL specified!', file=sys.stderr)
        sys.exit(2)
    
    try:
        if URL.startswith('postgis://'):
            URL = 'postgresql://' + URL[len('postgis://') :]
        connect(URL)
    
    except OperationalError as err:
        print('ERROR', file=sys.stderr)
        print('    ', err, sep='', file=sys.stderr)
        sys.exit(1)
    except Exception as err:  # pylint: disable=W0718
        print('UNKNOWN', file=sys.stderr)
        print('    ', err, sep='', file=sys.stderr)
        sys.exit(3)