]> scripts.mit.edu Git - wizard.git/commitdiff
Factor out common error messages to _base in prep for upgrade.
authorEdward Z. Yang <ezyang@mit.edu>
Mon, 29 Jun 2009 00:51:56 +0000 (20:51 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Mon, 29 Jun 2009 00:51:56 +0000 (20:51 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
bin/wizard
wizard/command/_base.py
wizard/command/massmigrate.py
wizard/command/migrate.py

diff --git a/TODO b/TODO
index 6769736c87e9960f24a65b03a74dcc3e20329c1c..42f981a7863025e1ba20dd8c2fd3cbb287df54bd 100644 (file)
--- a/TODO
+++ b/TODO
@@ -9,6 +9,11 @@ TODO NOW:
 - Wordpress needs to have a .scripts/update script written for
   its latest version
 
+- Need to upgrade the installer scripts to work out of the
+  repository
+- Need an upgrade script OR
+- Need survey script
+
 NOTES:
 
 - A perfectly formed autoinstall with upgrade paths for all of
index f93266fb4b389b7b104ffd9d1d0f336af26b683c..830b512c51c9f692344ccf4eb6ca0e4b06d20e90 100755 (executable)
@@ -18,6 +18,7 @@ Its commands are:
     massmigrate     Performs mass migration of autoinstalls of an application
     migrate         Migrate autoinstalls from old format to Git-based format
     summary         Generate statistics about autoinstalls
+    upgrade         Upgrades an autoinstall to the latest version
 
 See '%prog help COMMAND' for more information on a specific command."""
 
index 8171d0b0a57a2fd8533a55e788e98d1ed72ac09e..7664a89ae25cc7bf08f2ff37c94596c36e69a493 100644 (file)
@@ -9,6 +9,32 @@ class Error(wizard.Error):
     """Base error class for all command errors"""
     pass
 
+class PermissionsError(Error):
+    def __init__(self, dir):
+        self.dir = dir
+    def __str__(self):
+        return """
+
+ERROR: You don't have permissions to access this directory.
+Do you have tickets for AFS with your root instance, and
+is your root instance on scripts-security-upd?
+
+You can check by running the commands 'klist' and
+'blanche scripts-security-upd'.  We recommend getting
+root tickets using Nelson Elhage's krbroot script
+at /mit/nelhage/Public/krbroot (for which you run
+'krbroot shell' and then 'aklog').
+"""
+
+class NoSuchDirectoryError(Error):
+    def __init__(self, dir):
+        self.dir = dir
+    def __str__(self):
+        return """
+
+ERROR: No such directory... check your typing
+"""
+
 def makeLogger(options, numeric_args):
     context = " ".join(numeric_args)
     logger = logging.getLogger("main")
index 5feaa78172834be36be29b7e09f1f032597ed9c2..675003fbee539ed1bbab165124834b13b66de757 100644 (file)
@@ -40,6 +40,8 @@ stat every install to find out if it migrated it yet).
     app = args[0]
     errors = {}
     base_args = _base.makeBaseArgs(options, dry_run="--dry-run")
+    if not options.debug:
+        base_args.append("--quiet")
     # check if we have root
     uid = os.getuid()
     user = None
index 4136f3fa84238a86e3624f5b8d66775361bed24d..c4ada88dbef0823ce976995b85a9220cea2d7d1a 100644 (file)
@@ -13,32 +13,6 @@ class Error(_base.Error):
     """Base exception for all exceptions raised by migrate"""
     pass
 
-class PermissionsError(Error):
-    def __init__(self, dir):
-        self.dir = dir
-    def __str__(self):
-        return """
-
-ERROR: You don't have permissions to access this directory.
-Do you have tickets for AFS with your root instance, and
-is your root instance on scripts-security-upd?
-
-You can check by running the commands 'klist' and
-'blanche scripts-security-upd'.  We recommend getting
-root tickets using Nelson Elhage's krbroot script
-at /mit/nelhage/Public/krbroot (for which you run
-'krbroot shell' and then 'aklog').
-"""
-
-class NoSuchDirectoryError(Error):
-    def __init__(self, dir):
-        self.dir = dir
-    def __str__(self):
-        return """
-
-ERROR: No such directory... check your typing
-"""
-
 class AlreadyMigratedError(Error):
     def __init__(self, dir):
         self.dir = dir
@@ -102,9 +76,9 @@ what repository and tag to use."""
         os.chdir(dir)
     except OSError as e:
         if e.errno == errno.EACCES:
-            raise PermissionsError(dir)
+            raise _base.PermissionsError(dir)
         elif e.errno == errno.ENOENT:
-            raise NoSuchDirectoryError(dir)
+            raise _base.NoSuchDirectoryError(dir)
         else: raise e
     if os.path.isdir(".git") or os.path.isdir(".scripts"):
         if not options.force: