import wizard
from wizard import deploy, shell, install, util, user
+def dummy_apps():
+ return [
+ "joomla", "e107", "gallery2", "advancedbook", "phpical",
+ "trac", "turbogears", "django", "rails",
+ # these are technically deprecated
+ "advancedpoll", "gallery",
+ ]
+
def deploy_web(dir):
# try the directory
homedir, _, web_path = dir.partition("/web_scripts")
return url
except shell.CallError:
pass
+ except OSError:
+ pass
+ return None
+
+def sql_drop(url):
+ if url.host == "sql.mit.edu":
+ try:
+ shell.call("/mit/scripts/sql/bin/drop-database", url.database)
+ return True
+ except shell.CallError:
+ pass
return None
def user_email(name):
- # XXX: simplistic install which doesn't work most of the time
+ # XXX: simplistic heuristic which doesn't work most of the time
+ # See Scripts #224 (this issue) and Scripts #193 (tracking a contact
+ # address)
return "%s@scripts.mit.edu" % name
def user_operator():
provides = frozenset(["dsn"])
def prepare(self):
"""Uses the SQL programs in the scripts locker"""
+ logging.info("Attempting wizard_scripts MySQL strategy")
if self.application.database != "mysql":
raise install.StrategyFailed
try:
self._triplet = shell.eval("/mit/scripts/sql/bin/get-password").split()
+ except OSError:
+ raise install.StrategyFailed
except shell.CallError:
raise install.StrategyFailed
if len(self._triplet) != 3:
# race condition
name = shell.eval("/mit/scripts/sql/bin/get-next-database", os.path.basename(self.dir))
database = shell.eval("/mit/scripts/sql/bin/create-database", name)
+ if not database:
+ raise CreateDatabaseError
options.dsn = sqlalchemy.engine.url.URL("mysql", username=username, password=password, host=host, database=database)
class EmailStrategy(install.Strategy):
def execute(self, options):
"""No-op."""
options.email = self._user + "@mit.edu"
+
+class CreateDatabaseError(wizard.Error):
+ """Could not create a database with the create-database script."""
+ def __str__(self):
+ return """
+
+ERROR: We were unable to create a database for you: this may indicate
+that you have exceeded your quota of databases or indicate a problem
+with the sql.mit.edu service. Please mail scripts@mit.edu with this
+error message."""