summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-09-23 18:32:54 +0200
committerAlexander Sulfrian <alexander.sulfrian@fu-berlin.de>2015-09-23 19:44:14 +0200
commitfaa1cfcd9f21c1bc74e251f022029e52069fcd18 (patch)
tree72f24af1333a5f12a830fd66345571b18f0e58b7
parent7dfe4ea2f6c62ffb662085cb4d62a13b8e902ce1 (diff)
downloadbcfg2-faa1cfcd9f21c1bc74e251f022029e52069fcd18.tar.gz
bcfg2-faa1cfcd9f21c1bc74e251f022029e52069fcd18.tar.bz2
bcfg2-faa1cfcd9f21c1bc74e251f022029e52069fcd18.zip
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.
-rwxr-xr-xtools/upgrade/1.3/migrate_dbstats.py5
1 files 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()