diff options
author | Chris Lumens <clumens@redhat.com> | 2009-05-05 10:38:52 -0400 |
---|---|---|
committer | Chris Lumens <clumens@redhat.com> | 2009-05-05 12:59:59 -0400 |
commit | a5cd5eec0b1e9b1423661adbda8362df828d8ac8 (patch) | |
tree | 434a8cf368e8b60bb1a0ae72e8ef869dae11e959 /bootloader.py | |
parent | 558fc6d437c348a36a0d48048bbd5b3898be7f42 (diff) | |
download | anaconda-a5cd5eec0b1e9b1423661adbda8362df828d8ac8.tar.gz anaconda-a5cd5eec0b1e9b1423661adbda8362df828d8ac8.tar.xz anaconda-a5cd5eec0b1e9b1423661adbda8362df828d8ac8.zip |
Handle that the default bootloader entry can sometimes be None (#496618).
In certain upgrade cases, the default bootloader entry will never be set
and so at the point where we write the new bootloader config, we'll hit a
traceback condition. Older versions of anaconda allowed the default entry
to be None here, so we need to do the same.
Diffstat (limited to 'bootloader.py')
-rw-r--r-- | bootloader.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bootloader.py b/bootloader.py index 17234585d..0c28c8ac8 100644 --- a/bootloader.py +++ b/bootloader.py @@ -146,7 +146,11 @@ def writeBootloader(anaconda): otherList = [] # getDefault needs to return a device, but that's too invasive for now. rootDev = anaconda.id.storage.fsset.rootDevice - defaultDev = anaconda.id.storage.devicetree.getDeviceByName(anaconda.id.bootloader.images.getDefault()) + + if not anaconda.id.bootloader.images.getDefault(): + defaultDev = None + else: + defaultDev = anaconda.id.storage.devicetree.getDeviceByName(anaconda.id.bootloader.images.getDefault()) kernelLabel = None kernelLongLabel = None @@ -155,7 +159,7 @@ def writeBootloader(anaconda): if (rootDev is None and kernelLabel is None) or (dev == rootDev.name): kernelLabel = label kernelLongLabel = longlabel - elif dev == defaultDev.name: + elif (not defaultDev and not dev) or (defaultDev and dev == defaultDev.name): otherList = [(label, longlabel, dev)] + otherList else: otherList.append((label, longlabel, dev)) @@ -184,7 +188,7 @@ def writeBootloader(anaconda): f.write("# UPDATEDEFAULT specifies if new-kernel-pkg should make\n" "# new kernels the default\n") # only update the default if we're setting the default to linux (#156678) - if rootDev.name == defaultDev.name: + if (not defaultDev and not rootDev) or (defaultDev and rootDev.name == defaultDev.name): f.write("UPDATEDEFAULT=yes\n") else: f.write("UPDATEDEFAULT=no\n") |