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.

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>
Reviewed-By: Alexander Bokovoy <abokovoy@redhat.com>
This commit is contained in:
Adam Williamson 2018-11-27 16:21:06 -08:00 committed by Christian Heimes
parent 8c650add34
commit 7aceca2da4

View File

@ -158,15 +158,26 @@ class RedHatAuthSelect(RedHatAuthToolBase):
" ".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]
cmd.extend(features)
cmd.append("--force")
ipautil.run(cmd)
def backup(self, path):
@ -186,10 +197,9 @@ class RedHatAuthSelect(RedHatAuthToolBase):
if cfg:
profile = cfg[0]
cmd = [
paths.AUTHSELECT, "select", profile,
" ".join(cfg[1]), "--force"]
cmd = [paths.AUTHSELECT, "select", profile]
cmd.extend(cfg[1])
cmd.append("--force")
ipautil.run(cmd)
def set_nisdomain(self, nisdomain):