Author: gnichols
Date: 2011-07-15 16:32:48 +0000 (Fri, 15 Jul 2011)
New Revision: 1013
Modified:
trunk/v7/environment.py
Log:
521609 - v7 plan --server says server has error: /var/v7/export
Modified: trunk/v7/environment.py
===================================================================
--- trunk/v7/environment.py 2011-07-15 16:25:38 UTC (rev 1012)
+++ trunk/v7/environment.py 2011-07-15 16:32:48 UTC (rev 1013)
@@ -28,6 +28,8 @@
DocumentBase.__init__(self)
self.environmentFile = "/etc/v7.xml"
self.defaultDataDirectory = "/var/v7"
+ self.defaultServerDirectory = "/var/www/v7"
+ self.defaultExport = "export"
self.defaultDatabaseName = "results.xml"
self.defaultTaskFile = "tasks"
self.defaultLockFile = "/var/lock/subsys/v7"
@@ -57,15 +59,24 @@
# set up defaults
filesystemElement = self.findOrCreateElement(self.document.documentElement, Tags.file_system)
- filesystemElement.setAttribute(Attributes.maximum_attachment_size, "%u" % self.defaultMaximumAttachmentFileSize)
+ filesystemElement.setAttribute(Attributes.maximum_attachment_size, "%u" % self.defaultMaximumAttachmentFileSize)
filesystemElement.setAttribute(Attributes.results_warning_size, "%u" % self.defaultResultsWarningSize)
urlElement = self.findOrCreateElement(self.document.documentElement, Tags.urls)
+
+ # data-directory
element = self.findOrCreateElement(filesystemElement, Tags.data_directory)
self.setTextNode(element, self.defaultDataDirectory)
element.setAttribute(Attributes.database_name, self.defaultDatabaseName)
element.setAttribute(Attributes.task_file, self.defaultTaskFile)
element.setAttribute(Attributes.lock_file, self.defaultLockFile)
+
+ # server-directory
+ element = self.findOrCreateElement(filesystemElement, Tags.server_directory)
+ self.setTextNode(element, self.defaultServerDirectory)
+ element.setAttribute(Attributes.export, self.defaultExport)
+
+
element = self.findOrCreateElement(filesystemElement, Tags.store_directory)
self.setTextNode(element, self.defaultStoreDirectory)
element = self.findOrCreateElement(filesystemElement, Tags.source_directory)
@@ -106,6 +117,19 @@
dataDirectoryElement = self.findOrCreateElement(self._getFilesystemElement(), Tags.data_directory)
return self.getTextNode(dataDirectoryElement).data
+ def getServerDirectory(self):
+ serverDirectoryElement = self.findOrCreateElement(self._getFilesystemElement(), Tags.server_directory)
+ if not self.getTextNode(serverDirectoryElement):
+ self.setTextNode(serverDirectoryElement, self.defaultServerDirectory)
+ serverDirectoryElement.setAttribute(Attributes.export, self.defaultExport)
+ self.save(self.environmentFile)
+ return self.getTextNode(serverDirectoryElement).data
+
+ def getServerExport(self):
+ self.getServerDirectory() # so it gets created if not found
+ serverDirectoryElement = self.findOrCreateElement(self._getFilesystemElement(), Tags.server_directory)
+ return serverDirectoryElement.getAttribute(Attributes.export)
+
def getStoreDirectory(self):
storeDirectoryElement = self.findOrCreateElement(self._getFilesystemElement(), Tags.store_directory)
return self.getTextNode(storeDirectoryElement).data