Re: [PATCH] Fix preservation of format attrs for preexisting luks partitions. (#495848)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2009-04-20 at 18:23 -0500, David Lehman wrote:
> When carrying over the format's attributes we do not consider the
> possiblility that the partition is encrypted, in which case we want to
> preserve the attributes of the LUKSDevice's - not the PartitionDevice's -
> format. This was causing a traceback whenever a user tried to edit a
> preexisting encrypted partition.

It turns out that this is not related to bug 495848 but it still fixes
the traceback you invariably get if you try to edit a preexisting
encrypted partition.

> ---
>  iw/partition_dialog_gui.py |   25 ++++++++++++-------------
>  1 files changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
> index 03e9a59..1e99b64 100644
> --- a/iw/partition_dialog_gui.py
> +++ b/iw/partition_dialog_gui.py
> @@ -214,6 +214,12 @@ class PartitionEditor:
>              else:
>                  # preexisting partition, just set mount point and format flag
>                  request = self.origrequest
> +                if request.format.type == "luks":
> +                    usedev = self.storage.devicetree.getChildren(request)[0]
> +                else:
> +                    usedev = request
> +
> +                origformat = usedev.format
>                  mountpoint = self.mountCombo.get_children()[0].get_text()
>                  devicetree = self.anaconda.id.storage.devicetree
>  
> @@ -223,17 +229,10 @@ class PartitionEditor:
>  
>                         # carry over exists, migrate, size, and device
>                         # necessary for partition editor UI
> -                       try:
> -                           format = fmt_class(mountpoint=mountpoint,
> -                                              exists=request.format.exists,
> -                                              migrate=request.format.migrate,
> -                                              size=request.format.size,
> -                                              device=request.format.device)
> -                       except AttributeError:
> -                           format = fmt_class(mountpoint=mountpoint,
> -                                              exists=request.format.exists,
> -                                              migrate=request.format.migrate,
> -                                              device=request.format.device)
> +                       format = fmt_class(mountpoint=mountpoint,
> +                                          exists=origformat.exists,
> +                                          size=getattr(origformat, "size", None),
> +                                          device=usedev.path)
>  
>                         luksdev = None
>                         if self.fsoptionsDict.has_key("lukscb") and \
> @@ -245,7 +244,7 @@ class PartitionEditor:
>                             format = getFormat("luks",
>                                                device=self.origrequest.path,
>                                                passphrase=self.storage.encryptionPassphrase)
> -                       actions.append(ActionCreateFormat(request, format))
> +                       actions.append(ActionCreateFormat(usedev, format))
>                         if luksdev:
>                             actions.append(ActionCreateDevice(luksdev))
>                             actions.append(ActionCreateFormat(luksdev))
> @@ -266,7 +265,7 @@ class PartitionEditor:
>  
>                  if self.fsoptionsDict.has_key("migratecb") and \
>                     self.fsoptionsDict["migratecb"].get_active():
> -                    actions.append(ActionMigrateFormat(request))
> +                    actions.append(ActionMigrateFormat(usedev))
>  
>                  if self.fsoptionsDict.has_key("resizecb") and \
>                     self.fsoptionsDict["resizecb"].get_active():

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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux