https://fedorahosted.org/freeipa/ticket/5380

--
Martin^3 Babinsky
From ba12855e4ebf438425d41b79ae7e1269e482b75c Mon Sep 17 00:00:00 2001
From: Martin Babinsky <mbabi...@redhat.com>
Date: Thu, 10 Mar 2016 15:40:53 +0100
Subject: [PATCH] ipa-replica-manage: print traceback on unexpected error when
 in verbose mode

https://fedorahosted.org/freeipa/ticket/5380
---
 install/tools/ipa-replica-manage | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/install/tools/ipa-replica-manage b/install/tools/ipa-replica-manage
index 0497a0f0549b392216c654ab67d98cedbf122a4b..c0e19fcd667c78de1f8d3d024fcdb925733606b3 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:
@@ -1658,4 +1658,9 @@ except socket.timeout:
     sys.exit(1)
 except Exception as e:
     print("unexpected error: %s" % str(e))
+    if options.verbose:
+        sys.exit(traceback.format_exc())
+
+    print("re-run {} with --verbose option to get more information".format(
+        sys.argv[0]))
     sys.exit(1)
-- 
2.5.0

-- 
Manage your subscription for the Freeipa-devel mailing list:
https://www.redhat.com/mailman/listinfo/freeipa-devel
Contribute to FreeIPA: http://www.freeipa.org/page/Contribute/Code

Reply via email to