kdump-anaconda-addon/use-kernel-arguments-instead-of-cmdline.patch
2021-08-07 10:31:04 +08:00

108 lines
4.0 KiB
Diff

From 5b9a9528e744a040ef1650cd31d8a1d20ccd341b Mon Sep 17 00:00:00 2001
From: Vladimir Slavik <vslavik@redhat.com>
Date: Wed, 8 Jan 2020 20:04:38 +0100
Subject: [PATCH] Use kernel_arguments instead of cmdline
Changes all usages of pyanaconda.flags.cmdline to
pyanaconda.kernel.kernel_arguments.
Requires pyanaconda >=32.18
---
com_redhat_kdump/gui/spokes/kdump.py | 4 ++--
com_redhat_kdump/ks/kdump.py | 7 ++++---
com_redhat_kdump/tui/spokes/kdump.py | 4 ++--
test/unittests/utils.py | 2 +-
4 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/com_redhat_kdump/gui/spokes/kdump.py b/com_redhat_kdump/gui/spokes/kdump.py
index c8f5c9b..01dfb0b 100644
--- a/com_redhat_kdump/gui/spokes/kdump.py
+++ b/com_redhat_kdump/gui/spokes/kdump.py
@@ -24,7 +24,7 @@
import os.path
from gi.repository import Gtk
-from pyanaconda.flags import flags
+from pyanaconda.core.kernel import kernel_arguments
from pyanaconda.ui.categories.system import SystemCategory
from pyanaconda.ui.gui.spokes import NormalSpoke
from pyanaconda.ui.gui.utils import fancy_set_sensitive
@@ -51,7 +51,7 @@ class KdumpSpoke(NormalSpoke):
@classmethod
def should_run(cls, environment, data):
# the KdumpSpoke should run only if requested
- return flags.cmdline.getbool("kdump_addon", default=False)
+ return kernel_arguments.is_enabled("kdump_addon")
def __init__(self, *args):
NormalSpoke.__init__(self, *args)
diff --git a/com_redhat_kdump/ks/kdump.py b/com_redhat_kdump/ks/kdump.py
index 0adb5e5..09f727b 100644
--- a/com_redhat_kdump/ks/kdump.py
+++ b/com_redhat_kdump/ks/kdump.py
@@ -23,7 +23,7 @@
from pyanaconda.addons import AddonData
from pyanaconda.core import util
from pyanaconda.core.configuration.anaconda import conf
-from pyanaconda.flags import flags
+from pyanaconda.core.kernel import kernel_arguments
from pyanaconda.modules.common.constants.services import STORAGE
from pyanaconda.modules.common.constants.objects import BOOTLOADER
@@ -67,9 +67,10 @@ def __str__(self):
def setup(self, storage, ksdata, payload):
# the kdump addon should run only if requested
- if not flags.cmdline.getbool("kdump_addon", default=False):
+ if not kernel_arguments.is_enabled("kdump_addon"):
return
+
bootloader_proxy = STORAGE.get_proxy(BOOTLOADER)
# Clear any existing crashkernel bootloader arguments
@@ -139,7 +140,7 @@ def handle_header(self, lineno, args):
def execute(self, storage, ksdata, users, payload):
# the KdumpSpoke should run only if requested
- if not flags.cmdline.getbool("kdump_addon", default=False) or not self.enabled:
+ if not kernel_arguments.is_enabled("kdump_addon") or not self.enabled:
return
action = "enable"
diff --git a/com_redhat_kdump/tui/spokes/kdump.py b/com_redhat_kdump/tui/spokes/kdump.py
index 871f71d..c35fd0f 100644
--- a/com_redhat_kdump/tui/spokes/kdump.py
+++ b/com_redhat_kdump/tui/spokes/kdump.py
@@ -24,7 +24,7 @@
import os.path
import re
-from pyanaconda.flags import flags
+from pyanaconda.core.kernel import kernel_arguments
from pyanaconda.ui.categories.system import SystemCategory
from pyanaconda.ui.tui.spokes import NormalTUISpoke
from pyanaconda.ui.tui.tuiobject import Dialog
@@ -54,7 +54,7 @@ def __init__(self, *args):
@classmethod
def should_run(cls, environment, data):
# the KdumpSpoke should run only if requested
- return flags.cmdline.getbool("kdump_addon", default=False)
+ return kernel_arguments.is_enabled("kdump_addon")
def apply(self):
pass
diff --git a/test/unittests/utils.py b/test/unittests/utils.py
index 64ae1a0..10ba8c7 100644
--- a/test/unittests/utils.py
+++ b/test/unittests/utils.py
@@ -4,7 +4,7 @@
from com_redhat_kdump import common
def enable_kdump_addon_in_anaconda():
- return patch('pyanaconda.flags.cmdline.getbool', return_value=True)
+ return patch('pyanaconda.kernel.kernel_arguments.is_enabled', return_value=True)
class KdumpTestCase(unittest.TestCase):
def setUp(self):