71 lines
3.2 KiB
Diff
71 lines
3.2 KiB
Diff
From 4b9f1f8c5b907c2d4169712a60ccba795274528d Mon Sep 17 00:00:00 2001
|
|
From: Petr Stodulka <pstodulk@redhat.com>
|
|
Date: Tue, 4 Aug 2020 12:22:11 +0200
|
|
Subject: [PATCH] Rollbacks: ignore grub errors on non-intel arches
|
|
|
|
Previous logic around BIOS / EFI bootloader files detection caused
|
|
issues on non-intel arches - which are supposed to use different
|
|
bootloaders. In this case, set just one of paths for the grub conf
|
|
file and do not care about any additional actions (don't do any) on
|
|
non-intel arches.
|
|
---
|
|
redhat_upgrade_tool/__init__.py | 11 +++++++----
|
|
redhat_upgrade_tool/rollback/bootloader.py | 10 ++++++----
|
|
2 files changed, 13 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/redhat_upgrade_tool/__init__.py b/redhat_upgrade_tool/__init__.py
|
|
index 48ef27e..dc36e2d 100644
|
|
--- a/redhat_upgrade_tool/__init__.py
|
|
+++ b/redhat_upgrade_tool/__init__.py
|
|
@@ -33,6 +33,7 @@ Your pal,
|
|
|
|
import logging
|
|
import os
|
|
+import platform
|
|
from .logutils import NullHandler
|
|
log = logging.getLogger(__package__)
|
|
log.addHandler(NullHandler())
|
|
@@ -89,11 +90,13 @@ def detect_grub_conf():
|
|
grub_conf_file = _BIOS_GRUB_CONF_PATH
|
|
_non_grub_file = _EFI_GRUB_CONF_PATH
|
|
if not os.path.exists(grub_conf_file) or not os.path.getsize(grub_conf_file):
|
|
- # that's fatal error. It shouldn't happened
|
|
- raise Exception(
|
|
- "The expected grub configuration file doesn't exist or it is empty: %s" % grub_conf_file)
|
|
+ # this could happen typically on non-intel arch; ignore non-intel arch
|
|
+ if platform.machine() == "x86_64":
|
|
+ # that's fatal error. It shouldn't happened
|
|
+ raise Exception(
|
|
+ "The expected grub configuration file doesn't exist or it is empty: %s" % grub_conf_file)
|
|
|
|
- if os.path.exists(_non_grub_file):
|
|
+ if os.path.exists(_non_grub_file) and platform.machine() == "x86_64":
|
|
# it's wrong that both files exist, if it's empty, remove it,
|
|
# otherwise rename it
|
|
if not os.path.getsize(_non_grub_file):
|
|
diff --git a/redhat_upgrade_tool/rollback/bootloader.py b/redhat_upgrade_tool/rollback/bootloader.py
|
|
index bad16d1..50152e5 100644
|
|
--- a/redhat_upgrade_tool/rollback/bootloader.py
|
|
+++ b/redhat_upgrade_tool/rollback/bootloader.py
|
|
@@ -27,11 +27,13 @@ except ImportError:
|
|
grub_conf_file = _BIOS_GRUB_CONF_PATH
|
|
_non_grub_file = _EFI_GRUB_CONF_PATH
|
|
if not os.path.exists(grub_conf_file) or not os.path.getsize(grub_conf_file):
|
|
- # that's fatal error. It shouldn't happened
|
|
- raise Exception(
|
|
- "The expected grub configuration file doesn't exist or it is empty: %s" % grub_conf_file)
|
|
+ # this could happen typically on non-intel arch; ignore non-intel arch
|
|
+ if platform.machine() == "x86_64":
|
|
+ # that's fatal error. It shouldn't happened
|
|
+ raise Exception(
|
|
+ "The expected grub configuration file doesn't exist or it is empty: %s" % grub_conf_file)
|
|
|
|
- if os.path.exists(_non_grub_file):
|
|
+ if os.path.exists(_non_grub_file) and platform.machine() == "x86_64":
|
|
# it's wrong that both files exist, if it's empty, remove it,
|
|
# otherwise rename it
|
|
if not os.path.getsize(_non_grub_file):
|
|
--
|
|
2.25.4
|
|
|