]> scripts.mit.edu Git - wizard.git/commitdiff
Make deploy log parsing a little more robust.
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 27 Jun 2009 00:50:50 +0000 (20:50 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 27 Jun 2009 00:50:50 +0000 (20:50 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
README
lib/wizard/deploy.py

diff --git a/README b/README
index 9537da723f24faf772f9b6ecd3667138911e9170..7eb7289a56be529533365422f448d42cfc808edf 100644 (file)
--- 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:
 
 To add a new command to wizard, you need to touch the following
 locations:
 
index 2b87294ef33ab77e4259613fa5a2cc41f276564b..8541cdd76a3a4c0bc2a91f19e5bb99b57277d81a 100644 (file)
@@ -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]
         #   /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:
             raise DeploymentParseError
         if not applookup: applookup = applications
         try: