Why am I getting "Database settings are not available, using defaults." error in Ansible Automation Controller?

Solution Verified - Updated -

Issue

  • The automation controller causes an error regarding the database connectivity that is recorded in the /var/log/tower/tower.log as below.

    2022-10-25 02:53:43,180 ERROR    [-] awx.conf.settings Database settings are not available, using defaults.
    Traceback (most recent call last):
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
        return self._prepare_cursor(self.create_cursor(name))
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/backends/postgresql/base.py", line 223, in create_cursor
        cursor = self.connection.cursor()
    psycopg2.InterfaceError: connection already closed
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/conf/settings.py", line 81, in _ctit_db_wrapper
    yield
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/conf/settings.py", line 405, in __getattr__
    value = self._get_local(name)
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/awx/conf/settings.py", line 349, in _get_local
    setting = Setting.objects.filter(key=name, user__isnull=True).order_by('pk').first()
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/models/query.py", line 653, in first
    for obj in (self if self.ordered else self.order_by('pk'))[:1]:
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/models/query.py", line 274, in __iter__
        self._fetch_all()
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/models/query.py", line 1242, in _fetch_all
        self._result_cache = list(self._iterable_class(self))
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/models/query.py", line 55, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/models/sql/compiler.py", line 1140, in execute_sql
        cursor = self.connection.cursor()
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/backends/base/base.py", line 256, in cursor
    return self._cursor()
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
    return self._prepare_cursor(self.create_cursor(name))
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/utils.py", line 89, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/backends/base/base.py", line 235, in _cursor
        return self._prepare_cursor(self.create_cursor(name))
      File "/var/lib/awx/venv/awx/lib64/python3.8/site-packages/django/db/backends/postgresql/base.py", line 223, in create_cursor
        cursor = self.connection.cursor()
    django.db.utils.InterfaceError: connection already closed
    

Environment

  • Ansible Automation Controller <= 4.1.2, 4.2.0
  • Ansible Tower <= 3.8.5

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content