Repository navigation
Closed
Labels
Description
ISSUE TYPE
- Bug Report
SUMMARY
I seeing migrations only partially run on Local Docker installations. It seems as those sometimes, the migrations will run in the background and finish, but other times, only 5 migrations are run.
ENVIRONMENT
- AWX version: X.Y.Z
- AWX install method: openshift, minishift, docker on linux, docker for mac, boot2docker
- Ansible version: X.Y.Z
- Operating System:
- Web Browser:
STEPS TO REPRODUCE
ansible-playbook -i inventory install.yml -vv
EXPECTED RESULTS
Successful install, no errors.
ACTUAL RESULTS
Only 5 migrations run (none from the main app), installer fails early on "Create Preload data" task.
ADDITIONAL INFORMATION
Traceback from installer:
TASK [local_docker : Create Preload data] **************************************************************************************
task path: /home/chadams/awx/installer/roles/local_docker/tasks/compose.yml:53
fatal: [localhost]: FAILED! => {"changed": false, "cmd": ["docker", "exec", "awx_task", "bash", "-c", "/usr/bin/awx-manage create_preload_data"], "delta": "0:00:03.845744", "end": "2021-01-13 11:05:35.771060", "msg": "non-zero return code", "rc": 1, "start": "2021-01-13 11:05:31.925316", "stderr": "Traceback (most recent call last):\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\npsycopg2.errors.UndefinedTable: relation \"main_organization\" does not exist\nLINE 1: SELECT COUNT(*) AS \"__count\" FROM \"main_organization\"\n ^\n\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n File \"/usr/bin/awx-manage\", line 8, in <module>\n sys.exit(manage())\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py\", line 154, in manage\n execute_from_command_line(sys.argv)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/__init__.py\", line 381, in execute_from_command_line\n utility.execute()\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/__init__.py\", line 375, in execute\n self.fetch_command(subcommand).run_from_argv(self.argv)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py\", line 323, in run_from_argv\n self.execute(*args, **cmd_options)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py\", line 364, in execute\n output = self.handle(*args, **options)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/create_preload_data.py\", line 17, in handle\n if Organization.objects.count():\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/manager.py\", line 82, in manager_method\n return getattr(self.get_queryset(), name)(*args, **kwargs)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py\", line 392, in count\n return self.query.get_count(using=self.db)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/query.py\", line 504, in get_count\n number = obj.get_aggregation(using, ['__count'])['__count']\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/query.py\", line 489, in get_aggregation\n result = compiler.execute_sql(SINGLE)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py\", line 1142, in execute_sql\n cursor.execute(sql, params)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 67, in execute\n return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 76, in _execute_with_wrappers\n return executor(sql, params, many, context)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/utils.py\", line 89, in __exit__\n raise dj_exc_value.with_traceback(traceback) from exc_value\n File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 84, in _execute\n return self.cursor.execute(sql, params)\ndjango.db.utils.ProgrammingError: relation \"main_organization\" does not exist\nLINE 1: SELECT COUNT(*) AS \"__count\" FROM \"main_organization\"\n ^", "stderr_lines": ["Traceback (most recent call last):", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 84, in _execute", " return self.cursor.execute(sql, params)", "psycopg2.errors.UndefinedTable: relation \"main_organization\" does not exist", "LINE 1: SELECT COUNT(*) AS \"__count\" FROM \"main_organization\"", " ^", "", "", "The above exception was the direct cause of the following exception:", "", "Traceback (most recent call last):", " File \"/usr/bin/awx-manage\", line 8, in <module>", " sys.exit(manage())", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/__init__.py\", line 154, in manage", " execute_from_command_line(sys.argv)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/__init__.py\", line 381, in execute_from_command_line", " utility.execute()", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/__init__.py\", line 375, in execute", " self.fetch_command(subcommand).run_from_argv(self.argv)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py\", line 323, in run_from_argv", " self.execute(*args, **cmd_options)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/core/management/base.py\", line 364, in execute", " output = self.handle(*args, **options)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/awx/main/management/commands/create_preload_data.py\", line 17, in handle", " if Organization.objects.count():", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/manager.py\", line 82, in manager_method", " return getattr(self.get_queryset(), name)(*args, **kwargs)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/query.py\", line 392, in count", " return self.query.get_count(using=self.db)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/query.py\", line 504, in get_count", " number = obj.get_aggregation(using, ['__count'])['__count']", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/query.py\", line 489, in get_aggregation", " result = compiler.execute_sql(SINGLE)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/models/sql/compiler.py\", line 1142, in execute_sql", " cursor.execute(sql, params)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 67, in execute", " return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 76, in _execute_with_wrappers", " return executor(sql, params, many, context)", " File \"/var/lib/awx/venv/awx/lib/python3.6/site-packages/django/db/backends/utils.py\", line 84, in _execute", " return self.cursor.execute(sql, params)", " File \"/var/lib/awx/venv/awx/lib/python3.6/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/lib/python3.6/site-packages/django/db/backends/utils.py\", line 84, in _execute", " return self.cursor.execute(sql, params)", "django.db.utils.ProgrammingError: relation \"main_organization\" does not exist", "LINE 1: SELECT COUNT(*) AS \"__count\" FROM \"main_organization\"", " ^"], "stdout": "", "stdout_lines": []}
Activity
Run migrations via a task, not in the container
Run migrations via a task, not in the container
rooftopcellist commentedon Jan 13, 2021
I have also noticed this separate issue where the create preload data step fails because the admin user is not available. I believe this is because services haven't fully come up yet because the admin user can be in the database already and the error will still occur.
Adding a 10 second wait (5 wasn't enough)
Run migrations via a task, not in the container
Run migrations via a task, not in the container
rooftopcellist commentedon Jan 14, 2021
FYI, this is what happens for me on fresh installs of 16.0.0.
Migrations never finish (waited 30 min).
15.0.1 works without issue.
Run migrations via a task, not in the container
rooftopcellist commentedon Jan 19, 2021
This is fixed in #9113