]> scripts.mit.edu Git - wizard.git/commitdiff
Fix bad qualification, add better error message.
authorEdward Z. Yang <ezyang@mit.edu>
Sun, 1 Aug 2010 22:40:21 +0000 (18:40 -0400)
committerEdward Z. Yang <ezyang@mit.edu>
Sun, 1 Aug 2010 22:40:21 +0000 (18:40 -0400)
Signed-off-by: Edward Z. Yang <ezyang@mit.edu>
plugins/scripts/wizard_scripts.py
wizard/install/__init__.py

index 1dde2bd55b7eb73ee705c8153cfec749e9e023bb..8e582ee14531f577ff96c6ba34d245400a727a96 100644 (file)
@@ -163,6 +163,7 @@ class MysqlStrategy(install.Strategy):
     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:
@@ -180,6 +181,8 @@ class MysqlStrategy(install.Strategy):
         # 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):
@@ -194,3 +197,13 @@ 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."""
index 149dd34301c6a029188cc865fa6e42d7363b72f6..4f97f4067ac13d3ab0ce9804cf18e431c639624c 100644 (file)
@@ -144,7 +144,7 @@ class WebStrategy(Strategy):
             try:
                 self._url = urls.next() # pylint: disable-msg=E1101
             except StopIteration:
-                raise install.StrategyFailed
+                raise StrategyFailed
         except:
             os.rmdir(self.dir)
             raise