FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 04-19-2011, 04:34 PM
David Lehman
 
Default Add encrypted attribute to StorageDevice.

This attribute is True if the device, or any of the devices it is built
on, is encrypted.
---
pyanaconda/platform.py | 9 ++-------
pyanaconda/storage/devices.py | 14 ++++++++++++++
2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index 6004c92..1105b05 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -138,14 +138,9 @@ class Platform(object):
req.format.type not in self.bootFSTypes:
errors.append(_("The /boot filesystem cannot be of type %s.") % req.format.type)

- if req.type == "luks/dm-crypt":
- # Handle encrypted boot on a partition.
+ if req.encrypted:
+ # Handle /boot that is, or depends on devices that are, encrypted
errors.append(_("The /boot filesystem cannot be on an encrypted block device"))
- else:
- # Handle encrypted boot on more complicated devices.
- for dev in filter(lambda d: d.type == "luks/dm-crypt", self.anaconda.storage.devices):
- if req in self.anaconda.storage.deviceDeps(dev):
- errors.append(_("The /boot filesystem cannot be on an encrypted block device"))

errors.extend(self.checkDiskLabel(req))
return errors
diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
index b2d6dd8..d450a26 100644
--- a/pyanaconda/storage/devices.py
+++ b/pyanaconda/storage/devices.py
@@ -528,6 +528,20 @@ class StorageDevice(Device):
return _disks

@property
+ def encrypted(self):
+ """ True if this device, or any it requires, is encrypted. """
+ crypted = False
+ for parent in self.parents:
+ if parent.encrypted:
+ crypted = True
+ break
+
+ if not crypted and isinstance(self, DMCryptDevice):
+ crypted = True
+
+ return crypted
+
+ @property
def partedDevice(self):
if self.exists and self.status and not self._partedDevice:
log.debug("looking up parted Device: %s" % self.path)
--
1.7.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-19-2011, 09:39 PM
David Cantrell
 
Default Add encrypted attribute to StorageDevice.

Ack.

David Lehman <dlehman@redhat.com> wrote:

> This attribute is True if the device, or any of the devices it is built
> on, is encrypted.
> ---
> pyanaconda/platform.py | 9 ++-------
> pyanaconda/storage/devices.py | 14 ++++++++++++++
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
> index 6004c92..1105b05 100644
> --- a/pyanaconda/platform.py
> +++ b/pyanaconda/platform.py
> @@ -138,14 +138,9 @@ class Platform(object):
> req.format.type not in self.bootFSTypes:
> errors.append(_("The /boot filesystem cannot be of type %s.") % req.format.type)
>
> - if req.type == "luks/dm-crypt":
> - # Handle encrypted boot on a partition.
> + if req.encrypted:
> + # Handle /boot that is, or depends on devices that are, encrypted
> errors.append(_("The /boot filesystem cannot be on an encrypted block device"))
> - else:
> - # Handle encrypted boot on more complicated devices.
> - for dev in filter(lambda d: d.type == "luks/dm-crypt", self.anaconda.storage.devices):
> - if req in self.anaconda.storage.deviceDeps(dev):
> - errors.append(_("The /boot filesystem cannot be on an encrypted block device"))
>
> errors.extend(self.checkDiskLabel(req))
> return errors
> diff --git a/pyanaconda/storage/devices.py b/pyanaconda/storage/devices.py
> index b2d6dd8..d450a26 100644
> --- a/pyanaconda/storage/devices.py
> +++ b/pyanaconda/storage/devices.py
> @@ -528,6 +528,20 @@ class StorageDevice(Device):
> return _disks
>
> @property
> + def encrypted(self):
> + """ True if this device, or any it requires, is encrypted. """
> + crypted = False
> + for parent in self.parents:
> + if parent.encrypted:
> + crypted = True
> + break
> +
> + if not crypted and isinstance(self, DMCryptDevice):
> + crypted = True
> +
> + return crypted
> +
> + @property
> def partedDevice(self):
> if self.exists and self.status and not self._partedDevice:
> log.debug("looking up parted Device: %s" % self.path)
> --
> 1.7.3.4
>
> _______________________________________________
> Anaconda-devel-list mailing list
> Anaconda-devel-list@redhat.com
> https://www.redhat.com/mailman/listinfo/anaconda-devel-list

--
David Cantrell <dcantrell@redhat.com>
Supervisor, Installer Engineering Team
Red Hat, Inc. | Seattle, WA | UTC-7

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:41 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org