[blivet] Never pass None to devicePathToName (#996303)

Anne Mulhern amulhern at redhat.com
Wed Mar 12 11:17:20 UTC 2014





----- Original Message -----
> From: "David Shea" <dshea at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Tuesday, March 11, 2014 4:53:14 PM
> Subject: [blivet] Never pass None to devicePathToName (#996303)
> 
> Provide a string default to getattr so that logging doesn't crash if
> there an error looking up partitions.
> ---
>  blivet/devices.py | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/blivet/devices.py b/blivet/devices.py
> index fb24b10..c2d1869 100644
> --- a/blivet/devices.py
> +++ b/blivet/devices.py
> @@ -1341,14 +1341,14 @@ class PartitionDevice(StorageDevice):
>              # getPartitionBySector doesn't work on extended partitions
>              _partition = _disklabel.extendedPartition
>              log.debug("extended lookup found partition %s"
> -                        % devicePathToName(getattr(_partition, "path",
> None)))
> +                        % devicePathToName(getattr(_partition, "path",
> "(none)")))
>          else:
>              # lookup the partition by sector to avoid the renumbering
>              # nonsense entirely
>              _sector = self.partedPartition.geometry.start
>              _partition = _disklabel.partedDisk.getPartitionBySector(_sector)
>              log.debug("sector-based lookup found partition %s"
> -                        % devicePathToName(getattr(_partition, "path",
> None)))
> +                        % devicePathToName(getattr(_partition, "path",
> "(none)")))
>  
>          self.partedPartition = _partition
>  
> --
> 1.8.5.3
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

What about changing devicePathToName() so that it handles None, instead?

- mulhern


More information about the anaconda-patches mailing list