[CalendarServer-changes] [11849] CalendarServer/trunk

source_changes at macosforge.org source_changes at macosforge.org
Wed Mar 12 11:16:07 PDT 2014


Revision: 11849
          http://trac.calendarserver.org//changeset/11849
Author:   sagen at apple.com
Date:     2013-10-30 10:31:43 -0700 (Wed, 30 Oct 2013)
Log Message:
-----------
Avoid traceback spew from calendarserver_upgrade if the exception is only that we've not been configured to do an upgrade (since it's been passed -s)

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tap/util.py
    CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py

Modified: CalendarServer/trunk/calendarserver/tap/util.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/util.py	2013-10-30 16:55:51 UTC (rev 11848)
+++ CalendarServer/trunk/calendarserver/tap/util.py	2013-10-30 17:31:43 UTC (rev 11849)
@@ -95,6 +95,7 @@
 from txdav.common.datastore.sql import CommonDataStore as CommonSQLDataStore
 from txdav.common.datastore.file import CommonDataStore as CommonFileDataStore
 from txdav.common.datastore.sql import current_sql_schema
+from txdav.common.datastore.upgrade.sql.upgrade import NotAllowedToUpgrade
 from twext.python.filepath import CachingFilePath
 from urllib import quote
 from twisted.python.usage import UsageError
@@ -1077,7 +1078,8 @@
 
 
     def defaultStepWithFailure(self, failure):
-        log.failure("Step failure", failure=failure)
+        if failure.type != NotAllowedToUpgrade:
+            log.failure("Step failure", failure=failure)
         return failure
 
     # def protectStep(self, callback):

Modified: CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py
===================================================================
--- CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py	2013-10-30 16:55:51 UTC (rev 11848)
+++ CalendarServer/trunk/txdav/common/datastore/upgrade/sql/upgrade.py	2013-10-30 17:31:43 UTC (rev 11849)
@@ -73,8 +73,14 @@
         yield sqlTxn.releaseUpgradeLock()
         yield sqlTxn.commit()
 
-        
 
+class NotAllowedToUpgrade(Exception):
+    """
+    Exception indicating an upgrade is needed but we're not configured to
+    perform it.
+    """
+
+
 class UpgradeDatabaseCoreStep(object):
     """
     Base class for either schema or data upgrades on the database.
@@ -132,8 +138,7 @@
             self.log.error(msg)
             raise RuntimeError(msg)
         elif self.failIfUpgradeNeeded:
-                # TODO: change this exception to be upgrade-specific
-            raise RuntimeError("Database upgrade is needed but not allowed.")
+            raise NotAllowedToUpgrade()
         else:
             self.sqlStore.setUpgrading(True)
             yield self.upgradeVersion(actual_version, required_version, dialect)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140312/ab7915f9/attachment.html>


More information about the calendarserver-changes mailing list