From cf740e06f4131c8cff33727a5e98d5d3eb6f3e21 Mon Sep 17 00:00:00 2001 From: Jonas Jochmaring Date: Thu, 9 Jul 2015 18:12:20 +0200 Subject: fix check for reporting in src/lib/Bcfg2/Server/Plugins/Reporting.py --- src/lib/Bcfg2/Server/Plugins/Reporting.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py index 5c73546b4..b9dcdcc81 100644 --- a/src/lib/Bcfg2/Server/Plugins/Reporting.py +++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py @@ -8,13 +8,17 @@ import Bcfg2.Options from Bcfg2.Reporting.Transport.base import TransportError from Bcfg2.Server.Plugin import Statistics, PullSource, Threaded, \ PluginInitError, PluginExecutionError +import django # required for reporting -try: - import south # pylint: disable=W0611 - HAS_SOUTH = True -except ImportError: - HAS_SOUTH = False +if django.VERSION[0] == 1 and django.VERSION[1] >= 7: + HAS_REPORTING = True +else: + try: + import south # pylint: disable=W0611 + HAS_REPORTING = True + except ImportError: + HAS_REPORTING = False def _rpc_call(method): @@ -48,8 +52,8 @@ class Reporting(Statistics, Threaded, PullSource): self.whoami = platform.node() self.transport = None - if not HAS_SOUTH: - msg = "Django south is required for Reporting" + if not HAS_REPORTING: + msg = "Django 1.7+ or Django south is required for Reporting" self.logger.error(msg) raise PluginInitError(msg) -- cgit v1.2.3-1-g7c22