autohelp: don't ignore cmd/ folders

These folders used to bring command line options that we don't want to
have in the generated tables, but the behavior has changed. This patch
restores the import of files in the cmd/ folders, and handles special
cases where the import is problematic.

Change-Id: I0779e0f689d2f6f64149c3d111a8dd1ecd6cfc20
Partial-Bug: #1363954
This commit is contained in:
Gauvain Pocentek 2015-02-19 21:06:24 +01:00
parent 7a1046484b
commit 3d2f91cf8e

View File

@ -115,7 +115,7 @@ def import_modules(repo_location, package_name, verbose=0):
pkg_location = os.path.join(repo_location, package_name)
for root, dirs, files in os.walk(pkg_location):
skipdir = False
for excludedir in ('tests', 'locale', 'cmd',
for excludedir in ('tests', 'locale',
os.path.join('db', 'migration'), 'transfer'):
if ((os.path.sep + excludedir + os.path.sep) in root or (
root.endswith(os.path.sep + excludedir))):
@ -218,6 +218,8 @@ def _register_runtime_opts(module, abs_path, verbose):
if register:
for opt in obj:
if not isinstance(opt, cfg.Opt):
continue
try:
cfg.CONF.register_opt(opt, opts_group)
except cfg.DuplicateOptError:
@ -269,7 +271,10 @@ class OptionsCache(object):
self._opt_names = []
for optname in cfg.CONF._opts:
self._add_opt(optname, 'DEFAULT', cfg.CONF._opts[optname]['opt'])
opt = cfg.CONF._opts[optname]['opt']
# We ignore some CLI opts by excluding SubCommandOpt objects
if not isinstance(opt, cfg.SubCommandOpt):
self._add_opt(optname, 'DEFAULT', opt)
for group in cfg.CONF._groups:
for optname in cfg.CONF._groups[group]._opts: