These two patches move another piece of code that is used only for sanity checking to Anaconda's codebase.
It's only used by sanity checking moved in commit c51e1eb4b280d299e4aa20df429a4754587d10a8.
Also tweak its name to fit in the coding style on the way.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- pyanaconda/storage_utils.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py index 1d3bf5e..329976e 100644 --- a/pyanaconda/storage_utils.py +++ b/pyanaconda/storage_utils.py @@ -314,7 +314,25 @@ def sanity_check(storage, min_ram=isys.MIN_RAM): if e: exns.append(SanityError(e))
- exns += storage._verifyLUKSDevicesHaveKey() + exns += verify_LUKS_devices_have_key(storage)
return exns
+ +def verify_LUKS_devices_have_key(storage): + """ + Verify that all non-existant LUKS devices have some way of obtaining + a key. + + Note: LUKS device creation will fail without a key. + + :rtype: generator of str + :returns: a generator of error messages, may yield no error messages + + """ + + for dev in (d for d in storage.devices if \ + d.format.type == "luks" and \ + not d.format.exists and \ + not d.format.hasKey): + yield LUKSDeviceWithoutKeyError(_("LUKS device %s has no encryption key") % (dev.name,))
----- Original Message -----
From: "Vratislav Podzimek" vpodzime@redhat.com To: anaconda-patches@lists.fedorahosted.org Sent: Wednesday, July 30, 2014 1:44:29 PM Subject: [PATCH] Move _verifyLUKSDevicesHaveKey to Anaconda's codebase
It's only used by sanity checking moved in commit c51e1eb4b280d299e4aa20df429a4754587d10a8.
Also tweak its name to fit in the coding style on the way.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
pyanaconda/storage_utils.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/pyanaconda/storage_utils.py b/pyanaconda/storage_utils.py index 1d3bf5e..329976e 100644 --- a/pyanaconda/storage_utils.py +++ b/pyanaconda/storage_utils.py @@ -314,7 +314,25 @@ def sanity_check(storage, min_ram=isys.MIN_RAM): if e: exns.append(SanityError(e))
- exns += storage._verifyLUKSDevicesHaveKey()
exns += verify_LUKS_devices_have_key(storage)
return exns
+def verify_LUKS_devices_have_key(storage):
- """
- Verify that all non-existant LUKS devices have some way of obtaining
- a key.
- Note: LUKS device creation will fail without a key.
- :rtype: generator of str
- :returns: a generator of error messages, may yield no error messages
- """
- for dev in (d for d in storage.devices if \
d.format.type == "luks" and \not d.format.exists and \not d.format.hasKey):yield LUKSDeviceWithoutKeyError(_("LUKS device %s has no encryptionkey") % (dev.name,))
1.9.3
anaconda-patches mailing list anaconda-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
And Ack.
- mulhern
They are only used by sanity check that has been moved to anaconda's codebase.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com --- blivet/__init__.py | 18 +----------------- blivet/errors.py | 3 --- 2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py index f2240ce..e16cc3a 100644 --- a/blivet/__init__.py +++ b/blivet/__init__.py @@ -70,7 +70,7 @@ import parted from pykickstart.constants import AUTOPART_TYPE_LVM, CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_LIST, CLEARPART_TYPE_NONE
from .storage_log import log_exception_info, log_method_call -from .errors import DeviceError, DirtyFSError, FSResizeError, FSTabTypeMismatchError, UnknownSourceDeviceError, StorageError, UnrecognizedFSTabEntryError, LUKSDeviceWithoutKeyError +from .errors import DeviceError, DirtyFSError, FSResizeError, FSTabTypeMismatchError, UnknownSourceDeviceError, StorageError, UnrecognizedFSTabEntryError from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName from .devicetree import DeviceTree from .deviceaction import ActionCreateDevice, ActionCreateFormat, ActionDestroyDevice, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat @@ -1546,22 +1546,6 @@ class Blivet(object):
return free
- def _verifyLUKSDevicesHaveKey(self): - """Verify that all non-existant LUKS devices have some way of obtaining - a key. - - Note: LUKS device creation will fail without a key. - - :rtype: generator of str - :returns: a generator of error messages, may yield no error messages - - """ - for dev in (d for d in self.devices if \ - d.format.type == "luks" and \ - not d.format.exists and \ - not d.format.hasKey): - yield LUKSDeviceWithoutKeyError(_("LUKS device %s has no encryption key") % (dev.name,)) - def dumpState(self, suffix): """ Dump the current device list to the storage shelf. """ key = "devices.%d.%s" % (time.time(), suffix) diff --git a/blivet/errors.py b/blivet/errors.py index d9f1f76..508e3ef 100644 --- a/blivet/errors.py +++ b/blivet/errors.py @@ -137,9 +137,6 @@ class LVMError(StorageError): class CryptoError(StorageError): pass
-class LUKSDeviceWithoutKeyError(StorageError): - pass - class MPathError(StorageError): pass
----- Original Message -----
From: "Vratislav Podzimek" vpodzime@redhat.com To: anaconda-patches@lists.fedorahosted.org Sent: Wednesday, July 30, 2014 1:47:26 PM Subject: [blivet] Move _verifyLUKSDevicesHaveKey and its exception to anaconda
They are only used by sanity check that has been moved to anaconda's codebase.
Signed-off-by: Vratislav Podzimek vpodzime@redhat.com
blivet/__init__.py | 18 +----------------- blivet/errors.py | 3 --- 2 files changed, 1 insertion(+), 20 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py index f2240ce..e16cc3a 100644 --- a/blivet/__init__.py +++ b/blivet/__init__.py @@ -70,7 +70,7 @@ import parted from pykickstart.constants import AUTOPART_TYPE_LVM, CLEARPART_TYPE_ALL, CLEARPART_TYPE_LINUX, CLEARPART_TYPE_LIST, CLEARPART_TYPE_NONE
from .storage_log import log_exception_info, log_method_call -from .errors import DeviceError, DirtyFSError, FSResizeError, FSTabTypeMismatchError, UnknownSourceDeviceError, StorageError, UnrecognizedFSTabEntryError, LUKSDeviceWithoutKeyError +from .errors import DeviceError, DirtyFSError, FSResizeError, FSTabTypeMismatchError, UnknownSourceDeviceError, StorageError, UnrecognizedFSTabEntryError from .devices import BTRFSDevice, BTRFSSubVolumeDevice, BTRFSVolumeDevice, DirectoryDevice, FileDevice, LVMLogicalVolumeDevice, LVMThinLogicalVolumeDevice, LVMThinPoolDevice, LVMVolumeGroupDevice, MDRaidArrayDevice, NetworkStorageDevice, NFSDevice, NoDevice, OpticalDevice, PartitionDevice, TmpFSDevice, devicePathToName from .devicetree import DeviceTree from .deviceaction import ActionCreateDevice, ActionCreateFormat, ActionDestroyDevice, ActionDestroyFormat, ActionResizeDevice, ActionResizeFormat @@ -1546,22 +1546,6 @@ class Blivet(object):
return free
- def _verifyLUKSDevicesHaveKey(self):
"""Verify that all non-existant LUKS devices have some way ofobtaining
a key.Note: LUKS device creation will fail without a key.:rtype: generator of str:returns: a generator of error messages, may yield no errormessages
"""for dev in (d for d in self.devices if \d.format.type == "luks" and \not d.format.exists and \not d.format.hasKey):yield LUKSDeviceWithoutKeyError(_("LUKS device %s has noencryption key") % (dev.name,))
- def dumpState(self, suffix): """ Dump the current device list to the storage shelf. """ key = "devices.%d.%s" % (time.time(), suffix)
diff --git a/blivet/errors.py b/blivet/errors.py index d9f1f76..508e3ef 100644 --- a/blivet/errors.py +++ b/blivet/errors.py @@ -137,9 +137,6 @@ class LVMError(StorageError): class CryptoError(StorageError): pass
-class LUKSDeviceWithoutKeyError(StorageError):
- pass
class MPathError(StorageError): pass
-- 1.9.3
anaconda-patches mailing list anaconda-patches@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
Ack.
- mulhern
anaconda-patches@lists.fedorahosted.org