fixed: name of volume is persistent after format

fixed: use 'cryptsetup luksUUID' to retrieve UUIDs of luks devices
added: analyse request URL andd add information to hdf dataset
added: attribute 'device' is persistent (like 'weblang') to allow redirects between volume plugins
changed: moved URLs of plugins from 'plugins/???' to '???' (flat hierarchie -> simple links)
added: new action for all plugins: "redirect" - call specific plugin after completing the current one
fixed: permission fix for vfat filesystems during mount / for ext2/3: after mount
regular checks for config partition (mount, if it becomes available)
This commit is contained in:
lars 2006-11-06 06:16:27 +00:00
parent 4df227a99d
commit 0c23c5e2c3
8 changed files with 225 additions and 94 deletions

View file

@ -14,13 +14,47 @@ class WebInterfaceDataset(dict):
self.prefs = prefs
self.cbox = cbox
self.__setConfigValues()
self.__setCryptoBoxState()
self.plugins = plugins
self.setCryptoBoxState()
self.setPluginData()
self.setContainersState()
def setPluginData(self):
self.__setPluginList(self.plugins)
def setCryptoBoxState(self):
import cherrypy
self["Data.Version"] = self.cbox.VERSION
langs = self.cbox.getAvailableLanguages()
langs.sort()
for (index, lang) in enumerate(langs):
self.cbox.log.info("language loaded: %s" % lang)
self["Data.Languages.%d.name" % index] = lang
self["Data.Languages.%d.link" % index] = self.__getLanguageName(lang)
try:
self["Data.ScriptURL.Prot"] = cherrypy.request.scheme
host = cherrypy.request.headers["Host"]
self["Data.ScriptURL.Host"] = host.split(":",1)[0]
complete_url = "%s://%s" % (self["Data.ScriptURL.Prot"], self["Data.ScriptURL.Host"])
try:
port = int(host.split(":",1)[1])
complete_url += ":%s" % port
except (IndexError, ValueError):
if cherrypy.request.scheme == "http":
port = 80
elif cherrypy.request.scheme == "https":
port = 443
else:
## unknown scheme -> port 0
self.cbox.log.info("unknown protocol scheme used: %s" % (cherrypy.request.scheme,))
port = 0
self["Data.ScriptURL.Port"] = port
## retrieve the relative address of the CGI (or the cherrypy base address)
## remove the last part of the url and add a slash
path = "/".join(cherrypy.request.path.split("/")[:-1]) + "/"
self["Data.ScriptURL.Path"] = path
complete_url += path
self["Data.ScriptURL"] = complete_url
except AttributeError:
self["Data.ScriptURL"] = ""
def setCurrentDiskState(self, device):
@ -42,6 +76,7 @@ class WebInterfaceDataset(dict):
self["Data.CurrentDisk.capacity.free"] = avail
self["Data.CurrentDisk.capacity.size"] = size
self["Data.CurrentDisk.capacity.percent"] = percent
self["Settings.LinkAttrs.device"] = device
def setContainersState(self):
@ -64,6 +99,19 @@ class WebInterfaceDataset(dict):
self["Data.activeDisksCount"] = active_counter
def setPluginData(self):
for p in self.plugins:
lang_data = p.getLanguageData()
entryName = "Settings.PluginList." + p.getName()
self[entryName] = p.getName()
self[entryName + ".Link"] = lang_data.getValue("Link", p.getName())
self[entryName + ".Rank"] = p.getRank()
self[entryName + ".RequestAuth"] = p.isAuthRequired() and "1" or "0"
self[entryName + ".Enabled"] = p.isEnabled() and "1" or "0"
for a in p.pluginCapabilities:
self[entryName + ".Types." + a] = "1"
def __setConfigValues(self):
self["Settings.TemplateDir"] = os.path.abspath(self.prefs["Locations"]["TemplateDir"])
self["Settings.LanguageDir"] = os.path.abspath(self.prefs["Locations"]["LangDir"])
@ -74,12 +122,6 @@ class WebInterfaceDataset(dict):
self["Settings.SettingsDir"] = self.prefs["Locations"]["SettingsDir"]
def __setCryptoBoxState(self):
self["Data.Version"] = self.cbox.VERSION
for lang in self.cbox.getAvailableLanguages():
self["Data.Languages." + lang] = self.__getLanguageName(lang)
def __getLanguageName(self, lang):
try:
import neo_cgi, neo_util, neo_cs
@ -91,16 +133,4 @@ class WebInterfaceDataset(dict):
return hdf.getValue("Name",lang)
def __setPluginList(self, plugins):
for p in plugins:
lang_data = p.getLanguageData()
entryName = "Settings.PluginList." + p.getName()
self[entryName] = p.getName()
self[entryName + ".Link"] = lang_data.getValue("Link", p.getName())
self[entryName + ".Rank"] = p.getRank()
self[entryName + ".RequestAuth"] = p.isAuthRequired() and "1" or "0"
self[entryName + ".Enabled"] = p.isEnabled() and "1" or "0"
for a in p.pluginCapabilities:
self[entryName + ".Types." + a] = "1"