mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2026-10-24 14:17:41 -05:00
ipatests: return result of kinit_as_user, pass raiseonerr parameter
Similar to kinit_admin, this allows to check for error values returned by kinit. Reviewed-By: Anuja More <amore@redhat.com>
This commit is contained in:
1 file changed
+8
-3
@@ -2118,7 +2118,7 @@ def run_command_as_user(host, user, command, *args, **kwargs):
|
||||
return host.run_command(command, *args, **kwargs)
|
||||
|
||||
|
||||
def kinit_as_user(host, user, password, krb5_trace=False):
|
||||
def kinit_as_user(host, user, password, krb5_trace=False, raiseonerr=True):
|
||||
"""Launch kinit as user on host.
|
||||
If krb5_trace, then set KRB5_TRACE=/dev/stdout and collect
|
||||
/var/lib/sss/pubconf/kdcinfo.$REALM
|
||||
@@ -2144,9 +2144,14 @@ def kinit_as_user(host, user, password, krb5_trace=False):
|
||||
# Retrieve kdc.$REALM after the password change, just in case SSSD
|
||||
# domain status flipped to online during the password change.
|
||||
get_kdcinfo(host)
|
||||
assert result.returncode == 0
|
||||
if raiseonerr:
|
||||
assert result.returncode == 0
|
||||
return result
|
||||
else:
|
||||
host.run_command(['kinit', user], stdin_text='{0}\n'.format(password))
|
||||
return host.run_command(
|
||||
['kinit', user],
|
||||
stdin_text='{0}\n'.format(password),
|
||||
raiseonerr=raiseonerr)
|
||||
|
||||
|
||||
def get_kdcinfo(host):
|
||||
|
||||
Reference in new issue
Block a user