[CalendarServer-changes] [14704] CalendarServer/branches/release/CalendarServer-6.1-dev/ calendarserver
source_changes at macosforge.org
source_changes at macosforge.org
Fri Apr 24 09:56:08 PDT 2015
Revision: 14704
http://trac.calendarserver.org//changeset/14704
Author: sagen at apple.com
Date: 2015-04-24 09:56:08 -0700 (Fri, 24 Apr 2015)
Log Message:
-----------
Post server alert for phantom volume, not just missing volume
Modified Paths:
--------------
CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tap/caldav.py
CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tools/util.py
Modified: CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tap/caldav.py 2015-04-24 14:34:30 UTC (rev 14703)
+++ CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tap/caldav.py 2015-04-24 16:56:08 UTC (rev 14704)
@@ -24,7 +24,7 @@
import sys
from collections import OrderedDict
-from os import getuid, getgid, umask, remove, environ, stat, chown
+from os import getuid, getgid, umask, remove, environ, stat, chown, W_OK
from os.path import exists, basename
import socket
from stat import S_ISSOCK
@@ -1416,6 +1416,15 @@
config.addPostUpdateHooks((agentPostUpdateHook,))
config.reload()
+ # Verify that server root actually exists and is not phantom
+ from calendarserver.tools.util import checkDirectory
+ checkDirectory(
+ config.ServerRoot,
+ "Server root",
+ access=W_OK,
+ wait=True # Wait in a loop until ServerRoot exists and is not phantom
+ )
+
# These we need to set in order to open the store
config.EnableCalDAV = config.EnableCardDAV = True
Modified: CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tools/util.py
===================================================================
--- CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tools/util.py 2015-04-24 14:34:30 UTC (rev 14703)
+++ CalendarServer/branches/release/CalendarServer-6.1-dev/calendarserver/tools/util.py 2015-04-24 16:56:08 UTC (rev 14704)
@@ -31,6 +31,8 @@
from grp import getgrnam
from uuid import UUID
+from calendarserver.tools import diagnose
+
from twistedcaldav.config import config, ConfigurationError
from twistedcaldav.stdconfig import DEFAULT_CONFIG_FILE
@@ -137,18 +139,21 @@
# Note: we have to use print here because the logging mechanism has not
# been set up yet.
- if not os.path.exists(dirpath):
+ if not os.path.exists(dirpath) or (diagnose.detectPhantomVolume(dirpath) == diagnose.EXIT_CODE_PHANTOM_DATA_VOLUME):
if wait:
# If we're being told to wait, post an alert that we can't continue
# until the volume is mounted
- if not os.path.exists(dirpath):
+ if not os.path.exists(dirpath) or (diagnose.detectPhantomVolume(dirpath) == diagnose.EXIT_CODE_PHANTOM_DATA_VOLUME):
from calendarserver.tap.util import postAlert
postAlert("MissingDataVolumeAlert", ["volumePath", dirpath])
- while not os.path.exists(dirpath):
- print("Path does not exist: %s" % (dirpath,))
+ while not os.path.exists(dirpath) or (diagnose.detectPhantomVolume(dirpath) == diagnose.EXIT_CODE_PHANTOM_DATA_VOLUME):
+ if not os.path.exists(dirpath):
+ print("Path does not exist: %s" % (dirpath,))
+ else:
+ print("Path is not a real volume: %s" % (dirpath,))
sleep(5)
else:
try:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150424/fb98b224/attachment.html>
More information about the calendarserver-changes
mailing list