From 623a06c4b9a1fa7040146ff27364fc64a5a6a57e Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 9 Oct 2012 10:04:37 -0400 Subject: Reporting: made plugin produce errors if South is not installed --- src/lib/Bcfg2/Server/Plugins/Reporting.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/lib/Bcfg2') diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py index f275bcc9d..1ea6637a8 100644 --- a/src/lib/Bcfg2/Server/Plugins/Reporting.py +++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py @@ -11,6 +11,13 @@ from Bcfg2.Options import REPORTING_COMMON_OPTIONS from Bcfg2.Server.Plugin import Statistics, PullSource, PluginInitError, \ PluginExecutionError +# required for reporting +try: + import south # pylint: disable=W0611 + HAS_SOUTH = True +except ImportError: + HAS_SOUTH = False + def _rpc_call(method): """ Given the name of a Reporting Transport method, get a function @@ -44,6 +51,11 @@ class Reporting(Statistics, PullSource): # pylint: disable=W0223 core.setup.update(REPORTING_COMMON_OPTIONS) core.setup.reparse() + if not HAS_SOUTH: + msg = "Django south is required for Reporting" + self.logger.error(msg) + raise PluginInitError(msg) + try: self.transport = load_transport_from_config(core.setup) except TransportError: -- cgit v1.2.3-1-g7c22