From 9baefc885a1156d64ddc3389a77382aec4a3173a Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Fri, 26 Jun 2009 20:50:50 -0400 Subject: [PATCH] Make deploy log parsing a little more robust. Signed-off-by: Edward Z. Yang --- README | 2 ++ lib/wizard/deploy.py | 25 ++++++++++++++----------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README b/README index 9537da7..7eb7289 100644 --- a/README +++ b/README @@ -1,3 +1,5 @@ +This is Python 2.6 only! + To add a new command to wizard, you need to touch the following locations: diff --git a/lib/wizard/deploy.py b/lib/wizard/deploy.py index 2b87294..8541cdd 100644 --- a/lib/wizard/deploy.py +++ b/lib/wizard/deploy.py @@ -229,17 +229,20 @@ class ApplicationVersion(object): # /afs/athena.mit.edu/contrib/scripts/deploy/APP-x.y.z for old style installs # /afs/athena.mit.edu/contrib/scripts/wizard/srv/APP.git vx.y.z-scripts for new style installs name = deploydir.split("/")[-1] - if name.find(" ") != -1: - raw_app, raw_version = name.split(" ") - version = raw_version[1:] # remove leading v - app, _ = raw_app.split(".") # remove trailing .git - elif name.find("-") != -1: - app, version = name.split("-") - elif name == "deploy": - # Assume that it's django, since those were botched - app = "django" - version = "0.1-scripts" - else: + try: + if name.find(" ") != -1: + raw_app, raw_version = name.split(" ") + version = raw_version[1:] # remove leading v + app, _ = raw_app.split(".") # remove trailing .git + elif name.find("-") != -1: + app, version = name.split("-") + elif name == "deploy": + # Assume that it's django, since those were botched + app = "django" + version = "0.1-scripts" + else: + raise DeploymentParseError + except ValueError: # mostly from the a, b = foo.split(' ') raise DeploymentParseError if not applookup: applookup = applications try: -- 2.45.0