Unified config handling for client libraries and programs
Go to file
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
doc/source Fix doc typo 2017-10-21 19:04:38 +00:00
os_client_config Do not apply format expansions to passwords 2017-12-05 15:00:30 -06:00
releasenotes Remove setting of version/release from releasenotes 2017-11-16 22:05:30 +01:00
tools Add helper scripts to print version discovery info 2017-02-15 08:05:44 -06:00
.coveragerc Change ignore-errors to ignore_errors 2015-09-21 14:41:36 +00:00
.gitignore Updates for stestr 2017-09-14 16:57:42 -05:00
.gitreview Update .gitreview for git section rename 2015-03-28 11:36:44 -04:00
.mailmap Initial Cookiecutter Commit. 2014-09-20 16:16:13 -07:00
.stestr.conf Updates for stestr 2017-09-14 16:57:42 -05:00
.testr.conf Initial Cookiecutter Commit. 2014-09-20 16:16:13 -07:00
.zuul.yaml Merge "Add shade-functional-tips jobs" 2017-11-14 14:43:39 +00:00
CONTRIBUTING.rst Workflow documentation is now in infra-manual 2014-12-05 03:30:46 +00:00
HACKING.rst Update the documentation link for doc migration 2017-08-07 15:10:42 +08:00
LICENSE Initial Cookiecutter Commit. 2014-09-20 16:16:13 -07:00
README.rst rearrange existing documentation to follow the new standard layout 2017-06-22 15:16:06 -04:00
requirements.txt Updated from global requirements 2017-09-01 12:44:43 +00:00
setup.cfg Update the documentation link for doc migration 2017-08-07 15:10:42 +08:00
setup.py Manually sync with g-r 2017-07-24 21:46:26 +02:00
test-requirements.txt Updated from global requirements 2017-09-16 23:21:20 +00:00
tox.ini Updates for stestr 2017-09-14 16:57:42 -05:00

README.rst

os-client-config

image

os-client-config is a library for collecting client configuration for using an OpenStack cloud in a consistent and comprehensive manner. It will find cloud config for as few as 1 cloud and as many as you want to put in a config file. It will read environment variables and config files, and it also contains some vendor specific default values so that you don't have to know extra info to use OpenStack

  • If you have a config file, you will get the clouds listed in it
  • If you have environment variables, you will get a cloud named envvars
  • If you have neither, you will get a cloud named defaults with base defaults

Source