1713109: fix the initial-setup addon for anaconda >= 30

This commit is contained in:
Adam Williamson 2019-05-24 12:40:02 -07:00
parent 17e2081b3e
commit 9abe4f7f8d
2 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,66 @@
From de4268203e9872d60dd5a99e0db7346568c2b36e Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Fri, 24 May 2019 12:01:31 -0700
Subject: [PATCH] Anaconda addon: setup() and execute() no longer get instclass
Since anaconda commit
https://github.com/rhinstaller/anaconda/commit/78fd1e82 ,
anaconda addons should no longer expect an install class to be
passed to their setup() and execute() methods. Without this fix,
the addon breaks recent versions of anaconda. As the policy
for this tool seems to be that the most recent version is sent
to all Fedora releases (and RHEL releases?), I implemented this
in such a way that it will work with both old and new anaconda.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1713109
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
.../ks/rhsm_ks.py | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/src/initial-setup/com_redhat_subscription_manager/ks/rhsm_ks.py b/src/initial-setup/com_redhat_subscription_manager/ks/rhsm_ks.py
index 0d5724b0..f7cf8392 100644
--- a/src/initial-setup/com_redhat_subscription_manager/ks/rhsm_ks.py
+++ b/src/initial-setup/com_redhat_subscription_manager/ks/rhsm_ks.py
@@ -147,21 +147,35 @@ class RHSMAddonData(AddonData):
def __str__(self):
return "%%addon %s %s\n%s%%end\n" % (self.name, self.header_args, self.content)
- def setup(self, storage, ksdata, instclass, payload):
+ def setup(self, *args, **kwargs):
"""Make the changes to the install system.
This method is called before the installation
is started and directly from spokes. It must be possible
to call it multiple times without breaking the environment."""
+ # we use the signature we do because anaconda before commit
+ # 78fd1e82 passes (storage, ksdata, instClass, payload)
+ # but anaconda after 78fd1e82 passes only
+ # (storage, ksdata, payload). If this method *did*
+ # anything we would have to figure out which args we'd got and
+ # handle them appropriately, but since it does nothing, we
+ # don't have to bother with that.
pass
- def execute(self, storage, ksdata, instClass, users, payload):
+ def execute(self, *args, **kwargs):
"""Make the changes to the underlying system.
This method is called only once in the post-install
setup phase.
"""
+ # we use the signature we do because anaconda before commit
+ # 78fd1e82 passes (storage, ksdata, instClass, users, payload)
+ # but anaconda after 78fd1e82 passes only
+ # (storage, ksdata, users, payload). If this method *did*
+ # anything we would have to figure out which args we'd got and
+ # handle them appropriately, but since it does nothing, we
+ # don't have to bother with that.
log.debug("Read RHSM ks info, but non gui ks is currently not implemented.")
def handle_header(self, lineno, args):
--
2.21.0

View File

@ -139,7 +139,7 @@
Name: subscription-manager
Version: 1.25.5
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Tools and libraries for subscription and repository management
Group: System Environment/Base
License: GPLv2
@ -159,6 +159,10 @@ Source1: %{name}-cockpit-%{version}.tar.gz
%if 0%{?suse_version}
Source2: subscription-manager-rpmlintrc
%endif
# https://github.com/candlepin/subscription-manager/pull/2092
# Fix the initial-setup addon for anaconda > 30
# https://bugzilla.redhat.com/show_bug.cgi?id=1713109
Patch0: 0001-Anaconda-addon-setup-and-execute-no-longer-get-instc.patch
%if (0%{?suse_version} && 0%{?suse_version} < 1200)
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -530,6 +534,7 @@ Subscription Manager Cockpit UI
%prep
%setup -q
%patch0 -p1
%build
make -f Makefile VERSION=%{version}-%{release} CFLAGS="%{optflags}" \
@ -1165,6 +1170,9 @@ gtk-update-icon-cache -f %{_datadir}/icons/hicolor &>/dev/null || :
%endif
%changelog
* Fri May 24 2019 Adam Williamson <awilliam@redhat.com> - 1.25.5-2
- 1713109: fix the initial-setup addon for anaconda >= 30
* Tue May 07 2019 Christopher Snyder <csnyder@redhat.com> 1.25.5-1
- 1700445: Do not disabled repos in redhat.repo; ENT-1261 (jhnidek@redhat.com)