diff options
author | Martin Babinsky <mbabinsk@redhat.com> | 2016-12-15 17:09:12 +0100 |
---|---|---|
committer | Martin Babinsky <mbabinsk@redhat.com> | 2016-12-16 10:37:49 +0100 |
commit | f59673506493e0199c17000538adb7c80b477aa0 (patch) | |
tree | 8698106dbe333f3100a1a3a0958b6f37d84619bd | |
parent | 73f33569c8893610e246b2f44a7aeaec872b37e6 (diff) | |
download | freeipa-f59673506493e0199c17000538adb7c80b477aa0.tar.gz freeipa-f59673506493e0199c17000538adb7c80b477aa0.tar.xz freeipa-f59673506493e0199c17000538adb7c80b477aa0.zip |
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>
-rw-r--r-- | ipaserver/install/installutils.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ipaserver/install/installutils.py b/ipaserver/install/installutils.py index a6cde89d3..e7fd69fcd 100644 --- a/ipaserver/install/installutils.py +++ b/ipaserver/install/installutils.py @@ -450,14 +450,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: @@ -466,7 +469,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). |