]> scripts.mit.edu Git - wizard.git/commitdiff
Fix bug in quota code, note improvement for fetch, improve logging.
authorEdward Z. Yang <ezyang@mit.edu>
Sun, 11 Jul 2010 05:24:07 +0000 (01:24 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Sun, 11 Jul 2010 05:24:07 +0000 (01:24 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
TODO
plugins/scripts/wizard_scripts.py
wizard/command/upgrade.py
wizard/deploy.py

diff --git a/TODO b/TODO
index 6aa9ad2c701a028b0e4327c9ff2ee04c6ec3173d..318828ba914a0080f09ea4e998e925a6020dd66b 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,5 +1,10 @@
 - [SCRIPTS] MediaWiki 1.9.3 and 1.6.7
 
+- util.fetch() should use urllib under the hood, not httplib.  Code
+  has to be changed.  We should log if we get redirected.
+- Wordpress module can do something intelligent if we get redirected
+  to the installation page.
+
 - Plugin-ify! Hook-ify! In more detail, applications should all be moved
   out into plugins, scripts specific behavior should be moved into
   plugins, and hooks need to be made available so that we can exert
index 4a9a0841457337d434f92911a97b204bdbb63cbf..a44af215138e8f92f3d24f3e3a1789725031557f 100644 (file)
@@ -33,7 +33,7 @@ def deploy_web(dir):
 def user_quota(dir=None):
     """
     Returns a tuple (quota usage, quota limit).  Works only for scripts
-    servers.  Values are in KiB.  Returns ``(0, None)`` if we couldn't figure it out.
+    servers.  Values are in bytes.  Returns ``(0, None)`` if we couldn't figure it out.
     """
     end = 2
     # sometimes the volume is busy; so we try several times
@@ -84,9 +84,10 @@ def _user_quota(dir=None):
             return unknown
     except shell.CallError:
         return unknown
+    logging.debug("vos examine output was:\n\n" + "\n".join(result))
     try:
-        usage = int(result[0].split()[3])
-        limit = int(result[3].split()[1]) # XXX: FRAGILE
+        usage = int(result[0].split()[3]) * 1024
+        limit = int(result[3].split()[1]) * 1024 # XXX: FRAGILE
     except ValueError:
         raise QuotaParseError("vos examine output was:\n\n" + "\n".join(result))
     return (usage, limit)
index 3dc13779f7359eff2b4a84b3e64dbfe220b39333..67f4e9b87563fea25187969acdcf7f8fb62a0055 100644 (file)
@@ -212,6 +212,7 @@ class Upgrade(object):
     def preflightQuota(self):
         usage, limit = user.quota()
         if limit is not None and (limit - usage) < buffer:
+            logging.info("preflightQuota: limit = %d, usage = %d, buffer = %d", limit, usage, buffer)
             raise QuotaTooLow
 
     def merge(self):
index 0b6be56a255d4100e1b3c5e90c148c18a357efcb..fd81c071adcb201d074d1e3037cba035e935e60e 100644 (file)
@@ -86,7 +86,7 @@ def web(dir, url=None):
     if url:
         if isinstance(url, str):
             url = urlparse.urlparse(url)
-        logging.info("wizard.deploy.web: Using URL %s", url)
+        logging.info("wizard.deploy.web: Using default URL %s", url)
         yield url
         return
 
@@ -96,7 +96,7 @@ def web(dir, url=None):
         for r in f(dir):
             if isinstance(r, str):
                 r = urlparse.urlparse(r)
-            logging.info("wizard.deploy.web: Using URL %s", r)
+            logging.info("wizard.deploy.web: Using plugin-supplied URL %s", r)
             yield r
 
     # try the environment
@@ -108,7 +108,7 @@ def web(dir, url=None):
                 host,
                 path.rstrip('/'),
                 "", "", "")
-        logging.info("wizard.deploy.web: Using URL %s", r)
+        logging.info("wizard.deploy.web: Using environment URL %s", r)
         yield r
 
     logging.info("wizard.deploy.web: Exhausted URLs")