diff options
author | Martin Babinsky <mbabinsk@redhat.com> | 2016-03-10 15:40:53 +0100 |
---|---|---|
committer | Martin Basti <mbasti@redhat.com> | 2016-03-22 13:01:37 +0100 |
commit | e7e1b8c58ed592e8957b4a25838a9e7814ddd01a (patch) | |
tree | f78f4c7654c287323740679f9d243da9be8d7ac9 /install/tools | |
parent | 49be6c8d3cc20902dbe8e92a74e31aed2fd21d9f (diff) | |
download | freeipa-e7e1b8c58ed592e8957b4a25838a9e7814ddd01a.tar.gz freeipa-e7e1b8c58ed592e8957b4a25838a9e7814ddd01a.tar.xz freeipa-e7e1b8c58ed592e8957b4a25838a9e7814ddd01a.zip |
ipa-replica-manage: print traceback on unexpected error when in verbose mode
Print the traceback to stdout to maintain backwards compatibility.
https://fedorahosted.org/freeipa/ticket/5380
Reviewed-By: Martin Basti <mbasti@redhat.com>
Diffstat (limited to 'install/tools')
-rwxr-xr-x | install/tools/ipa-replica-manage | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage index 075e4293e..6d1fc93c4 100755 --- a/install/tools/ipa-replica-manage +++ b/install/tools/ipa-replica-manage @@ -27,6 +27,7 @@ import re import ldap import socket import time +import traceback from six.moves.urllib.parse import urlparse @@ -1529,14 +1530,12 @@ def exit_on_managed_topology(what): "Please use `ipa topologysegment-*` commands to manage " "the topology.".format(what)) -def main(): +def main(options, args): if os.getegid() == 0: installutils.check_server_configuration() elif not os.path.exists(paths.IPA_DEFAULT_CONF): sys.exit("IPA is not configured on this system.") - options, args = parse_options() - # Just initialize the environment. This is so the installer can have # access to the plugin environment api_env = {'in_server' : True, @@ -1646,7 +1645,8 @@ def main(): nolookup=options.nolookup) try: - main() + options, args = parse_options() + main(options, args) except KeyboardInterrupt: sys.exit(1) except SystemExit as e: @@ -1657,5 +1657,13 @@ except socket.timeout: print("Connection timed out.") sys.exit(1) except Exception as e: - print("unexpected error: %s" % str(e)) + if options.verbose: + traceback.print_exc(file=sys.stdout) + else: + print( + "Re-run {} with --verbose option to get more information".format( + sys.argv[0]) + ) + + print("Unexpected error: %s" % str(e)) sys.exit(1) |