From 27e261376fc03655a5f90603078a3a8623ddf32f Mon Sep 17 00:00:00 2001 From: Anton Frolov Date: Fri, 31 May 2013 14:27:49 +0400 Subject: [PATCH] Add error reporting to generate_sample.sh on import failure. Currently tools/conf/generate_sample.sh collect options from project modules by importing each module and looking at it's global variables for instances of classes derived from cfg.Opt (or lists of such instances). Sometimes this import can fail due to various reasons, cfg.DuplicateOptError for example. And if import fails no options from imported module written to sample config file. Error reporting will at least warn user that some of options didn't get into sample config. Change-Id: I831464b1c1575c106d866a936a50ec74b2d44e59 Fixes: bug #1182611 --- tools/conf/extract_opts.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/conf/extract_opts.py b/tools/conf/extract_opts.py index c34f2eefe..4650c134f 100644 --- a/tools/conf/extract_opts.py +++ b/tools/conf/extract_opts.py @@ -79,12 +79,9 @@ def _print_module(mod_str): mod_str = mod_str[:mod_str.rfind(".")] try: mod_obj = importutils.import_module(mod_str) - except (ValueError, AttributeError), err: - return - except ImportError, ie: - sys.stderr.write("%s\n" % str(ie)) - return except Exception, e: + sys.stderr.write("Failed to collect options from module %s: %s\n" % ( + mod_str, str(e))) return _list_opts(mod_obj, mod_str) -- 2.45.2