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
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)