]> scripts.mit.edu Git - wizard.git/commitdiff
Implement quick logging changes.
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 10 Oct 2009 18:37:26 +0000 (14:37 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 10 Oct 2009 18:37:26 +0000 (14:37 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
wizard/command/__init__.py
wizard/command/upgrade.py
wizard/deploy.py

diff --git a/TODO b/TODO
index 68aee94a4a62487f26d59dab06fde9f2e8d18a99..fdf6918f7133d55d523f75d98679a912e754f4b0 100644 (file)
--- a/TODO
+++ b/TODO
@@ -18,7 +18,7 @@ TODO NOW:
       doing a size comparison of the tars: `git pull` MUST NOT
       fail, otherwise things are left conflicted, and not easy to fix.
     - Prune -7 call errors and automatically reprocess them (with a
-      strike out counter of 3)
+      strike out counter of 3)--this requires better error parsing
     - Snap-in conflict resolution teaching:
         1. View the merge conflicts after doing a short run
         2. Identify common merge conflicts
@@ -33,8 +33,6 @@ TODO NOW:
 
 - Distinguish from logging and reporting (so we can easily send mail
   to users)
-    - Remove "already migrated" cruft that will accumulate if we do small
-      --limit and then increase.
     - Logs aren't actually useful, /because/ most operations are idempotent.
       Thus, scratch logfile and make our report files more useful: error.log
       needs error information; we don't care too much about machinability.
@@ -43,8 +41,6 @@ TODO NOW:
       that if we add soft ignores, you /do/ lose information, so there needs
       to be some way to also have the soft ignore report a "cached error"
     - Report the identifier number at the beginning of all of the stdout logs
-    - Log files that already exist should be initialized with some sort
-      of separator THAT CONTAINS THE LOCATION OF THE INSTALL
     - Don't really care about having the name in the logfile name, but
       have a lookup txt file
     - Figure out a way of collecting blacklist data from .scripts/blacklisted
@@ -52,13 +48,8 @@ TODO NOW:
     - Failed migrations should be wired to have wizard commands in them
       automatically log to the relevant file.  In addition, the seen file
       should get updated when one of them gets fixed.
-    - Log files need to have dates, since it looks like upgrades will be
-      multi-day affairs
     - Failed migration should report how many unmerged files there are
       (so we can auto-punt if it's over a threshold)
-    - Verification failures should be written to a report file, possibly
-      with short HTML fingerprints so we can inspect them easily and
-      numbers to look at the log files
 
 - Let users use Wizard when ssh'ed into Scripts
     - Make single user mass-migrate work when not logged in as root
index bc1b718b3ba8f0ad02cebbc2b25682a5a1e56c45..0ba071c059ce36a6a6aa017e1b5a3b0aa0cceb86 100644 (file)
@@ -42,7 +42,7 @@ def makeLogger(options, numeric_args):
     else: logger.addHandler(NullLogHandler()) # prevent default
     if options.log_file:
         file = logging.FileHandler(options.log_file)
-        logformatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s", "%H:%M:%S")
+        logformatter = logging.Formatter("%(asctime)s %(levelname)s: %(message)s", "%Y-%m-%d %H:%M")
         file.setFormatter(logformatter)
         logger.addHandler(file)
     if options.debug:
index da15d56c6e948b3dd88a5b5f408d8c398f5cd825..7cc14121c14778d476d56ef61411d5eb43c60605 100644 (file)
@@ -47,7 +47,12 @@ def main(argv, baton):
         repo = d.application.repository(options.srv_path)
         version = calculate_newest_version(sh, repo)
         if version == d.app_version.scripts_tag and not options.force:
-            raise AlreadyUpgraded
+            # don't log this error
+            # XXX: maybe we should build this in as a flag to add
+            # to exceptions w/ our exception handler
+            sys.stderr.write("Traceback:\n  (n/a)\nAlreadyUpgraded\n")
+            sys.exit(1)
+        logging.info("Upgrading %s" % os.getcwd())
         if not options.dry_run:
             perform_pre_commit(sh)
         # If /dev/shm exists, it's a tmpfs and we can use it
@@ -88,6 +93,8 @@ def main(argv, baton):
         except shell.CallError:
             sh.call("git", "checkout", "-q", "master", "--")
         sh.call("git", "reset", "-q", "--hard", final_commit)
+        # This is a quick sanity check to make sure we didn't completely
+        # mess up the merge
         d.verifyVersion()
     # Till now, all of our operations were in a tmp sandbox.
     if options.dry_run:
index bdea87e4385cd20421866a7276d0e0ca506a61e1..6197a9a990584e2e774659cbb4b8099d42488603 100644 (file)
@@ -228,7 +228,7 @@ class Deployment(object):
         """
         try:
             host, basepath = scripts.get_web_host_and_path(self.location)
-        except ValueError:
+        except (ValueError, TypeError):
             raise UnknownWebPath
         return util.fetch(host, basepath, path, post)