Some refactoring of the cfg cache

A fairly misc bunch of changes:

 - init cache before registering config-file and just let
   register_cli_opt() clear the empty cache

 - use @__clear_cache on set_default() and set_override() since
   these are just used by the unit tests and doing so allows us
   to kill _remove_from_cache()

 - use @__clear_cache on reset() too

 - remove recursion from _get() and the substitute param

 - just use (group_name, opt_name) as the cache key

Change-Id: I66934e748eca9ec03e44d7f80a7e10d96a77d8eb
Provide file extension when when looking for files

* Allow an extension to be passed to find_config files, defaulting to '.conf'

Change-Id: I022a3b28d9067158e9ed0da741a5e72cb73af167
Fix ordering in HACKING.rst

Already fixed in nova.

Switched:
from nova.endpoint import cloud
import nova.flags

Change-Id: I5d4f64d0710c8bb12031c3960401f6d6d2a67843
Update exception from importutils.import_class().

Update the message included in the exception from
importutils.import_class() to include what the inner exception was.
This is quite helpful as the real error may not have been that the class
was not found.  It may have failed to import the module that contains
that class, and it's nice to know that and why that happened.

Change-Id: I085864d230b46adce8921e362f058f9421a5a674
Support for directory source of config files

Implements bp cfg-config-dir

Allow multiple config files to be pulled in from a config directory,
as opposed to individual config files being explicitly enumerated.

This logic is enabled using the --config-dir=/path/to/config CLI option,
causing config to be retrived from all matching /path/to/config/*.conf
files.

Sections may be re-opened across config files, and all config items
must reside in an explicitly specified section (i.e. it does not default
to [DEFAULT]). This behavior is unchanged.

Change-Id: Ia29dffe82dfb4742dcf3e8d36b376d906a2492cf
Handle authors existed before VCS was around.

Bug: 976267

The list of such authors are stored in AUTHORS.in file. When
auto generating AUTHORS file, include them as well.

* openstack/common/setup.py
  __doc__: For all methods, remove space and include period.
  generate_authors(): If AUTHORS.in file exist, append the
  content to AUTHORS file.

Change-Id: I05da1e561383cc151e7ef34e75a4600e3afdda6e
Merge "Update exception from importutils.import_class()."
Merge "Support for directory source of config files"
New ConfigOpts.find_file() for locating conf files

Most services have the need to locate files like api-paste.ini or
policy.json.

This new method attempts to find these files by looking alongside
the config files already parsed by ConfigOpts and, failing that,
falls back to a standard set of directories.

Change-Id: I95897816485b88f78854df194cab7872d7c5452a
Add save_and_reraise_exception().

This patch adds save_and_reraise_exception() to a new module,
openstack.common.excutils.  This is based on the function of the same
name from nova.utils.  It is used by nova.rpc, so something equivalent
is needed in openstack-common before nova.rpc can be moved here.

Change-Id: Icec574a081837e0f2d0548a5759d21b0352dbee6
Remove common.exception from common.importutils.

This patch removes the usage of common.exception from
common.importutils.  Instead of raising exception.NotFound() from
importutils.import_class(), just use the built-in ImportError.

Change-Id: I95e84908d1f80c5ca3bbac049eda8faa64212ae0
Merge "New ConfigOpts.find_file() for locating conf files"
Merge "Remove common.exception from common.importutils."
Merge "Add save_and_reraise_exception()."
Truly handle mailmap entries for all combinations.

Bug: 994957

Mailmap might contain mapping with full name. This commit fixes
it to handle these combinations:
  Foo ZZ <email@foo.com> Bar YY <email@bar.com>
  Foo <email@foo.com> Bar <email@bar.com>
  <email@foo.com> <email@bar.com>

This is inline with mailmap convention described here:
  http://man.github.com/git/git-shortlog.html

* openstack/common/setup.py
  parse_mailmap(): Pull out canonical and alias email addresses.

Change-Id: Iabe9612efecbd18f7a5b0725de7d2515ab24125d
Encapsulate common sdist actions into a cmdclass.

The pattern of running generate_authors and write_git_changelog
at sdist time is (and should be) repeated in all project's setup.py.
Instead of copying the creation of the two classes and injection
of them into a cmdclass dict, we can do it here and have it
be consistent.

Related to bug 986462.

Change-Id: I0b7b44d58685551482f874b2a6091dec29e6bed6
cfg: use a list comprehension instead of map()

Change-Id: Iaccb71d83d957aae77fa0f6bc71952b899d3a159
cfg: allow options to be marked as required

Implements blueprint cfg-required-options

Add a 'required' flag to option schemas:

  StrOpt('foo', required=True)

which causes a RequiredOptError exception to be raised if the
user fails to supply a value for the option on the CLI or in
a config file.

Change-Id: Ied7bb25f0c1582c4991d0f212f4871b9358b73fb
cfg: automatically create option groups

Implements blueprint cfg-auto-create-groups

Remove the restriction that groups must be explicitly created. Often
you only need a group to have a name (not e.g. a title or help string)
so we can easily just auto-create groups for that case.

Change-Id: I150ab3900e3aad0068b93487c8d396d21d26cfea
Merge "cfg: allow options to be marked as required"