[PATCH] Handle rpmdb open errors by throwing out the root candidate (#723167).

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

 



This will mostly occur because we're attempting to check a non-RPM system
to see if it can be upgraded or not.  It can't.
---
 pyanaconda/storage/__init__.py |   18 +++++++++++++++---
 pyanaconda/upgrade.py          |    2 +-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index 8e2cb6a..1b47ad2 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -1440,8 +1440,15 @@ def getReleaseString(mountpoint):
 
     # We get the arch from the initscripts package, but the version and name
     # must come from reading the release file.
-    # pylint: disable-msg=E1101
-    mi = ts.dbMatch('provides', 'initscripts')
+    try:
+        # pylint: disable-msg=E1101
+        mi = ts.dbMatch('provides', 'initscripts')
+    except:
+        # This could happen in a variety of cases, but the biggest one is we're
+        # examining an installed system that doesn't use RPM.  Raise an
+        # exception for the caller to handle.
+        raise ValueError
+
     for h in mi:
         relArch = h['arch']
         break
@@ -1500,7 +1507,12 @@ def findExistingRootDevices(anaconda, upgradeany=False):
             continue
 
         if os.access(anaconda.rootPath + "/etc/fstab", os.R_OK):
-            (arch, product, version) = getReleaseString(anaconda.rootPath)
+            try:
+                (arch, product, version) = getReleaseString(anaconda.rootPath)
+            except ValueError:
+                # This likely isn't our product, so don't even count it as
+                # notUpgradable.
+                continue
 
             if upgradeany or \
                anaconda.instClass.productUpgradable(arch, product, version):
diff --git a/pyanaconda/upgrade.py b/pyanaconda/upgrade.py
index bc5f977..e2756c5 100644
--- a/pyanaconda/upgrade.py
+++ b/pyanaconda/upgrade.py
@@ -32,7 +32,7 @@ import selinux
 from flags import flags
 from constants import *
 from product import productName
-from storage import findExistingRootDevices, getReleaseString
+from storage import findExistingRootDevices
 from storage import mountExistingSystem
 from storage.formats import getFormat
 
-- 
1.7.6

_______________________________________________
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