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
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
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):