Browse Source

* don't refresh the whole device list after each plugin run, but just refresh the current device

master
lars 13 years ago
parent
commit
864d7091f6
  1. 7
      src/cryptobox/core/main.py
  2. 1
      src/cryptobox/web/dataset.py
  3. 2
      src/cryptobox/web/sites.py

7
src/cryptobox/core/main.py

@ -145,7 +145,7 @@ class CryptoBox:
+ "appropriate line to '/etc/super.tab'?")
def reread_container_list(self):
def reread_container_list(self, reset_device=None):
"""Reinitialize the list of available containers.
This should be called whenever the available containers may have changed.
@ -153,7 +153,10 @@ class CryptoBox:
"""
self.log.debug("rereading container list")
self.__containers = []
blockdevice.CACHE.reset()
if reset_device is None:
blockdevice.CACHE.reset()
else:
blockdevice.CACHE.reset(reset_device)
for device in blockdevice.Blockdevices().get_storage_devices():
if self.is_device_allowed(device) and not self.is_config_partition(device):
self.__containers.append(cbxContainer.CryptoBoxContainer(device, self))

1
src/cryptobox/web/dataset.py

@ -171,7 +171,6 @@ class WebInterfaceDataset(dict):
del self[key]
avail_counter = 0
active_counter = 0
self.cbox.reread_container_list()
for container in self.cbox.get_container_list():
## useful if the container was changed during an action
container.reset_object()

2
src/cryptobox/web/sites.py

@ -354,6 +354,8 @@ class WebInterfaceSites:
## additionally: set the default template for plugins
if "volume" in plugin.plugin_capabilities:
## maybe the state of the current volume was changed?
cryptobox.core.blockdevice.CACHE.reset(plugin.device)
plugin.device.reset()
self.__dataset.set_current_disk_state(plugin.device)
if not next_template:
next_template = { "plugin":"volume_mount",

Loading…
Cancel
Save