diff roundup/admin.py @ 8540:e8d1da6e3571

bug: fix traceback in roundup-admin init with bad config values initialize accepts setting values for config.ini file settings. If they are not valid, you got a python traceback. ConfigurationError exceptions are now trapped. The admin.py's usageError_feedback method is used to inform the user. Also the feedback message now starts with a newline making it easier to read by separating it from command that caused the issue.
author John Rouillard <rouilj@ieee.org>
date Mon, 23 Mar 2026 13:18:41 -0400
parents b09ef85f0da6
children 7a7f6ee0a09e
line wrap: on
line diff
--- a/roundup/admin.py	Sun Mar 22 22:40:11 2026 -0400
+++ b/roundup/admin.py	Mon Mar 23 13:18:41 2026 -0400
@@ -39,6 +39,7 @@
 from roundup.anypy.my_input import my_input
 from roundup.anypy.strings import repr_export
 from roundup.configuration import (
+    ConfigurationError,
     CoreConfig,
     NoConfigError,
     Option,
@@ -1488,7 +1489,10 @@
             defns[k] = template_config[k]
 
         # install!
-        init.install(tracker_home, templates[template]['path'], settings=defns)
+        try:
+            init.install(tracker_home, templates[template]['path'], settings=defns)
+        except ConfigurationError as e:
+            raise UsageError(e)
 
         # Remove config_ini.ini file from tracker_home (not template dir).
         # Ignore file not found - not all templates have
@@ -2350,7 +2354,7 @@
         self.do_genconfig(args, update=True)
 
     def usageError_feedback(self, message, function):
-        print(_('Error: %s') % message)
+        print(_('\nError: %s') % message)
         print()
         print(function.__doc__)
         return 1

Roundup Issue Tracker: http://roundup-tracker.org/