From 349955624e55e5afe23776a2c4f269da80cf917f Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Tue, 27 Nov 2018 16:21:06 -0800 Subject: [PATCH] Fix authselect invocations to work with 1.0.2 Since authselect 1.0.2, invoking an authselect command sequence like this: ['authselect', 'sssd', '', '--force'] does not work: authselect barfs on the empty string arg and errors out. We must only pass a features arg if we actually have 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. Signed-off-by: Adam Williamson --- ipaplatform/redhat/authconfig.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ipaplatform/redhat/authconfig.py b/ipaplatform/redhat/authconfig.py index a512345202..3de42cc365 100644 --- a/ipaplatform/redhat/authconfig.py +++ b/ipaplatform/redhat/authconfig.py @@ -166,7 +166,10 @@ def unconfigure( statestore.restore_state('authselect', 'features_list') or '' statestore.delete_state('authselect', 'mkhomedir') - cmd = [paths.AUTHSELECT, "select", profile, features, "--force"] + cmd = [paths.AUTHSELECT, "select", profile] + if features: + cmd.append(features) + cmd.append("--force") ipautil.run(cmd) def backup(self, path): @@ -187,9 +190,10 @@ 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.append("--force") ipautil.run(cmd) def set_nisdomain(self, nisdomain):