Postgres DB

21 views
Skip to first unread message

Sindhuja Koneru

unread,
Mar 14, 2019, 9:30:00 PM3/14/19
to Ansible Project
Hi,

I was trying to backup DB(backup.yml) and restore DB(restore.yml) from the backup. It was not successful.

So, erased all tower binaries and was trying to perform a fresh tower install. But fresh install (install.yml) fails with error,
IntegrityError: duplicate key value violates undex\"\nDETAIL:  Key (typname, typnamespace)=(django_migrations_id_seq, 2200) already exists

Can anybody please guide? should I remove the key? if yes, how can it be achieved?

P.S: backup.yml, restore.yml and install.yml are the scripts from Ansible bundle.

TASK [preflight : Preflight check - check Tower license type] ****************************************************************

fatal: [tnode3.abc.com]: FAILED! => {"changed": true, "cmd": "awx-manage check_license", "delta": "0:00:02.243", "msg": "non-zero return code", "rc": 1, "start": "2019-03-14 17:13:55.509133", "stderr": "Traceback (most recent call la, in <module>\n    load_entry_point('awx==3.2.5', 'console_scripts', 'awx-manage')()\n  File \"/lib/python2.7/site-packages/awFile \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/__init__.py\", line 354, in execute_from_comma"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/__init__.py\", line 328, in execute\n    django.setupython2.7/site-packages/django/__init__.py\", line 18, in setup\n    apps.populate(settings.INSTALLED_APPS)\n  File \"/var/libs/django/apps/registry.py\", line 115, in populate\n    app_config.ready()\n  File \"/lib/python2.7/site-packages/awx/conf/app/python2.7/site-packages/awx/main/utils/handlers.py\", line 357, in configure_external_logger\n  File \"/var/lib/awx/venv/awx/__init__.py\", line 49, in __getattr__\n    return getattr(self._wrapped, name)\n  File \"/lib/python2.7/site-packages/awx/con_\n  File \"/usr/lib64/python2.7/contextlib.py\", line 35, in __exit__\n    self.gen.throw(type, value, traceback)\n  File \"/tings.py\", line 64, in _log_database_error\n  File \"/lib/python2.7/site-packages/awx/main/utils/db.py\", line 13, in get_towawx/venv/awx/lib/python2.7/site-packages/django/db/migrations/loader.py\", line 47, in __init__\n    self.build_graph()\n  Filsite-packages/django/db/migrations/loader.py\", line 191, in build_graph\n    self.applied_migrations = recorder.applied_migralib/python2.7/site-packages/django/db/migrations/recorder.py\", line 59, in applied_migrations\n    self.ensure_schema()\n  Fi/site-packages/django/db/migrations/recorder.py\", line 53, in ensure_schema\n    editor.create_model(self.Migration)\n  File te-packages/django/db/backends/base/schema.py\", line 286, in create_model\n    self.execute(sql, params or None)\n  File \"/vackages/django/db/backends/base/schema.py\", line 111, in execute\n    cursor.execute(sql, params)\n  File \"/var/lib/awx/venvdb/backends/utils.py\", line 64, in execute\n    return self.cursor.execute(sql, params)\n  File \"/var/lib/awx/venv/awx/lib/py\", line 98, in __exit__\n    six.reraise(dj_exc_type, dj_exc_value, traceback)\n  File \"/var/lib/awx/venv/awx/lib/python2.7py\", line 62, in execute\n    return self.cursor.execute(sql)\ndjango.db.utils.IntegrityError: duplicate key value violates undex\"\nDETAIL:  Key (typname, typnamespace)=(django_migrations_id_seq, 2200) already exists.", "stderr_lines": ["Traceback (mawx-manage\", line 9, in <module>", "    load_entry_point('awx==3.2.5', 'console_scripts', 'awx-manage')()", "  File \"/lib/py line 107, in manage", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/__init__.py\", line  utility.execute()", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/core/management/__init__.py\", line 32 File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/__init__.py\", line 18, in setup", "    apps.populate(settingwx/venv/awx/lib/python2.7/site-packages/django/apps/registry.py\", line 115, in populate", "    app_config.ready()", "  File \pps.py\", line 18, in ready", "  File \"/lib/python2.7/site-packages/awx/main/utils/handlers.py\", line 357, in configure_extev/awx/lib/python2.7/site-packages/django/conf/__init__.py\", line 49, in __getattr__", "    return getattr(self._wrapped, namees/awx/conf/settings.py\", line 386, in __getattr__", "  File \"/usr/lib64/python2.7/contextlib.py\", line 35, in __exit__", "k)", "  File \"/lib/python2.7/site-packages/awx/conf/settings.py\", line 64, in _log_database_error", "  File \"/lib/python2.7ine 13, in get_tower_migration_version", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/migrations/loadf.build_graph()", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/migrations/loader.py\", line 191, in bs = recorder.applied_migrations()", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/migrations/recorder.    self.ensure_schema()", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/migrations/recorder.py\", linate_model(self.Migration)", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/schema.py\", lcute(sql, params or None)", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/base/schema.py\", le(sql, params)", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/utils.py\", line 64, in execut params)", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/utils.py\", line 98, in __exit__", "    six.rack)", "  File \"/var/lib/awx/venv/awx/lib/python2.7/site-packages/django/db/backends/utils.py\", line 62, in execute", "    r.db.utils.IntegrityError: duplicate key value violates unique constraint \"pg_type_typname_nsp_index\"", "DETAIL:  Key (typnameq, 2200) already exists."], "stdout": "", "stdout_lines": []}

...ignoring

[tnode3.abc.com] TASK: preflight : Preflight check - check Tower license type (debug)>

Jonathan Lozada De La Matta

unread,
Mar 14, 2019, 9:54:42 PM3/14/19
to ansible...@googlegroups.com
please reach out support for this issue.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/521d3506-54f6-4d14-944f-995430264c9d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--

Jonathan lozada de la matta

AUTOMATION PRACTICE



 

Gaetano Giacalone

unread,
Mar 15, 2019, 1:01:43 AM3/15/19
to ansible...@googlegroups.com

If it is a restore from backup so a relational db is a db and db rules apply. Two choices. Drop the primary key (bad choice) or truncate first.

Reply all
Reply to author
Forward
0 new messages