[PATCH 03/11] Device class does not have a format member

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

 



The packages property in the Device class references format.packages, but
format is not a member of Device (only of StorageDevice and derived classes),
and format may be None.

This error was caught by pylint and chances are we will never hit it, still
it is better to fix it.
---
 storage/devices.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/storage/devices.py b/storage/devices.py
index 2be684f..37ec420 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -357,15 +357,17 @@ class Device(object):
             devices.
         """
         packages = self._packages
-        packages.extend(self.format.packages)
+        if getattr(self, "format", None):
+            packages.extend(self.format.packages)
         for parent in self.parents:
             for package in parent.packages:
                 if package not in packages:
                     packages.append(package)
 
-            for package in parent.format.packages:
-                if package not in packages:
-                    packages.append(package)
+            if getattr(parent, "format", None):
+                for package in parent.format.packages:
+                    if package not in packages:
+                        packages.append(package)
 
         return packages
 
-- 
1.6.4

_______________________________________________
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