From edd623511a2238f60d99aa72322af67d875f3484 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Tue, 29 Sep 2015 17:23:54 +0200 Subject: Reporting: Add django.setup() bcfg2-reports does not call sync_databases or migrate_databases before making the database queries. So we need to initialize django here, too. --- src/lib/Bcfg2/Reporting/Reports.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lib/Bcfg2/Reporting/Reports.py b/src/lib/Bcfg2/Reporting/Reports.py index ebd0db58f..ee3c27709 100755 --- a/src/lib/Bcfg2/Reporting/Reports.py +++ b/src/lib/Bcfg2/Reporting/Reports.py @@ -4,6 +4,7 @@ import sys import argparse import datetime +import django import Bcfg2.DBSettings @@ -307,6 +308,8 @@ class CLI(Bcfg2.Options.CommandRegistry): components=[self]) parser.add_options(self.subcommand_options) parser.parse() + if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + django.setup() # pylint: disable=E1101 def run(self): """ Run bcfg2-reports """ -- cgit v1.2.3-1-g7c22