]> scripts.mit.edu Git - wizard.git/commitdiff
Add inclusions and exclusions for web verification.
authorEdward Z. Yang <ezyang@mit.edu>
Sat, 6 Feb 2010 23:49:46 +0000 (18:49 -0500)
committerEdward Z. Yang <ezyang@mit.edu>
Sat, 6 Feb 2010 23:50:44 +0000 (18:50 -0500)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
wizard/app/__init__.py
wizard/app/mediawiki.py
wizard/app/wordpress.py

index f1ad52bd7572418f8f1c2217474860f9628d37dd..ae99e3e58dfa34aebe3916c4f370f186a2bcfe00 100644 (file)
@@ -373,11 +373,15 @@ class Application(object):
             not to depend on pages that are not the main page.
         """
         raise NotImplementedError
-    def checkWebPage(self, deployment, page, *outputs):
+    def checkWebPage(self, deployment, page, outputs=[], exclude=[]):
         """
         Checks if a given page of an autoinstall contains a particular string.
         """
         page = deployment.fetch(page)
+        for x in exclude:
+            if page.find(x) != -1:
+                logging.info("checkWebPage (failed due to %s):\n\n%s", x, page)
+                return False
         votes = 0
         for output in outputs:
             votes += page.find(output) != -1
index 8c874e0f2d7734ab8534d2671e640aecb6f87938..7b355afbf9562caea28493cabd450cabbdb4fa3a 100644 (file)
@@ -39,7 +39,7 @@ class Application(app.Application):
     def detectVersion(self, deployment):
         return self.detectVersionFromFile("includes/DefaultSettings.php", php.re_var("wgVersion"))
     def checkWeb(self, deployment):
-        return self.checkWebPage(deployment, "/index.php?title=Main_Page", "<!-- Served")
+        return self.checkWebPage(deployment, "/index.php?title=Main_Page", outputs=["<!-- Served"])
     def install(self, version, options):
         util.soft_unlink("LocalSettings.php")
         os.chmod("config", 0777) # XXX: vaguely sketchy
index 227d7da5c0e019286b6facd4f23531b2454a42e2..00352090553a1e237ac28f5829cc627a0912fe32 100644 (file)
@@ -41,7 +41,9 @@ class Application(app.Application):
         return os.path.isfile("wp-config.php")
     def checkWeb(self, deployment):
         # XXX: this sucks pretty hard
-        return self.checkWebPage(deployment, "", "<html", "WordPress", "feed")
+        return self.checkWebPage(deployment, "",
+                outputs=["<html", "WordPress", "feed"],
+                exclude=["Error establishing a database connection"])
     def detectVersion(self, deployment):
         return self.detectVersionFromFile("wp-includes/version.php", php.re_var("wp_version"))
     def install(self, version, options):