From: Edward Z. Yang Date: Wed, 21 Oct 2009 16:22:46 +0000 (-0400) Subject: Partition on colon for exceptions, ignore blank blacklistings. X-Git-Url: https://scripts.mit.edu/gitweb/wizard.git/commitdiff_plain/b29d182f610f68dcdc9525e08d5ad4fab65ffaa4 Partition on colon for exceptions, ignore blank blacklistings. Signed-off-by: Edward Z. Yang --- diff --git a/TODO b/TODO index dcdfcad..ab3e7d6 100644 --- a/TODO +++ b/TODO @@ -7,8 +7,6 @@ TODO NOW: does not seem to have been a problem in practice) - Prune -7 call errors and automatically reprocess them (with a strike out counter of 3)--this requires better error parsing. - - IOError should be aggregated, right now contains custom string - that makes this not possible. Partition on a colon. - Replace gaierror with a more descriptive name (this is a DNS error) - Stronger skips means that backup failures should also be avoided - Distinguish between types of backup failures diff --git a/wizard/command/upgrade.py b/wizard/command/upgrade.py index 503be69..0d90a56 100644 --- a/wizard/command/upgrade.py +++ b/wizard/command/upgrade.py @@ -46,8 +46,12 @@ def main(argv, baton): d = deploy.ProductionCopy(".") if os.path.exists(".scripts/blacklisted"): reason = open(".scripts/blacklisted").read() - print reason - raise BlacklistedError(reason) + # ignore blank blacklisted files + if reason: + print reason + raise BlacklistedError(reason) + else: + logging.warning("Application was blacklisted, but no reason was found"); d.verify() d.verifyTag(options.srv_path) d.verifyGit(options.srv_path) diff --git a/wizard/tests/util_test.py b/wizard/tests/util_test.py index e4ebe91..a328cd1 100644 --- a/wizard/tests/util_test.py +++ b/wizard/tests/util_test.py @@ -49,3 +49,8 @@ def test_get_exception_name_withhtml(): except MyErrorWithHTML: assert get_exception_name(traceback.format_exc()) == "MyErrorWithHTML" +def test_get_exception_name_withstr2(): + try: + raise Exception("This is extra info we don't care about"); + except Exception: + assert get_exception_name(traceback.format_exc()) == "Exception" diff --git a/wizard/util.py b/wizard/util.py index 7dbd4d7..eca883e 100644 --- a/wizard/util.py +++ b/wizard/util.py @@ -152,11 +152,7 @@ def get_exception_name(output): continue if cue: cue = False - if line[-1] == ":": - result = line[:-1] - else: - result = line - return result + return line.partition(':')[0] return result def get_dir_uid(dir):