os-client-config 1.16.0 release
meta:version: 1.16.0 meta:series: mitaka meta:release-type: release meta:announce: openstack-dev@lists.openstack.org meta:pypi: yes -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQEcBAABAgAGBQJWzHKKAAoJEDttBqDEKEN6kI4IAKbfNvcyhZqzrdBIB1X1WCIW E/yoq5J0MUrwLt92Mrmy0VQ1NfRPuSwDZPw3yUogU1oJEVYDXFcm8+rsuWWq+1ni jRfANNSwb4/aqToDpUXuZuVp0piHxEu1k0gM807Wjb2qEkl4DEfxxMK6Qa5uiXea JxMtRtI2A5sYl22aVWn0UBo9LmqzU3a51N/c3VEsbNrt04IkZmXA8SlSHJQw77mW JDZzYiJBsxxRvrvHNUkq1yYg3bFGo8KdMsQa/0jP46Jc1g9HIfRHf0lqkLvYwZKJ fd+OE0TSDyGanAd5mEhnZRWNX67WQ1CWWSy7nwWED3lF8FDEttZyEKA6tL117oU= =NPJO -----END PGP SIGNATURE----- Merge tag '1.16.0' into debian/mitaka os-client-config 1.16.0 release meta:version: 1.16.0 meta:series: mitaka meta:release-type: release meta:announce: openstack-dev@lists.openstack.org meta:pypi: yes
This commit is contained in:
commit
5f08861174
64
README.rst
64
README.rst
@ -88,23 +88,21 @@ An example config file is probably helpful:
|
||||
.. code-block:: yaml
|
||||
|
||||
clouds:
|
||||
mordred:
|
||||
profile: hp
|
||||
mtvexx:
|
||||
profile: vexxhost
|
||||
auth:
|
||||
username: mordred@inaugust.com
|
||||
password: XXXXXXXXX
|
||||
project_name: mordred@inaugust.com
|
||||
region_name: region-b.geo-1
|
||||
dns_service_type: hpext:dns
|
||||
compute_api_version: 1.1
|
||||
monty:
|
||||
region_name: ca-ymq-1
|
||||
dns_api_version: 1
|
||||
mordred:
|
||||
region_name: RegionOne
|
||||
auth:
|
||||
auth_url: https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
|
||||
username: monty.taylor@hp.com
|
||||
password: XXXXXXXX
|
||||
project_name: monty.taylor@hp.com-default-tenant
|
||||
region_name: region-b.geo-1
|
||||
dns_service_type: hpext:dns
|
||||
username: 'mordred'
|
||||
password: XXXXXXX
|
||||
project_name: 'shade'
|
||||
auth_url: 'https://montytaylor-sjc.openstack.blueboxgrid.com:5001/v2.0'
|
||||
infra:
|
||||
profile: rackspace
|
||||
auth:
|
||||
@ -221,14 +219,14 @@ are connecting to OpenStack can share a cache should you desire.
|
||||
server: 5
|
||||
flavor: -1
|
||||
clouds:
|
||||
mordred:
|
||||
profile: hp
|
||||
mtvexx:
|
||||
profile: vexxhost
|
||||
auth:
|
||||
username: mordred@inaugust.com
|
||||
password: XXXXXXXXX
|
||||
project_name: mordred@inaugust.com
|
||||
region_name: region-b.geo-1
|
||||
dns_service_type: hpext:dns
|
||||
region_name: ca-ymq-1
|
||||
dns_api_version: 1
|
||||
|
||||
|
||||
IPv6
|
||||
@ -247,13 +245,14 @@ environment variable.
|
||||
client:
|
||||
force_ipv4: true
|
||||
clouds:
|
||||
mordred:
|
||||
profile: hp
|
||||
mtvexx:
|
||||
profile: vexxhost
|
||||
auth:
|
||||
username: mordred@inaugust.com
|
||||
password: XXXXXXXXX
|
||||
project_name: mordred@inaugust.com
|
||||
region_name: region-b.geo-1
|
||||
region_name: ca-ymq-1
|
||||
dns_api_version: 1
|
||||
monty:
|
||||
profile: rax
|
||||
auth:
|
||||
@ -316,7 +315,7 @@ Get a named cloud.
|
||||
import os_client_config
|
||||
|
||||
cloud_config = os_client_config.OpenStackConfig().get_one_cloud(
|
||||
'hp', region_name='region-b.geo-1')
|
||||
'internap', region_name='ams01')
|
||||
print(cloud_config.name, cloud_config.region, cloud_config.config)
|
||||
|
||||
Or, get all of the clouds.
|
||||
@ -362,12 +361,18 @@ will get you a fully configured `novaclient` instance.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import argparse
|
||||
|
||||
import os_client_config
|
||||
|
||||
nova = os_client_config.make_client('compute')
|
||||
|
||||
If you want to do the same thing but on a named cloud.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import os_client_config
|
||||
|
||||
nova = os_client_config.make_client('compute', cloud='mtvexx')
|
||||
|
||||
If you want to do the same thing but also support command line parsing.
|
||||
|
||||
.. code-block:: python
|
||||
@ -382,6 +387,21 @@ If you want to do the same thing but also support command line parsing.
|
||||
If you want to get fancier than that in your python, then the rest of the
|
||||
API is available to you. But often times, you just want to do the one thing.
|
||||
|
||||
Constructing Mounted Session Objects
|
||||
------------------------------------
|
||||
|
||||
What if you want to make direct REST calls via a Session interface? You're
|
||||
in luck. The same interface for `make_client` is supported for `session_client`
|
||||
and will return you a keystoneauth Session object that is mounted on the
|
||||
endpoint for the service you're looking for.
|
||||
|
||||
import os_client_config
|
||||
|
||||
session = os_client_config.session_client('compute', cloud='vexxhost')
|
||||
|
||||
response = session.get('/servers')
|
||||
server_list = response.json()['servers']
|
||||
|
||||
Source
|
||||
------
|
||||
|
||||
|
@ -142,23 +142,6 @@ de-fra1 Frankfurt, DE
|
||||
|
||||
* Volume API Version is 1
|
||||
|
||||
hp
|
||||
--
|
||||
|
||||
https://region-b.geo-1.identity.hpcloudsvc.com:35357/v2.0
|
||||
|
||||
============== ================
|
||||
Region Name Human Name
|
||||
============== ================
|
||||
region-a.geo-1 US West
|
||||
region-b.geo-1 US East
|
||||
============== ================
|
||||
|
||||
* DNS Service Type is `hpext:dns`
|
||||
* Image API Version is 1
|
||||
* Public IPv4 is provided via NAT with Neutron Floating IP
|
||||
* Volume API Version is 1
|
||||
|
||||
ibmcloud
|
||||
--------
|
||||
|
||||
@ -233,20 +216,6 @@ SYD Sydney
|
||||
:xenapi_use_agent: False
|
||||
* Volume API Version is 1
|
||||
|
||||
runabove
|
||||
--------
|
||||
|
||||
https://auth.runabove.io/v2.0
|
||||
|
||||
============== ================
|
||||
Region Name Human Name
|
||||
============== ================
|
||||
SBG-1 Strassbourg, FR
|
||||
BHS-1 Beauharnois, QC
|
||||
============== ================
|
||||
|
||||
* Floating IPs are not supported
|
||||
|
||||
switchengines
|
||||
-------------
|
||||
|
||||
@ -305,3 +274,17 @@ ca-ymq-1 Montreal
|
||||
|
||||
* DNS API Version is 1
|
||||
* Identity API Version is 3
|
||||
|
||||
zetta
|
||||
-----
|
||||
|
||||
https://identity.api.zetta.io/v3
|
||||
|
||||
============== ================
|
||||
Region Name Human Name
|
||||
============== ================
|
||||
no-osl1 Oslo
|
||||
============== ================
|
||||
|
||||
* DNS API Version is 2
|
||||
* Identity API Version is 3
|
||||
|
@ -18,7 +18,18 @@ from os_client_config import cloud_config
|
||||
from os_client_config.config import OpenStackConfig # noqa
|
||||
|
||||
|
||||
def simple_client(service_key, cloud=None, region_name=None):
|
||||
def get_config(service_key=None, options=None, **kwargs):
|
||||
config = OpenStackConfig()
|
||||
if options:
|
||||
config.register_argparse_options(options, sys.argv, service_key)
|
||||
parsed_options = options.parse_known_args(sys.argv)
|
||||
else:
|
||||
parsed_options = None
|
||||
|
||||
return config.get_one_cloud(options=parsed_options, **kwargs)
|
||||
|
||||
|
||||
def session_client(service_key, options=None, **kwargs):
|
||||
"""Simple wrapper function. It has almost no features.
|
||||
|
||||
This will get you a raw requests Session Adapter that is mounted
|
||||
@ -31,8 +42,10 @@ def simple_client(service_key, cloud=None, region_name=None):
|
||||
get_session_client on it. This function is to make it easy to poke
|
||||
at OpenStack REST APIs with a properly configured keystone session.
|
||||
"""
|
||||
return OpenStackConfig().get_one_cloud(
|
||||
cloud=cloud, region_name=region_name).get_session_client(service_key)
|
||||
cloud = get_config(service_key=service_key, options=options, **kwargs)
|
||||
return cloud.get_session_client(service_key)
|
||||
# Backwards compat - simple_client was a terrible name
|
||||
simple_client = session_client
|
||||
|
||||
|
||||
def make_client(service_key, constructor=None, options=None, **kwargs):
|
||||
@ -45,14 +58,7 @@ def make_client(service_key, constructor=None, options=None, **kwargs):
|
||||
variables and clouds.yaml - and takes as **kwargs anything you'd expect
|
||||
to pass in.
|
||||
"""
|
||||
cloud = get_config(service_key=service_key, options=options, **kwargs)
|
||||
if not constructor:
|
||||
constructor = cloud_config._get_client(service_key)
|
||||
config = OpenStackConfig()
|
||||
if options:
|
||||
config.register_argparse_options(options, sys.argv, service_key)
|
||||
parsed_options = options.parse_args(sys.argv)
|
||||
else:
|
||||
parsed_options = None
|
||||
|
||||
cloud = config.get_one_cloud(options=parsed_options, **kwargs)
|
||||
return cloud.get_legacy_client(service_key, constructor)
|
||||
|
@ -355,22 +355,53 @@ class CloudConfig(object):
|
||||
return client_class(**constructor_kwargs)
|
||||
|
||||
def _get_swift_client(self, client_class, **kwargs):
|
||||
auth_args = self.get_auth_args()
|
||||
auth_version = self.get_api_version('identity')
|
||||
session = self.get_session()
|
||||
token = session.get_token()
|
||||
endpoint = self.get_session_endpoint(service_key='object-store')
|
||||
if not endpoint:
|
||||
return None
|
||||
# If we have a username/password, we want to pass them to
|
||||
# swift - because otherwise it will not re-up tokens appropriately
|
||||
# However, if we only have non-password auth, then get a token
|
||||
# and pass it in
|
||||
swift_kwargs = dict(
|
||||
auth_version=auth_version,
|
||||
preauthurl=endpoint,
|
||||
preauthtoken=token,
|
||||
auth_version=self.get_api_version('identity'),
|
||||
os_options=dict(
|
||||
region_name=self.get_region_name(),
|
||||
auth_token=token,
|
||||
object_storage_url=endpoint,
|
||||
region_name=self.get_region_name()),
|
||||
)
|
||||
service_type=self.get_service_type('object-store'),
|
||||
endpoint_type=self.get_interface('object-store'),
|
||||
|
||||
))
|
||||
if self.config['api_timeout'] is not None:
|
||||
swift_kwargs['timeout'] = float(self.config['api_timeout'])
|
||||
|
||||
# create with password
|
||||
swift_kwargs['user'] = auth_args.get('username')
|
||||
swift_kwargs['key'] = auth_args.get('password')
|
||||
swift_kwargs['authurl'] = auth_args.get('auth_url')
|
||||
os_options = {}
|
||||
if auth_version == '2.0':
|
||||
os_options['tenant_name'] = auth_args.get('project_name')
|
||||
os_options['tenant_id'] = auth_args.get('project_id')
|
||||
else:
|
||||
os_options['project_name'] = auth_args.get('project_name')
|
||||
os_options['project_id'] = auth_args.get('project_id')
|
||||
|
||||
for key in (
|
||||
'user_id',
|
||||
'project_domain_id',
|
||||
'project_domain_name',
|
||||
'user_domain_id',
|
||||
'user_domain_name'):
|
||||
os_options[key] = auth_args.get(key)
|
||||
swift_kwargs['os_options'].update(os_options)
|
||||
|
||||
return client_class(**swift_kwargs)
|
||||
|
||||
def get_cache_expiration_time(self):
|
||||
|
@ -474,12 +474,17 @@ class OpenStackConfig(object):
|
||||
name))
|
||||
|
||||
def _fix_backwards_madness(self, cloud):
|
||||
cloud = self._fix_backwards_project(cloud)
|
||||
cloud = self._fix_backwards_auth_plugin(cloud)
|
||||
cloud = self._fix_backwards_project(cloud)
|
||||
cloud = self._fix_backwards_interface(cloud)
|
||||
cloud = self._handle_domain_id(cloud)
|
||||
return cloud
|
||||
|
||||
def _project_scoped(self, cloud):
|
||||
return ('project_id' in cloud or 'project_name' in cloud
|
||||
or 'project_id' in cloud['auth']
|
||||
or 'project_name' in cloud['auth'])
|
||||
|
||||
def _handle_domain_id(self, cloud):
|
||||
# Allow people to just specify domain once if it's the same
|
||||
mappings = {
|
||||
@ -487,6 +492,10 @@ class OpenStackConfig(object):
|
||||
'domain_name': ('user_domain_name', 'project_domain_name'),
|
||||
}
|
||||
for target_key, possible_values in mappings.items():
|
||||
if not self._project_scoped(cloud):
|
||||
if target_key in cloud and target_key not in cloud['auth']:
|
||||
cloud['auth'][target_key] = cloud.pop(target_key)
|
||||
continue
|
||||
for key in possible_values:
|
||||
if target_key in cloud['auth'] and key not in cloud['auth']:
|
||||
cloud['auth'][key] = cloud['auth'][target_key]
|
||||
@ -498,10 +507,6 @@ class OpenStackConfig(object):
|
||||
# Also handle moving domain names into auth so that domain mapping
|
||||
# is easier
|
||||
mappings = {
|
||||
'project_id': ('tenant_id', 'tenant-id',
|
||||
'project_id', 'project-id'),
|
||||
'project_name': ('tenant_name', 'tenant-name',
|
||||
'project_name', 'project-name'),
|
||||
'domain_id': ('domain_id', 'domain-id'),
|
||||
'domain_name': ('domain_name', 'domain-name'),
|
||||
'user_domain_id': ('user_domain_id', 'user-domain-id'),
|
||||
@ -511,6 +516,19 @@ class OpenStackConfig(object):
|
||||
'project_domain_name', 'project-domain-name'),
|
||||
'token': ('auth-token', 'auth_token', 'token'),
|
||||
}
|
||||
if cloud.get('auth_type', None) == 'v2password':
|
||||
# If v2password is explcitly requested, this is to deal with old
|
||||
# clouds. That's fine - we need to map settings in the opposite
|
||||
# direction
|
||||
mappings['tenant_id'] = (
|
||||
'project_id', 'project-id', 'tenant_id', 'tenant-id')
|
||||
mappings['tenant_name'] = (
|
||||
'project_name', 'project-name', 'tenant_name', 'tenant-name')
|
||||
else:
|
||||
mappings['project_id'] = (
|
||||
'tenant_id', 'tenant-id', 'project_id', 'project-id')
|
||||
mappings['project_name'] = (
|
||||
'tenant_name', 'tenant-name', 'project_name', 'project-name')
|
||||
for target_key, possible_values in mappings.items():
|
||||
target = None
|
||||
for key in possible_values:
|
||||
@ -540,8 +558,6 @@ class OpenStackConfig(object):
|
||||
# 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 register_argparse_arguments(self, parser, argv, service_keys=[]):
|
||||
|
@ -73,6 +73,7 @@ USER_CONF = {
|
||||
'auth': {
|
||||
'username': 'testuser',
|
||||
'password': 'testpass',
|
||||
'domain_id': 'awesome-domain',
|
||||
'project_id': 12345,
|
||||
'auth_url': 'http://example.com/v2',
|
||||
},
|
||||
@ -128,6 +129,14 @@ USER_CONF = {
|
||||
'password': 'testpass',
|
||||
},
|
||||
},
|
||||
'_test-cloud-domain-scoped_': {
|
||||
'auth': {
|
||||
'auth_url': 'http://example.com/v2',
|
||||
'username': 'testuser',
|
||||
'password': 'testpass',
|
||||
'domain-id': '12345',
|
||||
},
|
||||
},
|
||||
},
|
||||
'ansible': {
|
||||
'expand-hostvars': False,
|
||||
|
@ -235,10 +235,23 @@ class TestCloudConfig(base.TestCase):
|
||||
region_name='region-al',
|
||||
service_type='orchestration')
|
||||
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_api_version')
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_auth_args')
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_session_endpoint')
|
||||
def test_legacy_client_object_store(self, mock_get_session_endpoint):
|
||||
def test_legacy_client_object_store_password(
|
||||
self,
|
||||
mock_get_session_endpoint,
|
||||
mock_get_auth_args,
|
||||
mock_get_api_version):
|
||||
mock_client = mock.Mock()
|
||||
mock_get_session_endpoint.return_value = 'http://example.com/v2'
|
||||
mock_get_session_endpoint.return_value = 'http://swift.example.com'
|
||||
mock_get_api_version.return_value = '3'
|
||||
mock_get_auth_args.return_value = dict(
|
||||
username='testuser',
|
||||
password='testpassword',
|
||||
project_name='testproject',
|
||||
auth_url='http://example.com',
|
||||
)
|
||||
config_dict = defaults.get_defaults()
|
||||
config_dict.update(fake_services_dict)
|
||||
cc = cloud_config.CloudConfig(
|
||||
@ -246,19 +259,106 @@ class TestCloudConfig(base.TestCase):
|
||||
cc.get_legacy_client('object-store', mock_client)
|
||||
mock_client.assert_called_with(
|
||||
preauthtoken=mock.ANY,
|
||||
auth_version=u'3',
|
||||
authurl='http://example.com',
|
||||
key='testpassword',
|
||||
os_options={
|
||||
'auth_token': mock.ANY,
|
||||
'region_name': 'region-al',
|
||||
'object_storage_url': 'http://example.com/v2'
|
||||
'object_storage_url': 'http://swift.example.com',
|
||||
'user_id': None,
|
||||
'user_domain_name': None,
|
||||
'project_name': 'testproject',
|
||||
'project_domain_name': None,
|
||||
'project_domain_id': None,
|
||||
'project_id': None,
|
||||
'service_type': 'object-store',
|
||||
'endpoint_type': 'public',
|
||||
'user_domain_id': None
|
||||
},
|
||||
preauthurl='http://example.com/v2',
|
||||
auth_version='2.0')
|
||||
preauthurl='http://swift.example.com',
|
||||
user='testuser')
|
||||
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_auth_args')
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_session_endpoint')
|
||||
def test_legacy_client_object_store_timeout(
|
||||
self, mock_get_session_endpoint):
|
||||
def test_legacy_client_object_store_password_v2(
|
||||
self, mock_get_session_endpoint, mock_get_auth_args):
|
||||
mock_client = mock.Mock()
|
||||
mock_get_session_endpoint.return_value = 'http://swift.example.com'
|
||||
mock_get_auth_args.return_value = dict(
|
||||
username='testuser',
|
||||
password='testpassword',
|
||||
project_name='testproject',
|
||||
auth_url='http://example.com',
|
||||
)
|
||||
config_dict = defaults.get_defaults()
|
||||
config_dict.update(fake_services_dict)
|
||||
cc = cloud_config.CloudConfig(
|
||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||
cc.get_legacy_client('object-store', mock_client)
|
||||
mock_client.assert_called_with(
|
||||
preauthtoken=mock.ANY,
|
||||
auth_version=u'2.0',
|
||||
authurl='http://example.com',
|
||||
key='testpassword',
|
||||
os_options={
|
||||
'auth_token': mock.ANY,
|
||||
'region_name': 'region-al',
|
||||
'object_storage_url': 'http://swift.example.com',
|
||||
'user_id': None,
|
||||
'user_domain_name': None,
|
||||
'tenant_name': 'testproject',
|
||||
'project_domain_name': None,
|
||||
'project_domain_id': None,
|
||||
'tenant_id': None,
|
||||
'service_type': 'object-store',
|
||||
'endpoint_type': 'public',
|
||||
'user_domain_id': None
|
||||
},
|
||||
preauthurl='http://swift.example.com',
|
||||
user='testuser')
|
||||
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_auth_args')
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_session_endpoint')
|
||||
def test_legacy_client_object_store(
|
||||
self, mock_get_session_endpoint, mock_get_auth_args):
|
||||
mock_client = mock.Mock()
|
||||
mock_get_session_endpoint.return_value = 'http://example.com/v2'
|
||||
mock_get_auth_args.return_value = {}
|
||||
config_dict = defaults.get_defaults()
|
||||
config_dict.update(fake_services_dict)
|
||||
cc = cloud_config.CloudConfig(
|
||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||
cc.get_legacy_client('object-store', mock_client)
|
||||
mock_client.assert_called_with(
|
||||
preauthtoken=mock.ANY,
|
||||
auth_version=u'2.0',
|
||||
authurl=None,
|
||||
key=None,
|
||||
os_options={
|
||||
'auth_token': mock.ANY,
|
||||
'region_name': 'region-al',
|
||||
'object_storage_url': 'http://example.com/v2',
|
||||
'user_id': None,
|
||||
'user_domain_name': None,
|
||||
'tenant_name': None,
|
||||
'project_domain_name': None,
|
||||
'project_domain_id': None,
|
||||
'tenant_id': None,
|
||||
'service_type': 'object-store',
|
||||
'endpoint_type': 'public',
|
||||
'user_domain_id': None
|
||||
},
|
||||
preauthurl='http://example.com/v2',
|
||||
user=None)
|
||||
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_auth_args')
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_session_endpoint')
|
||||
def test_legacy_client_object_store_timeout(
|
||||
self, mock_get_session_endpoint, mock_get_auth_args):
|
||||
mock_client = mock.Mock()
|
||||
mock_get_session_endpoint.return_value = 'http://example.com/v2'
|
||||
mock_get_auth_args.return_value = {}
|
||||
config_dict = defaults.get_defaults()
|
||||
config_dict.update(fake_services_dict)
|
||||
config_dict['api_timeout'] = 9
|
||||
@ -267,32 +367,59 @@ class TestCloudConfig(base.TestCase):
|
||||
cc.get_legacy_client('object-store', mock_client)
|
||||
mock_client.assert_called_with(
|
||||
preauthtoken=mock.ANY,
|
||||
auth_version=u'2.0',
|
||||
authurl=None,
|
||||
key=None,
|
||||
os_options={
|
||||
'auth_token': mock.ANY,
|
||||
'region_name': 'region-al',
|
||||
'object_storage_url': 'http://example.com/v2'
|
||||
'object_storage_url': 'http://example.com/v2',
|
||||
'user_id': None,
|
||||
'user_domain_name': None,
|
||||
'tenant_name': None,
|
||||
'project_domain_name': None,
|
||||
'project_domain_id': None,
|
||||
'tenant_id': None,
|
||||
'service_type': 'object-store',
|
||||
'endpoint_type': 'public',
|
||||
'user_domain_id': None
|
||||
},
|
||||
preauthurl='http://example.com/v2',
|
||||
auth_version='2.0',
|
||||
timeout=9.0)
|
||||
timeout=9.0,
|
||||
user=None)
|
||||
|
||||
def test_legacy_client_object_store_endpoint(self):
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_auth_args')
|
||||
def test_legacy_client_object_store_endpoint(
|
||||
self, mock_get_auth_args):
|
||||
mock_client = mock.Mock()
|
||||
mock_get_auth_args.return_value = {}
|
||||
config_dict = defaults.get_defaults()
|
||||
config_dict.update(fake_services_dict)
|
||||
config_dict['object_store_endpoint'] = 'http://example.com/v2'
|
||||
config_dict['object_store_endpoint'] = 'http://example.com/swift'
|
||||
cc = cloud_config.CloudConfig(
|
||||
"test1", "region-al", config_dict, auth_plugin=mock.Mock())
|
||||
cc.get_legacy_client('object-store', mock_client)
|
||||
mock_client.assert_called_with(
|
||||
preauthtoken=mock.ANY,
|
||||
auth_version=u'2.0',
|
||||
authurl=None,
|
||||
key=None,
|
||||
os_options={
|
||||
'auth_token': mock.ANY,
|
||||
'region_name': 'region-al',
|
||||
'object_storage_url': 'http://example.com/v2'
|
||||
'object_storage_url': 'http://example.com/swift',
|
||||
'user_id': None,
|
||||
'user_domain_name': None,
|
||||
'tenant_name': None,
|
||||
'project_domain_name': None,
|
||||
'project_domain_id': None,
|
||||
'tenant_id': None,
|
||||
'service_type': 'object-store',
|
||||
'endpoint_type': 'public',
|
||||
'user_domain_id': None
|
||||
},
|
||||
preauthurl='http://example.com/v2',
|
||||
auth_version='2.0')
|
||||
preauthurl='http://example.com/swift',
|
||||
user=None)
|
||||
|
||||
@mock.patch.object(cloud_config.CloudConfig, 'get_session_endpoint')
|
||||
def test_legacy_client_image(self, mock_get_session_endpoint):
|
||||
|
@ -103,6 +103,22 @@ class TestConfig(base.TestCase):
|
||||
self.assertNotIn('domain_id', cc.auth)
|
||||
self.assertNotIn('domain-id', cc.auth)
|
||||
|
||||
def test_get_one_cloud_domain_scoped(self):
|
||||
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||
vendor_files=[self.vendor_yaml])
|
||||
cc = c.get_one_cloud('_test-cloud-domain-scoped_')
|
||||
self.assertEqual('12345', cc.auth['domain_id'])
|
||||
self.assertNotIn('user_domain_id', cc.auth)
|
||||
self.assertNotIn('project_domain_id', cc.auth)
|
||||
|
||||
def test_get_one_cloud_infer_user_domain(self):
|
||||
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||
vendor_files=[self.vendor_yaml])
|
||||
cc = c.get_one_cloud('_test-cloud-int-project_')
|
||||
self.assertEqual('awesome-domain', cc.auth['user_domain_id'])
|
||||
self.assertEqual('awesome-domain', cc.auth['project_domain_id'])
|
||||
self.assertNotIn('domain_id', cc.auth)
|
||||
|
||||
def test_get_one_cloud_with_hyphenated_project_id(self):
|
||||
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||
vendor_files=[self.vendor_yaml])
|
||||
@ -183,6 +199,7 @@ class TestConfig(base.TestCase):
|
||||
secure_files=[self.no_yaml])
|
||||
self.assertEqual(
|
||||
['_test-cloud-domain-id_',
|
||||
'_test-cloud-domain-scoped_',
|
||||
'_test-cloud-int-project_',
|
||||
'_test-cloud_',
|
||||
'_test-cloud_no_region',
|
||||
@ -696,3 +713,43 @@ class TestBackwardsCompatibility(base.TestCase):
|
||||
'auth_type': 'v3password',
|
||||
}
|
||||
self.assertDictEqual(expected, result)
|
||||
|
||||
def test_project_v2password(self):
|
||||
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||
vendor_files=[self.vendor_yaml])
|
||||
cloud = {
|
||||
'auth_type': 'v2password',
|
||||
'auth': {
|
||||
'project-name': 'my_project_name',
|
||||
'project-id': 'my_project_id'
|
||||
}
|
||||
}
|
||||
result = c._fix_backwards_project(cloud)
|
||||
expected = {
|
||||
'auth_type': 'v2password',
|
||||
'auth': {
|
||||
'tenant_name': 'my_project_name',
|
||||
'tenant_id': 'my_project_id'
|
||||
}
|
||||
}
|
||||
self.assertEqual(expected, result)
|
||||
|
||||
def test_project_password(self):
|
||||
c = config.OpenStackConfig(config_files=[self.cloud_yaml],
|
||||
vendor_files=[self.vendor_yaml])
|
||||
cloud = {
|
||||
'auth_type': 'password',
|
||||
'auth': {
|
||||
'project-name': 'my_project_name',
|
||||
'project-id': 'my_project_id'
|
||||
}
|
||||
}
|
||||
result = c._fix_backwards_project(cloud)
|
||||
expected = {
|
||||
'auth_type': 'password',
|
||||
'auth': {
|
||||
'project_name': 'my_project_name',
|
||||
'project_id': 'my_project_id'
|
||||
}
|
||||
}
|
||||
self.assertEqual(expected, result)
|
||||
|
16
os_client_config/vendors/hp.json
vendored
16
os_client_config/vendors/hp.json
vendored
@ -1,16 +0,0 @@
|
||||
{
|
||||
"name": "hp",
|
||||
"profile": {
|
||||
"auth": {
|
||||
"auth_url": "https://region-b.geo-1.identity.hpcloudsvc.com:35357"
|
||||
},
|
||||
"regions": [
|
||||
"region-a.geo-1",
|
||||
"region-b.geo-1"
|
||||
],
|
||||
"identity_api_version": "3",
|
||||
"dns_service_type": "hpext:dns",
|
||||
"volume_api_version": "1",
|
||||
"image_api_version": "1"
|
||||
}
|
||||
}
|
15
os_client_config/vendors/runabove.json
vendored
15
os_client_config/vendors/runabove.json
vendored
@ -1,15 +0,0 @@
|
||||
{
|
||||
"name": "runabove",
|
||||
"profile": {
|
||||
"auth": {
|
||||
"auth_url": "https://auth.runabove.io/"
|
||||
},
|
||||
"regions": [
|
||||
"BHS-1",
|
||||
"SBG-1"
|
||||
],
|
||||
"identity_api_version": "3",
|
||||
"image_format": "qcow2",
|
||||
"floating_ip_source": "None"
|
||||
}
|
||||
}
|
2
os_client_config/vendors/vexxhost.json
vendored
2
os_client_config/vendors/vexxhost.json
vendored
@ -2,7 +2,7 @@
|
||||
"name": "vexxhost",
|
||||
"profile": {
|
||||
"auth": {
|
||||
"auth_url": "http://auth.vexxhost.net"
|
||||
"auth_url": "https://auth.vexxhost.net"
|
||||
},
|
||||
"regions": [
|
||||
"ca-ymq-1"
|
||||
|
13
os_client_config/vendors/zetta.json
vendored
Normal file
13
os_client_config/vendors/zetta.json
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
{
|
||||
"name": "zetta",
|
||||
"profile": {
|
||||
"auth": {
|
||||
"auth_url": "https://identity.api.zetta.io/v3"
|
||||
},
|
||||
"regions": [
|
||||
"no-osl1"
|
||||
],
|
||||
"identity_api_version": "3",
|
||||
"dns_api_version": "2"
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
---
|
||||
prelude: >
|
||||
Swiftclient instantiation now provides authentication
|
||||
information so that long lived swiftclient objects can
|
||||
reauthenticate if necessary. This should be a temporary
|
||||
situation until swiftclient supports keystoneauth
|
||||
sessions at which point os-client-config will instantiate
|
||||
swiftclient with a keystoneauth session.
|
||||
features:
|
||||
- Swiftclient instantiation now provides authentication
|
||||
information so that long lived swiftclient objects can
|
||||
reauthenticate if necessary.
|
||||
- Add support for explicit v2password auth type.
|
||||
- Add SSL support to VEXXHOST vendor profile.
|
||||
- Add zetta.io cloud vendor profile.
|
||||
fixes:
|
||||
- Fix bug where project_domain_{name,id} was set even
|
||||
if project_{name,id} was not set.
|
||||
other:
|
||||
- HPCloud vendor profile removed due to cloud shutdown.
|
||||
- RunAbove vendor profile removed due to migration to
|
||||
OVH.
|
6
releasenotes/notes/session-client-b581a6e5d18c8f04.yaml
Normal file
6
releasenotes/notes/session-client-b581a6e5d18c8f04.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
features:
|
||||
- Added kwargs and argparse processing for session_client.
|
||||
deprecations:
|
||||
- Renamed simple_client to session_client. simple_client
|
||||
will remain as an alias for backwards compat.
|
0
releasenotes/source/_static/.placeholder
Normal file
0
releasenotes/source/_static/.placeholder
Normal file
0
releasenotes/source/_templates/.placeholder
Normal file
0
releasenotes/source/_templates/.placeholder
Normal file
261
releasenotes/source/conf.py
Normal file
261
releasenotes/source/conf.py
Normal file
@ -0,0 +1,261 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# Os-Client-Config Release Notes documentation build configuration file, created by
|
||||
# sphinx-quickstart on Thu Nov 5 11:50:32 2015.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'oslosphinx',
|
||||
'reno.sphinxext',
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The encoding of source files.
|
||||
#source_encoding = 'utf-8-sig'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'os-client-config Release Notes'
|
||||
copyright = u'2015, os-client-config developers'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
import pbr.version
|
||||
occ_version = pbr.version.VersionInfo('os-client-config')
|
||||
# The short X.Y version.
|
||||
version = occ_version.canonical_version_string()
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = occ_version.version_string_with_vcs()
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#language = None
|
||||
|
||||
# There are two options for replacing |today|: either, you set today to some
|
||||
# non-false value, then it is used:
|
||||
#today = ''
|
||||
# Else, today_fmt is used as the format for a strftime call.
|
||||
#today_fmt = '%B %d, %Y'
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
exclude_patterns = []
|
||||
|
||||
# The reST default role (used for this markup: `text`) to use for all
|
||||
# documents.
|
||||
#default_role = None
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
#add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
#add_module_names = True
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
#show_authors = False
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# A list of ignored prefixes for module index sorting.
|
||||
#modindex_common_prefix = []
|
||||
|
||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||
#keep_warnings = False
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
html_theme = 'default'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom themes here, relative to this directory.
|
||||
#html_theme_path = []
|
||||
|
||||
# The name for this set of Sphinx documents. If None, it defaults to
|
||||
# "<project> v<release> documentation".
|
||||
#html_title = None
|
||||
|
||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||
#html_short_title = None
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
#html_logo = None
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
# pixels large.
|
||||
#html_favicon = None
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Add any extra paths that contain custom files (such as robots.txt or
|
||||
# .htaccess) here, relative to this directory. These files are copied
|
||||
# directly to the root of the documentation.
|
||||
#html_extra_path = []
|
||||
|
||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||
# using the given strftime format.
|
||||
#html_last_updated_fmt = '%b %d, %Y'
|
||||
|
||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||
# typographically correct entities.
|
||||
#html_use_smartypants = True
|
||||
|
||||
# Custom sidebar templates, maps document names to template names.
|
||||
#html_sidebars = {}
|
||||
|
||||
# Additional templates that should be rendered to pages, maps page names to
|
||||
# template names.
|
||||
#html_additional_pages = {}
|
||||
|
||||
# If false, no module index is generated.
|
||||
#html_domain_indices = True
|
||||
|
||||
# If false, no index is generated.
|
||||
#html_use_index = True
|
||||
|
||||
# If true, the index is split into individual pages for each letter.
|
||||
#html_split_index = False
|
||||
|
||||
# If true, links to the reST sources are added to the pages.
|
||||
#html_show_sourcelink = True
|
||||
|
||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||
#html_show_sphinx = True
|
||||
|
||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||
#html_show_copyright = True
|
||||
|
||||
# If true, an OpenSearch description file will be output, and all pages will
|
||||
# contain a <link> tag referring to it. The value of this option must be the
|
||||
# base URL from which the finished HTML is served.
|
||||
#html_use_opensearch = ''
|
||||
|
||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||
#html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'OCCReleaseNotesdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#'preamble': '',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'OCCReleaseNotes.tex', u'os-client-config Release Notes Documentation',
|
||||
u'os-client-config developers', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
# the title page.
|
||||
#latex_logo = None
|
||||
|
||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||
# not chapters.
|
||||
#latex_use_parts = False
|
||||
|
||||
# If true, show page references after internal links.
|
||||
#latex_show_pagerefs = False
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#latex_show_urls = False
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#latex_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#latex_domain_indices = True
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'occreleasenotes', u'os-client-config Release Notes Documentation',
|
||||
[u'os-client-config developers'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
#man_show_urls = False
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'OCCReleaseNotes', u'os-client-config Release Notes Documentation',
|
||||
u'os-client-config developers', 'OCCReleaseNotes',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
#texinfo_appendices = []
|
||||
|
||||
# If false, no module index is generated.
|
||||
#texinfo_domain_indices = True
|
||||
|
||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||
#texinfo_show_urls = 'footnote'
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
17
releasenotes/source/index.rst
Normal file
17
releasenotes/source/index.rst
Normal file
@ -0,0 +1,17 @@
|
||||
Welcome to Nova Release Notes documentation!
|
||||
==============================================
|
||||
|
||||
Contents
|
||||
========
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
unreleased
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`search`
|
5
releasenotes/source/unreleased.rst
Normal file
5
releasenotes/source/unreleased.rst
Normal file
@ -0,0 +1,5 @@
|
||||
============================
|
||||
Current Series Release Notes
|
||||
============================
|
||||
|
||||
.. release-notes::
|
@ -2,7 +2,7 @@
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
hacking>=0.9.2,<0.10
|
||||
hacking>=0.10.2,<0.11 # Apache-2.0
|
||||
|
||||
coverage>=3.6
|
||||
extras
|
||||
|
10
tox.ini
10
tox.ini
@ -28,11 +28,11 @@ commands =
|
||||
python setup.py build_sphinx
|
||||
python setup.py check -r -s
|
||||
|
||||
[flake8]
|
||||
# H803 skipped on purpose per list discussion.
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
[testenv:releasenotes]
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
ignore = E123,E125,H803
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,releasenotes/source/conf.py
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user