mirror of
https://github.com/ansible/awx.git
synced 2026-01-14 19:30:39 -03:30
Fix fact database migration
For new installs the database may not be online and thus the migration can't happen. This will allow it to continue but we may want more messaging to the user running potential upgrades
This commit is contained in:
parent
c2ea9c3c00
commit
cdc342a6ee
@ -7,7 +7,7 @@ from django.db import migrations
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0004_v300_fact_changes'),
|
||||
('main', '0004_v300_changes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
@ -107,7 +107,7 @@ def create_system_job_templates(apps, schema_editor):
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('main', '0005_v300_fact_migrations'),
|
||||
('main', '0005_v300_changes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
||||
@ -16,7 +16,12 @@ def migrate_facts(apps, schema_editor):
|
||||
Fact = apps.get_model('main', "Fact")
|
||||
Host = apps.get_model('main', "Host")
|
||||
|
||||
# TODO: Check to see if mongo connection works and mongo is on.
|
||||
try:
|
||||
n = FactVersion.objects.all().count()
|
||||
except ConnectionError:
|
||||
# TODO: Let the user know about the error. Likely this is
|
||||
# a new install and we just don't need to do this
|
||||
return (0, 0)
|
||||
|
||||
migrated_count = 0
|
||||
not_migrated_count = 0
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user