Update PR #2610 patch to tiran's modified version

This commit is contained in:
Adam Williamson 2018-11-28 00:37:51 -08:00
parent 38293c2b0c
commit d489fe9ffe
2 changed files with 40 additions and 16 deletions

View File

@ -1,4 +1,4 @@
From 349955624e55e5afe23776a2c4f269da80cf917f Mon Sep 17 00:00:00 2001
From 66c57e6d92a9c5ca7b36ff125375810401e64233 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Tue, 27 Nov 2018 16:21:06 -0800
Subject: [PATCH] Fix authselect invocations to work with 1.0.2
@ -14,41 +14,62 @@ some text to go in it.
This broke uninstallation.
I don't know for sure whether the fix in `restore` is needed -
it may be that `cfg[1]` is never an empty sequence - but it
seems sensible to do it just in case.
In all cases, features are now passed as separate arguments instead of one
argument separated by space.
Fixes: https://pagure.io/freeipa/issue/7776
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
ipaplatform/redhat/authconfig.py | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
ipaplatform/redhat/authconfig.py | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/ipaplatform/redhat/authconfig.py b/ipaplatform/redhat/authconfig.py
index a512345202..3de42cc365 100644
index a512345202..9d98b5b644 100644
--- a/ipaplatform/redhat/authconfig.py
+++ b/ipaplatform/redhat/authconfig.py
@@ -166,7 +166,10 @@ def unconfigure(
statestore.restore_state('authselect', 'features_list') or ''
@@ -158,15 +158,26 @@ def unconfigure(
" ".join(args))
profile = 'sssd'
- features = ''
+ features = []
else:
- profile = \
- statestore.restore_state('authselect', 'profile') or 'sssd'
- features = \
- statestore.restore_state('authselect', 'features_list') or ''
+ profile = statestore.restore_state('authselect', 'profile')
+ if not profile:
+ profile = 'sssd'
+ features_state = statestore.restore_state(
+ 'authselect', 'features_list'
+ )
statestore.delete_state('authselect', 'mkhomedir')
+ # only non-empty features, https://pagure.io/freeipa/issue/7776
+ if features_state is not None:
+ features = [
+ f.strip() for f in features_state.split(' ') if f.strip()
+ ]
+ else:
+ features = []
- cmd = [paths.AUTHSELECT, "select", profile, features, "--force"]
+ cmd = [paths.AUTHSELECT, "select", profile]
+ if features:
+ cmd.append(features)
+ cmd.extend(features)
+ cmd.append("--force")
ipautil.run(cmd)
def backup(self, path):
@@ -187,9 +190,10 @@ def restore(self, path):
@@ -186,10 +197,9 @@ def restore(self, path):
if cfg:
profile = cfg[0]
-
- cmd = [
- paths.AUTHSELECT, "select", profile,
- " ".join(cfg[1]), "--force"]
+ cmd = [paths.AUTHSELECT, "select", profile]
+ if cfg[1]:
+ cmd.append(" ".join(cfg[1]))
+ cmd.extend(cfg[1])
+ cmd.append("--force")
ipautil.run(cmd)

View File

@ -132,7 +132,7 @@
Name: %{package_name}
Version: %{IPA_VERSION}
Release: 3%{?dist}
Release: 4%{?dist}
Summary: The Identity, Policy and Audit system
Group: System Environment/Base
@ -1736,6 +1736,9 @@ fi
%changelog
* Wed Nov 28 2018 Adam Williamson <awilliam@redhat.com> - 4.7.1-4
- Update PR #2610 patch to tiran's modified version
* Tue Nov 27 2018 Adam Williamson <awilliam@redhat.com> - 4.7.1-3
- Backport PR #2610 to fix for authselect 1.0.2+ (see #1645708)