From fc8c4d81fd81b66c424480ce5aaa91bcf49809bb Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 10 Dec 2012 20:04:22 -0600 Subject: testsuite: test for exceptions raised without messages --- src/lib/Bcfg2/Options.py | 4 ++-- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 2 +- src/lib/Bcfg2/Server/Plugins/Reporting.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Options.py b/src/lib/Bcfg2/Options.py index b418d57b0..aff8c0733 100644 --- a/src/lib/Bcfg2/Options.py +++ b/src/lib/Bcfg2/Options.py @@ -331,7 +331,7 @@ def get_bool(val): elif val in falselist: return False else: - raise ValueError + raise ValueError("Not a boolean value", val) def get_size(value): @@ -341,7 +341,7 @@ def get_size(value): return value mat = re.match("(\d+)([KkMmGg])?", value) if not mat: - raise ValueError + raise ValueError("Not a valid size", value) rvalue = int(mat.group(1)) mult = mat.group(2).lower() if mult == 'k': diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index b98070ca9..985405e65 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -67,7 +67,7 @@ def fetch_url(url): if '@' in url: mobj = re.match('(\w+://)([^:]+):([^@]+)@(.*)$', url) if not mobj: - raise ValueError + raise ValueError("Invalid URL") user = mobj.group(2) passwd = mobj.group(3) url = mobj.group(1) + mobj.group(4) diff --git a/src/lib/Bcfg2/Server/Plugins/Reporting.py b/src/lib/Bcfg2/Server/Plugins/Reporting.py index 60f5b1e09..d072f1a33 100644 --- a/src/lib/Bcfg2/Server/Plugins/Reporting.py +++ b/src/lib/Bcfg2/Server/Plugins/Reporting.py @@ -1,5 +1,6 @@ """ Unified statistics and reporting plugin """ +import sys import time import platform import traceback @@ -27,7 +28,7 @@ def _rpc_call(method): return self.transport.rpc(method, *args, **kwargs) except TransportError: # this is needed for Admin.Pull - raise PluginExecutionError + raise PluginExecutionError(sys.exc_info()[1]) return _real_rpc_call -- cgit v1.2.3-1-g7c22