diff options
-rw-r--r-- | README.rst | 18 | ||||
-rwxr-xr-x | doc/source/conf.py | 3 | ||||
-rw-r--r-- | doc/source/index.rst | 1 | ||||
-rw-r--r-- | doc/source/releasenotes.rst | 5 | ||||
-rw-r--r-- | os_client_config/config.py | 7 | ||||
-rw-r--r-- | os_client_config/tests/test_config.py | 10 | ||||
-rw-r--r-- | releasenotes/notes/started-using-reno-242e2b0cd27f9480.yaml | 3 | ||||
-rw-r--r-- | test-requirements.txt | 1 | ||||
-rw-r--r-- | tox.ini | 7 |
9 files changed, 46 insertions, 9 deletions
@@ -117,7 +117,7 @@ An example config file is probably helpful: - IAD You may note a few things. First, since `auth_url` settings are silly -and embarrasingly ugly, known cloud vendor profile information is included and +and embarrassingly ugly, known cloud vendor profile information is included and may be referenced by name. One of the benefits of that is that `auth_url` isn't the only thing the vendor defaults contain. For instance, since Rackspace lists `rax:database` as the service type for trove, `os-client-config` @@ -148,8 +148,8 @@ related to domains, projects and trusts. Splitting Secrets ----------------- -In some scenarios, such as configuragtion managment controlled environments, -it might be eaiser to have secrets in one file and non-secrets in another. +In some scenarios, such as configuration management controlled environments, +it might be easier to have secrets in one file and non-secrets in another. This is fully supported via an optional file `secure.yaml` which follows all the same location rules as `clouds.yaml`. It can contain anything you put in `clouds.yaml` and will take precedence over anything in the `clouds.yaml` @@ -355,7 +355,7 @@ with - as well as a consumption argument. Constructing Legacy Client objects ---------------------------------- -If all you want to do is get a Client object from a python-*client library, +If all you want to do is get a Client object from a python-\*client library, and you want it to do all the normal things related to clouds.yaml, `OS_` environment variables, a helper function is provided. The following will get you a fully configured `novaclient` instance. @@ -380,4 +380,12 @@ If you want to do the same thing but also support command line parsing. 'compute', options=argparse.ArgumentParser()) If you want to get fancier than that in your python, then the rest of the -API is avaiable to you. But often times, you just want to do the one thing. +API is available to you. But often times, you just want to do the one thing. + +Source +------ + +* Free software: Apache license +* Documentation: http://docs.openstack.org/developer/os-client-config +* Source: http://git.openstack.org/cgit/openstack/os-client-config +* Bugs: http://bugs.launchpad.net/os-client-config diff --git a/doc/source/conf.py b/doc/source/conf.py index 221de3c..208517c 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -23,7 +23,8 @@ sys.path.insert(0, os.path.abspath('../..')) extensions = [ 'sphinx.ext.autodoc', #'sphinx.ext.intersphinx', - 'oslosphinx' + 'oslosphinx', + 'reno.sphinxext' ] # autodoc generation is a bit aggressive and a nuisance when doing heavy diff --git a/doc/source/index.rst b/doc/source/index.rst index cc5dbf4..bf667b7 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -7,6 +7,7 @@ contributing installation api-reference + releasenotes Indices and tables ================== diff --git a/doc/source/releasenotes.rst b/doc/source/releasenotes.rst new file mode 100644 index 0000000..2a4bceb --- /dev/null +++ b/doc/source/releasenotes.rst @@ -0,0 +1,5 @@ +============= +Release Notes +============= + +.. release-notes:: diff --git a/os_client_config/config.py b/os_client_config/config.py index 89015cc..d490006 100644 --- a/os_client_config/config.py +++ b/os_client_config/config.py @@ -26,6 +26,7 @@ from keystoneauth1 import adapter from keystoneauth1 import loading import yaml +from os_client_config import _log from os_client_config import cloud_config from os_client_config import defaults from os_client_config import exceptions @@ -170,6 +171,8 @@ class OpenStackConfig(object): def __init__(self, config_files=None, vendor_files=None, override_defaults=None, force_ipv4=None, envvar_prefix=None, secure_files=None): + self.log = _log.setup_logging(__name__) + self._config_files = config_files or CONFIG_FILES self._secure_files = secure_files or SECURE_FILES self._vendor_files = vendor_files or VENDOR_FILES @@ -395,6 +398,8 @@ class OpenStackConfig(object): return [self._expand_region_name(new_cloud['region_name'])] def _get_region(self, cloud=None, region_name=''): + if region_name is None: + region_name = '' if not cloud: return self._expand_region_name(region_name) @@ -883,7 +888,6 @@ class OpenStackConfig(object): if (('auth' in config and 'token' in config['auth']) or ('auth_token' in config and config['auth_token']) or ('token' in config and config['token'])): - config['auth_type'] = 'token' config.setdefault('token', config.pop('auth_token', None)) # These backwards compat values are only set via argparse. If it's @@ -919,6 +923,7 @@ class OpenStackConfig(object): # but OSC can't handle it right now, so we try deferring # to ksc. If that ALSO fails, it means there is likely # a deeper issue, so we assume the ksa error was correct + self.log.debug("Deferring keystone exception: {e}".format(e=e)) auth_plugin = None try: config = self._validate_auth_ksc(config) diff --git a/os_client_config/tests/test_config.py b/os_client_config/tests/test_config.py index 3ea6690..4440ac8 100644 --- a/os_client_config/tests/test_config.py +++ b/os_client_config/tests/test_config.py @@ -246,6 +246,13 @@ class TestConfig(base.TestCase): region_name='override-region') self.assertEqual(region, {'name': 'override-region', 'values': {}}) + def test_get_region_region_is_none(self): + c = config.OpenStackConfig(config_files=[self.cloud_yaml], + vendor_files=[self.vendor_yaml], + secure_files=[self.no_yaml]) + region = c._get_region(cloud='_test-cloud_no_region', region_name=None) + self.assertEqual(region, {'name': '', 'values': {}}) + def test_get_region_region_set(self): c = config.OpenStackConfig(config_files=[self.cloud_yaml], vendor_files=[self.vendor_yaml], @@ -482,7 +489,8 @@ class TestConfigArgparse(base.TestCase): # novaclient will add this parser.add_argument('--os-auth-token') opts, _remain = parser.parse_known_args( - ['--os-auth-token', 'very-bad-things']) + ['--os-auth-token', 'very-bad-things', + '--os-auth-type', 'token']) cc = c.get_one_cloud(argparse=opts) self.assertEqual(cc.config['auth_type'], 'token') self.assertEqual(cc.config['auth']['token'], 'very-bad-things') diff --git a/releasenotes/notes/started-using-reno-242e2b0cd27f9480.yaml b/releasenotes/notes/started-using-reno-242e2b0cd27f9480.yaml new file mode 100644 index 0000000..d7cfb51 --- /dev/null +++ b/releasenotes/notes/started-using-reno-242e2b0cd27f9480.yaml @@ -0,0 +1,3 @@ +--- +other: +- Started using reno for release notes. diff --git a/test-requirements.txt b/test-requirements.txt index 7053051..a50a202 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -16,6 +16,7 @@ python-subunit>=0.0.18 sphinx>=1.1.2,!=1.2.0,!=1.3b1,<1.3 oslosphinx>=2.5.0,<2.6.0 # Apache-2.0 oslotest>=1.5.1,<1.6.0 # Apache-2.0 +reno>=0.1.1 # Apache2 testrepository>=0.0.18 testscenarios>=0.4 testtools>=0.9.36,!=1.2.0 @@ -21,7 +21,12 @@ commands = {posargs} commands = python setup.py test --coverage --coverage-package-name=os_client_config --testr-args='{posargs}' [testenv:docs] -commands = python setup.py build_sphinx +deps = + {[testenv]deps} + readme +commands = + python setup.py build_sphinx + python setup.py check -r -s [flake8] # H803 skipped on purpose per list discussion. |