summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/lib/Bcfg2/Server/Plugin/helpers.py9
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py5
2 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py
index f39609a5b..be9c9e8ae 100644
--- a/src/lib/Bcfg2/Server/Plugin/helpers.py
+++ b/src/lib/Bcfg2/Server/Plugin/helpers.py
@@ -137,11 +137,12 @@ class DatabaseBacked(Plugin):
self.option,
default=False)
if use_db and not HAS_DJANGO:
- raise PluginInitError("%s is True but Django not found" %
- self.option)
+ raise PluginInitError("%s.%s is True but Django not found" %
+ (self.section, self.option))
elif use_db and not self.core.database_available:
- raise PluginInitError("%s is True but the database is unavailable "
- "due to prior errors" % self.option)
+ raise PluginInitError("%s.%s is True but the database is "
+ "unavailable due to prior errors" %
+ (self.section, self.option))
def _section(self):
""" The section to look in for :attr:`DatabaseBacked.option`
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
index 5ae0dfcba..eac4faf90 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
@@ -7,6 +7,7 @@ import Bcfg2.Server
from Bcfg2.Compat import reduce
from mock import Mock, MagicMock, patch
from Bcfg2.Server.Plugin.helpers import *
+from Bcfg2.Server.Plugin.exceptions import PluginInitError
# add all parent testsuite directories to sys.path to allow (most)
# relative imports in python 2.4
@@ -90,13 +91,13 @@ class TestDatabaseBacked(TestPlugin):
Bcfg2.Server.Plugin.helpers.HAS_DJANGO = False
core = Mock()
+ core.setup.cfp.getboolean.return_value = False
db = self.get_obj(core)
self.assertFalse(db._use_db)
core = Mock()
core.setup.cfp.getboolean.return_value = True
- db = self.get_obj(core)
- self.assertFalse(db._use_db)
+ self.assertRaises(PluginInitError, self.get_obj, core)
Bcfg2.Server.Plugin.helpers.HAS_DJANGO = True