diff --git a/plugins/disks/disks.cs b/plugins/disks/disks.cs index 8857774..66870a4 100644 --- a/plugins/disks/disks.cs +++ b/plugins/disks/disks.cs @@ -7,7 +7,7 @@ - + diff --git a/plugins/disks/lang/en.hdf b/plugins/disks/lang/en.hdf index f30795a..1705bce 100644 --- a/plugins/disks/lang/en.hdf +++ b/plugins/disks/lang/en.hdf @@ -3,4 +3,8 @@ Link = Disks Title.Disks = Available disks -Text.NoDisksAvailable = No available disks were found! +AdviceMessage { + NoDisksAvailable { + Text = No available disks were found! + } +} diff --git a/plugins/volume_format_fs/format_fs.py b/plugins/volume_format_fs/format_fs.py deleted file mode 100644 index d42b734..0000000 --- a/plugins/volume_format_fs/format_fs.py +++ /dev/null @@ -1,96 +0,0 @@ -import cryptobox.plugins.base -from cryptobox.core.exceptions import * - -class format_fs(cryptobox.plugins.base.CryptoBoxPlugin): - - pluginCapabilities = [ "volume" ] - pluginVisibility = [ "volume" ] - requestAuth = True - rank = 60 - - ## map filesystem types to the appropriate arguments for 'mkfs' - fsTypes = { - "windows": "vfat", - "linux": "ext3" } - - containerTypes = [ "luks", "plain" ] - - - def doAction(self, store=None, fs_type="windows", container_type="luks", crypto_password=None, crypto_password2=None, confirm=None): - if not fs_type in self.fsTypes.keys(): - self.cbox.info - return "format_volume" - self.hdf[self.hdf_prefix + "fs_type"] = fs_type - self.hdf[self.hdf_prefix + "container_type"] = container_type - for t in self.fsTypes.keys(): - self.hdf[self.hdf_prefix + "fs_types." + t] = t - if store == "step1": - if not confirm: - self.cbox.log.warn("missing confirmation for formatting of filesystem: %s" % self.device) - self.hdf["Data.Warning"] = "Plugins.format_fs.FormatNotConfirmed" - return "volume_format" - if container_type == "luks": - return "volume_format_luks" - elif container_type == "plain": - return self.__format_plain(fs_type) - elif store == "step2": - if container_type == "luks": - return self.__format_luks(fs_type, crypto_password, crypto_password2) - else: - self.cbox.log.info("invalid input value for 'container_type': %s" % container_type) - return "volume_format" - elif store: - self.cbox.log.info("invalid input value for 'store': %s" % store) - return "volume_format" - else: - return "volume_format" - - - def getStatus(self): - return "no status" - - - def __format_plain(self, fsType): - try: - container = self.cbox.getContainer(self.device) - container.create(container.Types["plain"]) - except CBVolumeIsActive: - self.hdf["Data.Warning"] = "VolumeMayNotBeMounted" - self.cbox.log.info("initialization is not possible as long as the device (%s) is mounted" % self.device) - return None - except CBContainerError, errMsg: - self.hdf["Data.Warning"] = "Plugins.format_fs.FormatFailed" - self.cbox.log.warn("initialization of device '%s' failed" % self.device) - self.cbox.log.warn("reason: %s" % errMsg) - return "volume_format" - else: - self.cbox.log.info("successfully initialized device '%s'" % self.device) - return None - - - def __format_luks(self, fsType, pw, pw2): - if not pw: - self.hdf["Data.Warning"] = "EmptyPassword" - self.cbox.log.warn("no crypto password was supplied for initialization of device '%s'" % self.device) - return "volume_format" - if pw != pw2: - self.hdf["Data.Warning"] = "DifferentPasswords" - self.cbox.log.warn("the crypto password was not repeated correctly for initialization of device '%s'" % self.device) - return "volume_format" - container = self.cbox.getContainer(self.device) - try: - container.create(container.Types["luks"], pw) - except CBVolumeIsActive: - self.hdf["Data.Warning"] = "VolumeMayNotBeMounted" - self.cbox.log.info("initialization is not possible as long as the device (%s) is mounted" % self.device) - return None - except CBContainerError, errMsg: - self.hdf["Data.Warning"] = "Plugins.format_fs.FormatFailed" - self.cbox.log.warn("initialization of device '%s' failed" % self.device) - self.cbox.log.warn("reason: %s" % errMsg) - return "volume_format" - else: - self.hdf["Data.Success"] = "Plugins.format_fs.FormatSuccess" - self.cbox.log.info("successfully initialized device '%s'" % self.device) - return None - diff --git a/plugins/volume_format_fs/volume_format_fs.py b/plugins/volume_format_fs/volume_format_fs.py index 99af6a5..e1da9a3 100644 --- a/plugins/volume_format_fs/volume_format_fs.py +++ b/plugins/volume_format_fs/volume_format_fs.py @@ -1,5 +1,6 @@ import cryptobox.plugins.base from cryptobox.core.exceptions import * +import cryptobox.core.container as cbxContainer class volume_format_fs(cryptobox.plugins.base.CryptoBoxPlugin): @@ -53,7 +54,7 @@ class volume_format_fs(cryptobox.plugins.base.CryptoBoxPlugin): def __format_plain(self, fsType): try: container = self.cbox.getContainer(self.device) - container.create(container.Types["plain"]) + container.create(cbxContainer.ContainerTypes["plain"]) except CBVolumeIsActive: self.hdf["Data.Warning"] = "VolumeMayNotBeMounted" self.cbox.log.info("initialization is not possible as long as the device (%s) is mounted" % self.device) @@ -79,7 +80,7 @@ class volume_format_fs(cryptobox.plugins.base.CryptoBoxPlugin): return "volume_format" container = self.cbox.getContainer(self.device) try: - container.create(container.Types["luks"], pw) + container.create(cbxContainer.ContainerTypes["luks"], pw) except CBVolumeIsActive: self.hdf["Data.Warning"] = "VolumeMayNotBeMounted" self.cbox.log.info("initialization is not possible as long as the device (%s) is mounted" % self.device) diff --git a/plugins/volume_mount/volume_mount.py b/plugins/volume_mount/volume_mount.py index 827c274..52a9480 100644 --- a/plugins/volume_mount/volume_mount.py +++ b/plugins/volume_mount/volume_mount.py @@ -1,5 +1,6 @@ import cryptobox.plugins.base from cryptobox.core.exceptions import * +import cryptobox.core.container as cbxContainer class volume_mount(cryptobox.plugins.base.CryptoBoxPlugin): @@ -40,7 +41,7 @@ class volume_mount(cryptobox.plugins.base.CryptoBoxPlugin): self.hdf["Data.Warning"] = "Plugins.volume_mount.IsAlreadyMounted" self.cbox.log.info("the device (%s) is already mounted" % self.device) return "volume_status" - if self.container.getType() != self.container.Types["plain"]: + if self.container.getType() != cbxContainer.ContainerTypes["plain"]: ## not a plain container self.cbox.log.info("plugin 'volume_mount' - invalid container type") self.hdf["Data.Warning"] = "Plugins.volume_mount.InvalidContainerType" @@ -69,7 +70,7 @@ class volume_mount(cryptobox.plugins.base.CryptoBoxPlugin): self.dataset["Data.Warning"] = "EmptyPassword" self.log.info("no password was supplied for mounting of device: '%s'" % self.device) return "volume_status" - if self.container.getType() != self.container.Types["luks"]: + if self.container.getType() != cbxContainer.ContainerTypes["luks"]: ## not a luks container - fail silently self.cbox.log.info("plugin 'volume_mount' - invalid container type") return "volume_status"