Re: [master] Allow DeviceFormat.cacheMajorminor to fail without an exception.

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

 



> @@ -267,7 +267,15 @@ class DeviceFormat(object):
>              that happens for caching this.
>          """
>          self._majorminor = None
> -        return self.majorminor # this does the caching
> +        try:
> +            self.majorminor # this does the caching
> +        except StorageError:
> +            # entirely possible there's no majorminor, for instance an
> +            # LVMVolumeGroup has got no device node and no sysfs path.  In this
> +            # case obviously, calling majorminor of this object later raises an
> +            # exception.
> +            pass
> +        return self._majorminor
>  
>      def create(self, *args, **kwargs):
>          log_method_call(self, device=self.device,

This is some wacky syntax right here.  What's wrong with:

    try:
        return self.majorminor
    except StorageError:
        # comment
        return self._majorminor

> @@ -415,7 +423,11 @@ class DeviceFormat(object):
>              except DMError:
>                  device = self.device
>  
> -            sysfs_path = get_sysfs_path_by_name(device)
> +            try:
> +                sysfs_path = get_sysfs_path_by_name(device)
> +            except RuntimeError:
> +                raise StorageError("DeviceFormat.majorminor: "
> +                                   "can not get majorminor for '%s'" % device)
>              dev = udev_get_device(sysfs_path[4:])
>  
>              self._majorminor = "%03d%03d" %\

I see multiple bugs in bugzilla right now that this should address.  One
of them is marked as a blocker.

- Chris

_______________________________________________
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