Hello community,
here is the log from the commit of package python-os-client-config for openSUSE:Factory checked in at 2015-09-02 07:54:08
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-os-client-config (Old)
and /work/SRC/openSUSE:Factory/.python-os-client-config.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-os-client-config"
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-os-client-config/python-os-client-config.changes 2015-08-27 08:57:21.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.python-os-client-config.new/python-os-client-config.changes 2015-09-02 07:54:09.000000000 +0200
@@ -1,0 +2,23 @@
+Sat Aug 29 17:37:31 UTC 2015 - tbechtold@suse.com
+
+- update to 1.6.3:
+ * Revert "Use the correct auth_plugin for token authentication"
+ * Ignore infra CI env vars
+ * Use the correct auth_plugin for token authentication
+ * Align to generic password auth-type
+ * Clarify floating ip use for vendors
+ * Add per-service endpoint overrides
+ * Remove requirements.txt from tox.ini
+ * Remove py26 and py33 from tox.ini
+ * Rename 'endpoint_type' to 'interface'
+ * Have service name default to None
+ * Remove region list from single cloud
+ * Fix set_default() when used before config init
+ * Specify the config file with environment variable
+ * Add support for configuring region lists with yaml
+ * Fix rendering issue in Readme
+ * Clean up vendor data
+ * Add support for indicating preference for IPv6
+ * Normalize project_name aliases
+
+-------------------------------------------------------------------
Old:
----
os-client-config-1.4.0.tar.gz
New:
----
os-client-config-1.6.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-os-client-config.spec ++++++
--- /var/tmp/diff_new_pack.k8lCXl/_old 2015-09-02 07:54:09.000000000 +0200
+++ /var/tmp/diff_new_pack.k8lCXl/_new 2015-09-02 07:54:09.000000000 +0200
@@ -19,7 +19,7 @@
%bcond_with test
Name: python-os-client-config
-Version: 1.4.0
+Version: 1.6.3
Release: 0
Summary: OpenStack Client Configuation Library
License: Apache-2.0
++++++ os-client-config-1.4.0.tar.gz -> os-client-config-1.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/AUTHORS new/os-client-config-1.6.3/AUTHORS
--- old/os-client-config-1.4.0/AUTHORS 2015-06-20 16:21:25.000000000 +0200
+++ new/os-client-config-1.6.3/AUTHORS 2015-08-13 11:15:04.000000000 +0200
@@ -1,6 +1,8 @@
Alex Gaynor
+Chris Church
Clint Byrum
David Shrewsbury
+Davide Guerri
Dean Troyer
Dean Troyer
Ghe Rivero
@@ -8,4 +10,6 @@
Jeremy Stanley
Julia Kreger
Monty Taylor
+Spencer Krum
TerryHowe
+lifeless
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/ChangeLog new/os-client-config-1.6.3/ChangeLog
--- old/os-client-config-1.4.0/ChangeLog 2015-06-20 16:21:25.000000000 +0200
+++ new/os-client-config-1.6.3/ChangeLog 2015-08-13 11:15:04.000000000 +0200
@@ -1,6 +1,44 @@
CHANGES
=======
+1.6.3
+-----
+
+* Revert "Use the correct auth_plugin for token authentication"
+
+1.6.2
+-----
+
+* Ignore infra CI env vars
+* Use the correct auth_plugin for token authentication
+
+1.6.1
+-----
+
+* Align to generic password auth-type
+
+1.6.0
+-----
+
+* Clarify floating ip use for vendors
+* Add per-service endpoint overrides
+
+1.5.0
+-----
+
+* Remove requirements.txt from tox.ini
+* Remove py26 and py33 from tox.ini
+* Rename 'endpoint_type' to 'interface'
+* Have service name default to None
+* Remove region list from single cloud
+* Fix set_default() when used before config init
+* Specify the config file with environment variable
+* Add support for configuring region lists with yaml
+* Fix rendering issue in Readme
+* Clean up vendor data
+* Add support for indicating preference for IPv6
+* Normalize project_name aliases
+
1.4.0
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/PKG-INFO new/os-client-config-1.6.3/PKG-INFO
--- old/os-client-config-1.4.0/PKG-INFO 2015-06-20 16:21:25.000000000 +0200
+++ new/os-client-config-1.6.3/PKG-INFO 2015-08-13 11:15:04.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: os-client-config
-Version: 1.4.0
+Version: 1.6.3
Summary: OpenStack Client Configuation Library
Home-page: http://www.openstack.org/
Author: OpenStack
@@ -51,6 +51,10 @@
The first file found wins.
+ You can also set the environment variable `OS_CLIENT_CONFIG_FILE` to an
+ absolute path of a file to look for and that location will be inserted at the
+ front of the file search list.
+
The keys are all of the keys you'd expect from `OS_*` - except lower case
and without the OS prefix. So, region name is set with `region_name`.
@@ -113,7 +117,10 @@
username: openstackci
password: XXXXXXXX
project_id: 610275
- region_name: DFW,ORD,IAD
+ regions:
+ - DFW
+ - ORD
+ - 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
@@ -124,7 +131,7 @@
available, you can provide one called `clouds-public.yaml`, following the same
location rules previously mentioned for the config files.
- Also, `region_name` can be a list of regions. When you call `get_all_clouds`,
+ `regions` can be a list of regions. When you call `get_all_clouds`,
you'll get a cloud config object for each cloud/region combo.
As seen with `dns_service_type`, any setting that makes sense to be per-service,
@@ -193,6 +200,38 @@
dns_service_type: hpext:dns
+ IPv6
+ ----
+
+ IPv6 may be a thing you would prefer to use not only if the cloud supports it,
+ but also if your local machine support it. A simple boolean flag is settable
+ either in an environment variable, `OS_PREFER_IPV6`, or in the client section
+ of the clouds.yaml.
+
+ ::
+
+ client:
+ prefer_ipv6: true
+ clouds:
+ mordred:
+ profile: hp
+ auth:
+ username: mordred@inaugust.com
+ password: XXXXXXXXX
+ project_name: mordred@inaugust.com
+ region_name: region-b.geo-1
+ monty:
+ profile: rax
+ auth:
+ username: mordred@inaugust.com
+ password: XXXXXXXXX
+ project_name: mordred@inaugust.com
+ region_name: DFW
+
+ The above snippet will tell client programs to prefer returning an IPv6
+ address. This will result in calls to, for instance, `shade`'s `get_public_ip`
+ to return an IPv4 address on HP, and an IPv6 address on Rackspace.
+
Usage
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/README.rst new/os-client-config-1.6.3/README.rst
--- old/os-client-config-1.4.0/README.rst 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/README.rst 2015-08-13 11:14:33.000000000 +0200
@@ -43,6 +43,10 @@
The first file found wins.
+You can also set the environment variable `OS_CLIENT_CONFIG_FILE` to an
+absolute path of a file to look for and that location will be inserted at the
+front of the file search list.
+
The keys are all of the keys you'd expect from `OS_*` - except lower case
and without the OS prefix. So, region name is set with `region_name`.
@@ -105,7 +109,10 @@
username: openstackci
password: XXXXXXXX
project_id: 610275
- region_name: DFW,ORD,IAD
+ regions:
+ - DFW
+ - ORD
+ - 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
@@ -116,7 +123,7 @@
available, you can provide one called `clouds-public.yaml`, following the same
location rules previously mentioned for the config files.
-Also, `region_name` can be a list of regions. When you call `get_all_clouds`,
+`regions` can be a list of regions. When you call `get_all_clouds`,
you'll get a cloud config object for each cloud/region combo.
As seen with `dns_service_type`, any setting that makes sense to be per-service,
@@ -185,6 +192,38 @@
dns_service_type: hpext:dns
+IPv6
+----
+
+IPv6 may be a thing you would prefer to use not only if the cloud supports it,
+but also if your local machine support it. A simple boolean flag is settable
+either in an environment variable, `OS_PREFER_IPV6`, or in the client section
+of the clouds.yaml.
+
+::
+
+ client:
+ prefer_ipv6: true
+ clouds:
+ mordred:
+ profile: hp
+ auth:
+ username: mordred@inaugust.com
+ password: XXXXXXXXX
+ project_name: mordred@inaugust.com
+ region_name: region-b.geo-1
+ monty:
+ profile: rax
+ auth:
+ username: mordred@inaugust.com
+ password: XXXXXXXXX
+ project_name: mordred@inaugust.com
+ region_name: DFW
+
+The above snippet will tell client programs to prefer returning an IPv6
+address. This will result in calls to, for instance, `shade`'s `get_public_ip`
+to return an IPv4 address on HP, and an IPv6 address on Rackspace.
+
Usage
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/doc/source/vendor-support.rst new/os-client-config-1.6.3/doc/source/vendor-support.rst
--- old/os-client-config-1.4.0/doc/source/vendor-support.rst 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/doc/source/vendor-support.rst 2015-08-13 11:14:33.000000000 +0200
@@ -37,6 +37,7 @@
============== ================
* DNS Service Type is `hpext:dns`
+* Public IPv4 is provided via NAT with Neutron Floating IP
rackspace
---------
@@ -79,7 +80,7 @@
* Image API Version is 2
* Images must be in `raw` format
-* Public IPv4 is provided via Floating IP from Neutron
+* Public IPv4 is provided via NAT with Neutron Floating IP
* IPv6 is provided to every server
vexxhost
@@ -139,7 +140,7 @@
============== ================
* Identity API Version is 2
-* Public IPv4 is provided via Floating IP from Nova
+* Public IPv4 is provided via NAT with Nova Floating IP
* Floating IPs are provided by Nova
* Security groups are provided by Nova
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/cloud_config.py new/os-client-config-1.6.3/os_client_config/cloud_config.py
--- old/os-client-config-1.4.0/os_client_config/cloud_config.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/cloud_config.py 2015-08-13 11:14:33.000000000 +0200
@@ -16,10 +16,11 @@
class CloudConfig(object):
- def __init__(self, name, region, config):
+ def __init__(self, name, region, config, prefer_ipv6=False):
self.name = name
self.region = region
self.config = config
+ self._prefer_ipv6 = prefer_ipv6
def __getattr__(self, key):
"""Return arbitrary attributes."""
@@ -73,11 +74,12 @@
def get_auth_args(self):
return self.config['auth']
- def get_endpoint_type(self, service_type=None):
+ def get_interface(self, service_type=None):
+ interface = self.config.get('interface')
if not service_type:
- return self.config['endpoint_type']
- key = '{service_type}_endpoint_type'.format(service_type=service_type)
- return self.config.get(key, self.config['endpoint_type'])
+ return interface
+ key = '{service_type}_interface'.format(service_type=service_type)
+ return self.config.get(key, interface)
def get_region_name(self, service_type=None):
if not service_type:
@@ -95,4 +97,12 @@
def get_service_name(self, service_type):
key = '{service_type}_service_name'.format(service_type=service_type)
- return self.config.get(key, service_type)
+ return self.config.get(key, None)
+
+ def get_endpoint(self, service_type):
+ key = '{service_type}_endpoint'.format(service_type=service_type)
+ return self.config.get(key, None)
+
+ @property
+ def prefer_ipv6(self):
+ return self._prefer_ipv6
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/config.py new/os-client-config-1.6.3/os_client_config/config.py
--- old/os-client-config-1.4.0/os_client_config/config.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/config.py 2015-08-13 11:14:34.000000000 +0200
@@ -64,10 +64,17 @@
# Remove this sometime in June 2015 once OSC is comfortably
# changed-over and global-defaults is updated.
def set_default(key, value):
+ warnings.warn(
+ "Use of set_default() is deprecated. Defaults should be set with the "
+ "`override_defaults` parameter of OpenStackConfig."
+ )
+ defaults.get_defaults() # make sure the dict is initialized
defaults._defaults[key] = value
def get_boolean(value):
+ if type(value) is bool:
+ return value
if value.lower() == 'true':
return True
return False
@@ -75,7 +82,11 @@
def _get_os_environ():
ret = defaults.get_defaults()
- environkeys = [k for k in os.environ.keys() if k.startswith('OS_')]
+ environkeys = [k for k in os.environ.keys()
+ if k.startswith('OS_')
+ and not k.startswith('OS_TEST') # infra CI var
+ and not k.startswith('OS_STD') # infra CI var
+ ]
if not environkeys:
return None
for k in environkeys:
@@ -104,6 +115,10 @@
self._config_files = config_files or CONFIG_FILES
self._vendor_files = vendor_files or VENDOR_FILES
+ config_file_override = os.environ.pop('OS_CLIENT_CONFIG_FILE', None)
+ if config_file_override:
+ self._config_files.insert(0, config_file_override)
+
self.defaults = defaults.get_defaults()
if override_defaults:
self.defaults.update(override_defaults)
@@ -116,6 +131,14 @@
if 'clouds' not in self.cloud_config:
self.cloud_config['clouds'] = {}
+ # Grab ipv6 preference settings from env
+ client_config = self.cloud_config.get('client', {})
+ self.prefer_ipv6 = get_boolean(
+ os.environ.pop(
+ 'OS_PREFER_IPV6', client_config.get(
+ 'prefer_ipv6', client_config.get(
+ 'prefer-ipv6', False))))
+
# Next, process environment variables and add them to the mix
self.envvar_key = os.environ.pop('OS_CLOUD_NAME', 'envvars')
if self.envvar_key in self.cloud_config['clouds']:
@@ -189,14 +212,24 @@
return self._cache_arguments
def _get_regions(self, cloud):
- try:
- return self.cloud_config['clouds'][cloud]['region_name']
- except KeyError:
- # No region configured
- return ''
+ if cloud not in self.cloud_config['clouds']:
+ return ['']
+ config = self._normalize_keys(self.cloud_config['clouds'][cloud])
+ if 'regions' in config:
+ return config['regions']
+ elif 'region_name' in config:
+ regions = config['region_name'].split(',')
+ if len(regions) > 1:
+ warnings.warn(
+ "Comma separated lists in region_name are deprecated."
+ " Please use a yaml list in the regions"
+ " parameter in {0} instead.".format(self.config_filename))
+ return regions
+ else:
+ return ['']
def _get_region(self, cloud=None):
- return self._get_regions(cloud).split(',')[0]
+ return self._get_regions(cloud)[0]
def get_cloud_names(self):
return self.cloud_config['clouds'].keys()
@@ -218,7 +251,7 @@
# Expand a profile if it exists. 'cloud' is an old confusing name
# for this.
profile_name = our_cloud.get('profile', our_cloud.get('cloud', None))
- if profile_name:
+ if profile_name and profile_name != self.envvar_key:
if 'cloud' in our_cloud:
warnings.warn(
"{0} use the keyword 'cloud' to reference a known "
@@ -228,9 +261,10 @@
if vendor_file and profile_name in vendor_file['public-clouds']:
_auth_update(cloud, vendor_file['public-clouds'][profile_name])
else:
- try:
- _auth_update(cloud, vendors.CLOUD_DEFAULTS[profile_name])
- except KeyError:
+ profile_data = vendors.get_profile(profile_name)
+ if profile_data:
+ _auth_update(cloud, profile_data)
+ else:
# Can't find the requested vendor config, go about business
warnings.warn("Couldn't find the vendor profile '{0}', for"
" the cloud '{1}'".format(profile_name,
@@ -248,13 +282,16 @@
def _fix_backwards_madness(self, cloud):
cloud = self._fix_backwards_project(cloud)
cloud = self._fix_backwards_auth_plugin(cloud)
+ cloud = self._fix_backwards_interface(cloud)
return cloud
def _fix_backwards_project(self, cloud):
# Do the lists backwards so that project_name is the ultimate winner
mappings = {
- 'project_name': ('tenant_id', 'project_id',
- 'tenant_name', 'project_name'),
+ 'project_name': ('tenant_id', 'tenant-id',
+ 'project_id', 'project-id',
+ 'tenant_name', 'tenant-name',
+ 'project_name', 'project-name'),
}
for target_key, possible_values in mappings.items():
target = None
@@ -281,6 +318,19 @@
target = cloud[key]
del cloud[key]
cloud[target_key] = target
+ # Because we force alignment to v3 nouns, we want to force
+ # use of the auth plugin that can do auto-selection and dealing
+ # with that based on auth parameters. v2password is basically
+ # completely broken
+ if cloud['auth_type'] == 'v2password':
+ cloud['auth_type'] = 'password'
+ return cloud
+
+ def _fix_backwards_interface(self, cloud):
+ for key in cloud.keys():
+ if key.endswith('endpoint_type'):
+ target_key = key.replace('endpoint_type', 'interface')
+ cloud[target_key] = cloud.pop(key)
return cloud
def get_all_clouds(self):
@@ -288,7 +338,7 @@
clouds = []
for cloud in self.get_cloud_names():
- for region in self._get_regions(cloud).split(','):
+ for region in self._get_regions(cloud):
clouds.append(self.get_one_cloud(cloud, region_name=region))
return clouds
@@ -400,6 +450,10 @@
config = self._get_base_cloud_config(cloud)
+ # Regions is a list that we can use to create a list of cloud/region
+ # objects. It does not belong in the single-cloud dict
+ config.pop('regions', None)
+
# Can't just do update, because None values take over
for (key, val) in iter(args.items()):
if val is not None:
@@ -425,13 +479,16 @@
if hasattr(value, 'format'):
config[key] = value.format(**config)
+ prefer_ipv6 = config.pop('prefer_ipv6', self.prefer_ipv6)
+
if cloud is None:
cloud_name = ''
else:
cloud_name = str(cloud)
return cloud_config.CloudConfig(
name=cloud_name, region=config['region_name'],
- config=self._normalize_keys(config))
+ config=self._normalize_keys(config),
+ prefer_ipv6=prefer_ipv6)
@staticmethod
def set_one_cloud(config_file, cloud, set_config=None):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/defaults.py new/os-client-config-1.6.3/os_client_config/defaults.py
--- old/os-client-config-1.4.0/os_client_config/defaults.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/defaults.py 2015-08-13 11:14:33.000000000 +0200
@@ -12,29 +12,29 @@
# License for the specific language governing permissions and limitations
# under the License.
-_defaults = dict(
- api_timeout=None,
- auth_type='password',
- baremetal_api_version='1',
- compute_api_version='2',
- database_api_version='1.0',
- endpoint_type='public',
- floating_ip_source='neutron',
- identity_api_version='2',
- image_api_use_tasks=False,
- image_api_version='1',
- network_api_version='2',
- object_api_version='1',
- secgroup_source='neutron',
- volume_api_version='1',
- disable_vendor_agent={},
- # SSL Related args
- verify=True,
- cacert=None,
- cert=None,
- key=None,
-)
+import os
+
+import yaml
+
+_yaml_path = os.path.join(
+ os.path.dirname(os.path.realpath(__file__)), 'defaults.yaml')
+_defaults = None
def get_defaults():
+ global _defaults
+ if not _defaults:
+ # Python language specific defaults
+ # These are defaults related to use of python libraries, they are
+ # not qualities of a cloud.
+ _defaults = dict(
+ api_timeout=None,
+ verify=True,
+ cacert=None,
+ cert=None,
+ key=None,
+ )
+ with open(_yaml_path, 'r') as yaml_file:
+ _defaults.update(yaml.load(yaml_file.read()))
+
return _defaults.copy()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/defaults.yaml new/os-client-config-1.6.3/os_client_config/defaults.yaml
--- old/os-client-config-1.4.0/os_client_config/defaults.yaml 1970-01-01 01:00:00.000000000 +0100
+++ new/os-client-config-1.6.3/os_client_config/defaults.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -0,0 +1,16 @@
+auth_type: password
+baremetal_api_version: '1'
+compute_api_version: '2'
+database_api_version: '1.0'
+disable_vendor_agent: {}
+dns_api_version: '2'
+interface: public
+floating_ip_source: neutron
+identity_api_version: '2'
+image_api_use_tasks: false
+image_api_version: '1'
+image_format: qcow2
+network_api_version: '2'
+object_api_version: '1'
+secgroup_source: neutron
+volume_api_version: '1'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/tests/base.py new/os-client-config-1.6.3/os_client_config/tests/base.py
--- old/os-client-config-1.4.0/os_client_config/tests/base.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/tests/base.py 2015-08-13 11:14:33.000000000 +0200
@@ -38,6 +38,9 @@
}
}
USER_CONF = {
+ 'client': {
+ 'prefer_ipv6': True,
+ },
'clouds': {
'_test-cloud_': {
'profile': '_test_cloud_in_our_cloud',
@@ -64,6 +67,25 @@
},
'region_name': 'test-region',
},
+ '_test_cloud_regions': {
+ 'auth': {
+ 'username': 'testuser',
+ 'password': 'testpass',
+ 'project-id': 'testproject',
+ },
+ 'regions': [
+ 'region1',
+ 'region2',
+ ],
+ },
+ '_test_cloud_hyphenated': {
+ 'auth': {
+ 'username': 'testuser',
+ 'password': 'testpass',
+ 'project-id': '12345',
+ },
+ 'region_name': 'test-region',
+ }
},
'cache': {'max_age': 1},
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/tests/test_cloud_config.py new/os-client-config-1.6.3/os_client_config/tests/test_cloud_config.py
--- old/os-client-config-1.4.0/os_client_config/tests/test_cloud_config.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/tests/test_cloud_config.py 2015-08-13 11:14:33.000000000 +0200
@@ -17,6 +17,16 @@
fake_config_dict = {'a': 1, 'os_b': 2, 'c': 3, 'os_c': 4}
+fake_services_dict = {
+ 'compute_api_version': 2,
+ 'compute_endpoint': 'http://compute.example.com',
+ 'compute_region_name': 'region-bl',
+ 'interface': 'public',
+ 'image_service_type': 'mage',
+ 'identity_interface': 'admin',
+ 'identity_service_name': 'locks',
+ 'auth': {'password': 'hunter2', 'username': 'AzureDiamond'},
+}
class TestCloudConfig(base.TestCase):
@@ -39,6 +49,9 @@
# Lookup mystery attribute
self.assertIsNone(cc.x)
+ # Test default ipv6
+ self.assertFalse(cc.prefer_ipv6)
+
def test_iteration(self):
cc = cloud_config.CloudConfig("test1", "region-al", fake_config_dict)
self.assertTrue('a' in cc)
@@ -100,3 +113,32 @@
cc = cloud_config.CloudConfig("test1", "region-xx", config_dict)
(verify, cert) = cc.get_requests_verify_args()
self.assertEqual(("cert", "key"), cert)
+
+ def test_ipv6(self):
+ cc = cloud_config.CloudConfig(
+ "test1", "region-al", fake_config_dict, prefer_ipv6=True)
+ self.assertTrue(cc.prefer_ipv6)
+
+ def test_getters(self):
+ cc = cloud_config.CloudConfig("test1", "region-al", fake_services_dict)
+
+ self.assertEqual(['compute', 'identity', 'image'],
+ sorted(cc.get_services()))
+ self.assertEqual({'password': 'hunter2', 'username': 'AzureDiamond'},
+ cc.get_auth_args())
+ self.assertEqual('public', cc.get_interface())
+ self.assertEqual('public', cc.get_interface('compute'))
+ self.assertEqual('admin', cc.get_interface('identity'))
+ self.assertEqual('region-al', cc.get_region_name())
+ self.assertEqual('region-al', cc.get_region_name('image'))
+ self.assertEqual('region-bl', cc.get_region_name('compute'))
+ self.assertEqual(None, cc.get_api_version('image'))
+ self.assertEqual(2, cc.get_api_version('compute'))
+ self.assertEqual('mage', cc.get_service_type('image'))
+ self.assertEqual('compute', cc.get_service_type('compute'))
+ self.assertEqual('http://compute.example.com',
+ cc.get_endpoint('compute'))
+ self.assertEqual(None,
+ cc.get_endpoint('image'))
+ self.assertEqual(None, cc.get_service_name('compute'))
+ self.assertEqual('locks', cc.get_service_name('identity'))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/tests/test_config.py new/os-client-config-1.6.3/os_client_config/tests/test_config.py
--- old/os-client-config-1.4.0/os_client_config/tests/test_config.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/tests/test_config.py 2015-08-13 11:14:33.000000000 +0200
@@ -32,7 +32,11 @@
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
vendor_files=[self.vendor_yaml])
clouds = c.get_all_clouds()
- user_clouds = [cloud for cloud in base.USER_CONF['clouds'].keys()]
+ # We add one by hand because the regions cloud is going to exist
+ # twice since it has two regions in it
+ user_clouds = [
+ cloud for cloud in base.USER_CONF['clouds'].keys()
+ ] + ['_test_cloud_regions']
configured_clouds = [cloud.name for cloud in clouds]
self.assertItemsEqual(user_clouds, configured_clouds)
@@ -87,6 +91,12 @@
cc = c.get_one_cloud('_test-cloud-int-project_')
self.assertEqual('12345', cc.auth['project_name'])
+ def test_get_one_cloud_with_hyphenated_project_id(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+ cc = c.get_one_cloud('_test_cloud_hyphenated')
+ self.assertEqual('12345', cc.auth['project_name'])
+
def test_no_environ(self):
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
vendor_files=[self.vendor_yaml])
@@ -101,6 +111,18 @@
self.useFixture(fixtures.EnvironmentVariable(k))
c.get_one_cloud(cloud='defaults')
+ def test_prefer_ipv6_true(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+ cc = c.get_one_cloud(cloud='_test-cloud_')
+ self.assertTrue(cc.prefer_ipv6)
+
+ def test_prefer_ipv6_false(self):
+ c = config.OpenStackConfig(config_files=[self.no_yaml],
+ vendor_files=[self.no_yaml])
+ cc = c.get_one_cloud(cloud='defaults')
+ self.assertFalse(cc.prefer_ipv6)
+
def test_get_one_cloud_auth_merge(self):
c = config.OpenStackConfig(config_files=[self.cloud_yaml])
cc = c.get_one_cloud(cloud='_test-cloud_', auth={'username': 'user'})
@@ -112,7 +134,9 @@
self.assertEqual(
['_test-cloud-int-project_',
'_test-cloud_',
+ '_test_cloud_hyphenated',
'_test_cloud_no_vendor',
+ '_test_cloud_regions',
],
sorted(c.get_cloud_names()))
c = config.OpenStackConfig(config_files=[self.no_yaml],
@@ -197,6 +221,25 @@
self.assertEqual(cc.region_name, 'test-region')
self.assertIsNone(cc.snack_type)
+ def test_get_one_cloud_no_argparse_regions(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+
+ cc = c.get_one_cloud(cloud='_test_cloud_regions', argparse=None)
+ self._assert_cloud_details(cc)
+ self.assertEqual(cc.region_name, 'region1')
+ self.assertIsNone(cc.snack_type)
+
+ def test_get_one_cloud_no_argparse_region2(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+
+ cc = c.get_one_cloud(
+ cloud='_test_cloud_regions', region_name='region2', argparse=None)
+ self._assert_cloud_details(cc)
+ self.assertEqual(cc.region_name, 'region2')
+ self.assertIsNone(cc.snack_type)
+
def test_fix_env_args(self):
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
vendor_files=[self.vendor_yaml])
@@ -209,9 +252,47 @@
class TestConfigDefault(base.TestCase):
+ def setUp(self):
+ super(TestConfigDefault, self).setUp()
+
+ # Reset defaults after each test so that other tests are
+ # not affected by any changes.
+ self.addCleanup(self._reset_defaults)
+
+ def _reset_defaults(self):
+ defaults._defaults = None
+
def test_set_no_default(self):
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
vendor_files=[self.vendor_yaml])
cc = c.get_one_cloud(cloud='_test-cloud_', argparse=None)
self._assert_cloud_details(cc)
- self.assertEqual(cc.auth_type, 'password')
+ self.assertEqual('password', cc.auth_type)
+
+ def test_set_default_before_init(self):
+ config.set_default('auth_type', 'token')
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+ cc = c.get_one_cloud(cloud='_test-cloud_', argparse=None)
+ self.assertEqual('token', cc.auth_type)
+
+
+class TestBackwardsCompatibility(base.TestCase):
+
+ def test_set_no_default(self):
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+ cloud = {
+ 'identity_endpoint_type': 'admin',
+ 'compute_endpoint_type': 'private',
+ 'endpoint_type': 'public',
+ 'auth_type': 'v3password',
+ }
+ result = c._fix_backwards_interface(cloud)
+ expected = {
+ 'identity_interface': 'admin',
+ 'compute_interface': 'private',
+ 'interface': 'public',
+ 'auth_type': 'v3password',
+ }
+ self.assertEqual(expected, result)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/tests/test_environ.py new/os-client-config-1.6.3/os_client_config/tests/test_environ.py
--- old/os-client-config-1.4.0/os_client_config/tests/test_environ.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/tests/test_environ.py 2015-08-13 11:14:33.000000000 +0200
@@ -51,6 +51,14 @@
cc = c.get_one_cloud('override')
self._assert_cloud_details(cc)
+ def test_envvar_prefer_ipv6_override(self):
+ self.useFixture(
+ fixtures.EnvironmentVariable('OS_PREFER_IPV6', 'false'))
+ c = config.OpenStackConfig(config_files=[self.cloud_yaml],
+ vendor_files=[self.vendor_yaml])
+ cc = c.get_one_cloud('_test-cloud_')
+ self.assertFalse(cc.prefer_ipv6)
+
def test_environ_exists(self):
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
vendor_files=[self.vendor_yaml])
@@ -76,3 +84,12 @@
self._assert_cloud_details(cc)
cc = c.get_one_cloud('_test_cloud_no_vendor')
self._assert_cloud_details(cc)
+
+ def test_config_file_override(self):
+ self.useFixture(
+ fixtures.EnvironmentVariable(
+ 'OS_CLIENT_CONFIG_FILE', self.cloud_yaml))
+ c = config.OpenStackConfig(config_files=[],
+ vendor_files=[self.vendor_yaml])
+ cc = c.get_one_cloud('_test-cloud_')
+ self._assert_cloud_details(cc)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/__init__.py new/os-client-config-1.6.3/os_client_config/vendors/__init__.py
--- old/os-client-config-1.4.0/os_client_config/vendors/__init__.py 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/__init__.py 2015-08-13 11:14:33.000000000 +0200
@@ -17,9 +17,16 @@
import yaml
-vendors_path = os.path.dirname(os.path.realpath(__file__))
+_vendors_path = os.path.dirname(os.path.realpath(__file__))
+_vendor_defaults = None
-CLOUD_DEFAULTS = {}
-for vendor in glob.glob(os.path.join(vendors_path, '*.yaml')):
- with open(vendor, 'r') as f:
- CLOUD_DEFAULTS.update(yaml.safe_load(f))
+
+def get_profile(profile_name):
+ global _vendor_defaults
+ if _vendor_defaults is None:
+ _vendor_defaults = {}
+ for vendor in glob.glob(os.path.join(_vendors_path, '*.yaml')):
+ with open(vendor, 'r') as f:
+ vendor_data = yaml.load(f)
+ _vendor_defaults[vendor_data['name']] = vendor_data['profile']
+ return _vendor_defaults.get(profile_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/auro.yaml new/os-client-config-1.6.3/os_client_config/vendors/auro.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/auro.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/auro.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,10 +1,7 @@
----
-auro:
+name: auro
+profile:
auth:
auth_url: https://api.auro.io:5000/v2.0
region_name: RegionOne
- identity_api_version: 2
- image_api_version: 1
- image_format: qcow2
secgroup_source: nova
floating_ip_source: nova
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/dreamhost.yaml new/os-client-config-1.6.3/os_client_config/vendors/dreamhost.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/dreamhost.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/dreamhost.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,7 +1,7 @@
----
-dreamhost:
+name: dreamhost
+profile:
auth:
auth_url: https://keystone.dream.io/v2.0
region_name: RegionOne
- image_api_version: 2
+ image_api_version: '2'
image_format: raw
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/hp.yaml new/os-client-config-1.6.3/os_client_config/vendors/hp.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/hp.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/hp.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,8 +1,8 @@
----
-hp:
+name: hp
+profile:
auth:
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
- region_name: region-b.geo-1
+ regions:
+ - region-a.geo-1
+ - region-b.geo-1
dns_service_type: hpext:dns
- image_api_version: 1
- image_format: qcow2
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/ovh.yaml new/os-client-config-1.6.3/os_client_config/vendors/ovh.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/ovh.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/ovh.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,10 +1,6 @@
----
-ovh:
+name: ovh
+profile:
auth:
auth_url: https://auth.cloud.ovh.net/v2.0
region_name: SBG1
- identity_api_version: 2
- image_api_version: 1
image_format: raw
- secgroup_source: neutron
- floating_ip_source: neutron
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/rackspace.yaml new/os-client-config-1.6.3/os_client_config/vendors/rackspace.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/rackspace.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/rackspace.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,14 +1,20 @@
----
-rackspace:
+name: rackspace
+profile:
auth:
- auth_url: https://identity.api.rackspacecloud.com/v2.0
- database_service_type: 'rax:database'
+ auth_url: https://identity.api.rackspacecloud.com/v2.0/
+ regions:
+ - DFW
+ - HKG
+ - IAD
+ - ORD
+ - SYD
+ database_service_type: rax:database
compute_service_name: cloudServersOpenStack
- image_api_version: 2
- image_api_use_tasks: True
+ image_api_version: '2'
+ image_api_use_tasks: true
image_format: vhd
floating_ip_source: None
secgroup_source: None
disable_vendor_agent:
vm_mode: hvm
- xenapi_use_agent: False
+ xenapi_use_agent: false
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/runabove.yaml new/os-client-config-1.6.3/os_client_config/vendors/runabove.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/runabove.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/runabove.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,7 +1,10 @@
----
-runabove:
+name: runabove
+profile:
auth:
auth_url: https://auth.runabove.io/v2.0
- image_api_version: 2
+ regions:
+ - BHS-1
+ - SBG-1
+ image_api_version: '2'
image_format: qcow2
- floating_ip_sourc: None
+ floating_ip_source: None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/unitedstack.yaml new/os-client-config-1.6.3/os_client_config/vendors/unitedstack.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/unitedstack.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/unitedstack.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,8 +1,11 @@
----
-unitedstack:
+name: unitedstack
+profile:
auth:
auth_url: https://identity.api.ustack.com/v3
- identity_api_version: 3
- image_api_version: 2
+ regions:
+ - bj1
+ - gd1
+ identity_api_version: '3'
+ image_api_version: '2'
image_format: raw
floating_ip_source: None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config/vendors/vexxhost.yaml new/os-client-config-1.6.3/os_client_config/vendors/vexxhost.yaml
--- old/os-client-config-1.4.0/os_client_config/vendors/vexxhost.yaml 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config/vendors/vexxhost.yaml 2015-08-13 11:14:33.000000000 +0200
@@ -1,8 +1,7 @@
----
-vexxhost:
+name: vexxhost
+profile:
auth:
auth_url: http://auth.api.thenebulacloud.com:5000/v2.0/
region_name: ca-ymq-1
- image_api_version: 2
- image_format: qcow2
+ image_api_version: '2'
floating_ip_source: None
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config.egg-info/PKG-INFO new/os-client-config-1.6.3/os_client_config.egg-info/PKG-INFO
--- old/os-client-config-1.4.0/os_client_config.egg-info/PKG-INFO 2015-06-20 16:21:25.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config.egg-info/PKG-INFO 2015-08-13 11:15:04.000000000 +0200
@@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: os-client-config
-Version: 1.4.0
+Version: 1.6.3
Summary: OpenStack Client Configuation Library
Home-page: http://www.openstack.org/
Author: OpenStack
@@ -51,6 +51,10 @@
The first file found wins.
+ You can also set the environment variable `OS_CLIENT_CONFIG_FILE` to an
+ absolute path of a file to look for and that location will be inserted at the
+ front of the file search list.
+
The keys are all of the keys you'd expect from `OS_*` - except lower case
and without the OS prefix. So, region name is set with `region_name`.
@@ -113,7 +117,10 @@
username: openstackci
password: XXXXXXXX
project_id: 610275
- region_name: DFW,ORD,IAD
+ regions:
+ - DFW
+ - ORD
+ - 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
@@ -124,7 +131,7 @@
available, you can provide one called `clouds-public.yaml`, following the same
location rules previously mentioned for the config files.
- Also, `region_name` can be a list of regions. When you call `get_all_clouds`,
+ `regions` can be a list of regions. When you call `get_all_clouds`,
you'll get a cloud config object for each cloud/region combo.
As seen with `dns_service_type`, any setting that makes sense to be per-service,
@@ -193,6 +200,38 @@
dns_service_type: hpext:dns
+ IPv6
+ ----
+
+ IPv6 may be a thing you would prefer to use not only if the cloud supports it,
+ but also if your local machine support it. A simple boolean flag is settable
+ either in an environment variable, `OS_PREFER_IPV6`, or in the client section
+ of the clouds.yaml.
+
+ ::
+
+ client:
+ prefer_ipv6: true
+ clouds:
+ mordred:
+ profile: hp
+ auth:
+ username: mordred@inaugust.com
+ password: XXXXXXXXX
+ project_name: mordred@inaugust.com
+ region_name: region-b.geo-1
+ monty:
+ profile: rax
+ auth:
+ username: mordred@inaugust.com
+ password: XXXXXXXXX
+ project_name: mordred@inaugust.com
+ region_name: DFW
+
+ The above snippet will tell client programs to prefer returning an IPv6
+ address. This will result in calls to, for instance, `shade`'s `get_public_ip`
+ to return an IPv4 address on HP, and an IPv6 address on Rackspace.
+
Usage
-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config.egg-info/SOURCES.txt new/os-client-config-1.6.3/os_client_config.egg-info/SOURCES.txt
--- old/os-client-config-1.4.0/os_client_config.egg-info/SOURCES.txt 2015-06-20 16:21:25.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config.egg-info/SOURCES.txt 2015-08-13 11:15:04.000000000 +0200
@@ -23,6 +23,7 @@
os_client_config/cloud_config.py
os_client_config/config.py
os_client_config/defaults.py
+os_client_config/defaults.yaml
os_client_config/exceptions.py
os_client_config.egg-info/PKG-INFO
os_client_config.egg-info/SOURCES.txt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/os_client_config.egg-info/pbr.json new/os-client-config-1.6.3/os_client_config.egg-info/pbr.json
--- old/os-client-config-1.4.0/os_client_config.egg-info/pbr.json 2015-06-20 16:21:25.000000000 +0200
+++ new/os-client-config-1.6.3/os_client_config.egg-info/pbr.json 2015-08-13 11:15:04.000000000 +0200
@@ -1 +1 @@
-{"is_release": true, "git_version": "c66eaec"}
\ No newline at end of file
+{"is_release": true, "git_version": "c422fe8"}
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/os-client-config-1.4.0/tox.ini new/os-client-config-1.6.3/tox.ini
--- old/os-client-config-1.4.0/tox.ini 2015-06-20 16:20:50.000000000 +0200
+++ new/os-client-config-1.6.3/tox.ini 2015-08-13 11:14:33.000000000 +0200
@@ -1,6 +1,6 @@
[tox]
minversion = 1.6
-envlist = py33,py34,py26,py27,pypy,pep8
+envlist = py34,py27,pypy,pep8
skipsdist = True
[testenv]
@@ -8,8 +8,7 @@
install_command = pip install -U {opts} {packages}
setenv =
VIRTUAL_ENV={envdir}
-deps = -r{toxinidir}/requirements.txt
- -r{toxinidir}/test-requirements.txt
+deps = -r{toxinidir}/test-requirements.txt
commands = python setup.py testr --slowest --testr-args='{posargs}'
[testenv:pep8]