summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Jones <mat@matburt.net>2016-03-11 18:59:21 +0100
committerMatthew Jones <mat@matburt.net>2016-03-11 18:59:21 +0100
commitcdc342a6eec75a53ba5cb0f35053b570dcef47e6 (patch)
tree440ff45cb5d11a9f3f6ce47d84c041a71f5d29e5
parentMake survey always visible if license enables (diff)
downloadawx-cdc342a6eec75a53ba5cb0f35053b570dcef47e6.tar.xz
awx-cdc342a6eec75a53ba5cb0f35053b570dcef47e6.zip
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
-rw-r--r--awx/main/migrations/0004_v300_changes.py (renamed from awx/main/migrations/0004_v300_fact_changes.py)0
-rw-r--r--awx/main/migrations/0005_v300_changes.py (renamed from awx/main/migrations/0005_v300_fact_migrations.py)2
-rw-r--r--awx/main/migrations/0006_v300_changes.py2
-rw-r--r--awx/main/migrations/_system_tracking.py7
4 files changed, 8 insertions, 3 deletions
diff --git a/awx/main/migrations/0004_v300_fact_changes.py b/awx/main/migrations/0004_v300_changes.py
index 66e523dc78..66e523dc78 100644
--- a/awx/main/migrations/0004_v300_fact_changes.py
+++ b/awx/main/migrations/0004_v300_changes.py
diff --git a/awx/main/migrations/0005_v300_fact_migrations.py b/awx/main/migrations/0005_v300_changes.py
index 8362227c2f..70dea77778 100644
--- a/awx/main/migrations/0005_v300_fact_migrations.py
+++ b/awx/main/migrations/0005_v300_changes.py
@@ -7,7 +7,7 @@ from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
- ('main', '0004_v300_fact_changes'),
+ ('main', '0004_v300_changes'),
]
operations = [
diff --git a/awx/main/migrations/0006_v300_changes.py b/awx/main/migrations/0006_v300_changes.py
index fb2e4a1b7c..4d60f2c795 100644
--- a/awx/main/migrations/0006_v300_changes.py
+++ b/awx/main/migrations/0006_v300_changes.py
@@ -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 = [
diff --git a/awx/main/migrations/_system_tracking.py b/awx/main/migrations/_system_tracking.py
index 95fdb62c2e..e5be20f4ef 100644
--- a/awx/main/migrations/_system_tracking.py
+++ b/awx/main/migrations/_system_tracking.py
@@ -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