mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Make kadmin family of functions return the result of ipautil.run
This allows for diagnose the output and error code of these operations. Otherwise there is no way to infer their success or failure apart from inspecting logs post-mortem. https://fedorahosted.org/freeipa/ticket/6561 Reviewed-By: Pavel Vomacka <pvomacka@redhat.com>
This commit is contained in:
@@ -446,14 +446,17 @@ def get_directive(filename, directive, separator=' '):
|
||||
return None
|
||||
|
||||
def kadmin(command):
|
||||
ipautil.run(["kadmin.local", "-q", command,
|
||||
"-x", "ipa-setup-override-restrictions"])
|
||||
return ipautil.run(["kadmin.local", "-q", command,
|
||||
"-x", "ipa-setup-override-restrictions"],
|
||||
capture_output=True,
|
||||
capture_error=True)
|
||||
|
||||
|
||||
def kadmin_addprinc(principal):
|
||||
kadmin("addprinc -randkey " + principal)
|
||||
return kadmin("addprinc -randkey " + principal)
|
||||
|
||||
def kadmin_modprinc(principal, options):
|
||||
kadmin("modprinc " + options + " " + principal)
|
||||
return kadmin("modprinc " + options + " " + principal)
|
||||
|
||||
def create_keytab(path, principal):
|
||||
try:
|
||||
@@ -462,7 +465,7 @@ def create_keytab(path, principal):
|
||||
except os.error:
|
||||
root_logger.critical("Failed to remove %s." % path)
|
||||
|
||||
kadmin("ktadd -k " + path + " " + principal)
|
||||
return kadmin("ktadd -k " + path + " " + principal)
|
||||
|
||||
def resolve_ip_addresses_nss(fqdn):
|
||||
"""Get list of IP addresses for given host (using NSS/getaddrinfo).
|
||||
|
||||
Reference in New Issue
Block a user