From faa1cfcd9f21c1bc74e251f022029e52069fcd18 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 23 Sep 2015 18:32:54 +0200 Subject: tools/upgrade: Parse the Options before using django We need to go through the Options parsing before we could use django and import the models. The Options parsing will setup django and prepare the required settings. --- tools/upgrade/1.3/migrate_dbstats.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/upgrade/1.3/migrate_dbstats.py b/tools/upgrade/1.3/migrate_dbstats.py index de8aef973..2a2a112e9 100755 --- a/tools/upgrade/1.3/migrate_dbstats.py +++ b/tools/upgrade/1.3/migrate_dbstats.py @@ -10,10 +10,8 @@ import Bcfg2.Logger import Bcfg2.Options from django.db import connection, transaction, backend from Bcfg2.Server.Admin import UpdateReports -from Bcfg2.Reporting import models as new_models from Bcfg2.Reporting.utils import BatchFetch from Bcfg2.Reporting.Compat import transaction -from Bcfg2.Server.Reports.reports import models as legacy_models logger = logging.getLogger(__name__) @@ -283,6 +281,9 @@ if __name__ == '__main__': description="Migrate from Bcfg2 1.2 DBStats plugin to 1.3 Reporting " "subsystem", components=[UpdateReports]) + parser.parse() + from Bcfg2.Reporting import models as new_models + from Bcfg2.Server.Reports.reports import models as legacy_models UpdateReports().run(Bcfg2.Options.setup) _restructure() -- cgit v1.2.3-1-g7c22