os-client-config/os_client_config
John Dennis c7243f1747 Do not apply format expansions to passwords
get_one_cloud() and get_one_cloud_osc() iterate over config
values and try to expand any variables in those values by
calling value.format(), however some config values
(e.g. password) should never have format() applied to them, not
only might that change the password but it will also cause the
format() function to raise an exception if it can not parse the
format string. Examples would be single brace (e.g. 'foo{')
which raises an ValueError because it's looking for a matching
end brace or a brace pair with a key value that cannot be found
(e.g. 'foo{bar}') which raises a KeyError.

It is not reasonsable to try to escape any braces because:

1) Escaping all braces breaks valid use of the format string syntax.

2) Trying to determine exactly which braces should be escaped and
which should be preserved is a daunting task and likely would not be
robust.

3) Some strings might look like valid format syntax but still should
be escaped (e.g. "foo{bar}", if this appeared in a password we
wouldn't escape it and there would be a key error on the 'bar' key.

4) In general passwords should never be modified, you never want to
apply formatting to them.

The right approach is to maintain a list of config values which are
excluded from having formatting applied to them. At the moment that
list just includes 'password' but perhaps down the road other
exceptions might crop up. This patch follows this approach,
the list of excluded values can easily be updated if others are
discovered.

Change-Id: I187bdec582d4c2cc6c7fda47a1538194137c616b
Closes-Bug: 1635696
Signed-off-by: John Dennis <jdennis@redhat.com>
2017-12-05 15:00:30 -06:00
..
tests Do not apply format expansions to passwords 2017-12-05 15:00:30 -06:00
vendors DataCentred supports Keystone V3 and Glance V2. 2017-08-11 14:12:50 +01:00
__init__.py Update make_rest_client to work with version discovery 2017-10-18 15:49:23 +02:00
_log.py Add logging module support 2015-11-03 12:01:07 -05:00
cloud_config.py Added nat_source flag for networks. 2017-10-21 19:04:30 +00:00
config.py Do not apply format expansions to passwords 2017-12-05 15:00:30 -06:00
constructors.json Add ironicclient to constructors list 2017-05-12 12:05:50 -05:00
constructors.py Update globals safely 2017-08-07 15:46:59 -07:00
defaults.json Add support for overriding mistral service type 2017-02-15 09:31:12 -06:00
defaults.py Update globals safely 2017-08-07 15:46:59 -07:00
exceptions.py Add support for bailing on invalid service versions 2017-03-09 09:17:48 -06:00
schema.json Fix name of the object-store api key 2015-11-14 12:14:10 -05:00
vendor-schema.json Add support for indicating required floating IPs 2017-02-08 08:25:21 -06:00