Merge "fixed typos found by RETF rules"
This commit is contained in:
commit
570a9dc22d
@ -249,7 +249,7 @@ class TokenMethod(AuthMethod):
|
|||||||
_method_parameters = ['token']
|
_method_parameters = ['token']
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
"""Construct a Auth plugin to fetch a token from a token.
|
"""Construct an Auth plugin to fetch a token from a token.
|
||||||
|
|
||||||
:param string token: Token for authentication.
|
:param string token: Token for authentication.
|
||||||
"""
|
"""
|
||||||
|
@ -57,7 +57,7 @@ def filter_kwargs(f):
|
|||||||
|
|
||||||
id_value = getid(ref)
|
id_value = getid(ref)
|
||||||
if id_value != ref:
|
if id_value != ref:
|
||||||
# If an object with an id was passed, then use the id, e.g:
|
# If an object with an id was passed, then use the id, e.g.:
|
||||||
# user: user(id=1) becomes user_id: 1
|
# user: user(id=1) becomes user_id: 1
|
||||||
key = '%s_id' % key
|
key = '%s_id' % key
|
||||||
|
|
||||||
|
@ -425,8 +425,9 @@ class Discover(object):
|
|||||||
version = _normalize_version_number(version)
|
version = _normalize_version_number(version)
|
||||||
|
|
||||||
for keystone_version in six.itervalues(versions):
|
for keystone_version in six.itervalues(versions):
|
||||||
# major versions must be the same (eg even though v2 is a lower
|
# major versions must be the same (e.g. even though v2
|
||||||
# version than v3 we can't use it if v2 was requested)
|
# is a lower version than v3 we can't use it if v2 was
|
||||||
|
# requested)
|
||||||
if version[0] != keystone_version.version[0]:
|
if version[0] != keystone_version.version[0]:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ opts = [
|
|||||||
default=None,
|
default=None,
|
||||||
help='Complete admin Identity API endpoint. This should '
|
help='Complete admin Identity API endpoint. This should '
|
||||||
'specify the unversioned root endpoint '
|
'specify the unversioned root endpoint '
|
||||||
'eg. https://localhost:35357/'),
|
'e.g. https://localhost:35357/'),
|
||||||
cfg.StrOpt('auth_version',
|
cfg.StrOpt('auth_version',
|
||||||
default=None,
|
default=None,
|
||||||
help='API version of the admin Identity API endpoint'),
|
help='API version of the admin Identity API endpoint'),
|
||||||
|
@ -61,7 +61,7 @@ def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False):
|
|||||||
:param rest_with_last: If True, trailing data will be returned as part
|
:param rest_with_last: If True, trailing data will be returned as part
|
||||||
of last segment. If False, and there is
|
of last segment. If False, and there is
|
||||||
trailing data, raises ValueError.
|
trailing data, raises ValueError.
|
||||||
:returns: list of segments with a length of maxsegs (non-existant
|
:returns: list of segments with a length of maxsegs (non-existent
|
||||||
segments will return as None)
|
segments will return as None)
|
||||||
:raises: ValueError if given an invalid path
|
:raises: ValueError if given an invalid path
|
||||||
"""
|
"""
|
||||||
@ -183,7 +183,7 @@ class S3Token(object):
|
|||||||
token = req.headers.get('X-Auth-Token',
|
token = req.headers.get('X-Auth-Token',
|
||||||
req.headers.get('X-Storage-Token'))
|
req.headers.get('X-Storage-Token'))
|
||||||
if not token:
|
if not token:
|
||||||
msg = 'You did not specify a auth or a storage token. skipping.'
|
msg = 'You did not specify an auth or a storage token. skipping.'
|
||||||
self.logger.debug(msg)
|
self.logger.debug(msg)
|
||||||
return self.app(environ, start_response)
|
return self.app(environ, start_response)
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ class ServiceCatalog(object):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def factory(cls, resource_dict, token=None, region_name=None):
|
def factory(cls, resource_dict, token=None, region_name=None):
|
||||||
"""Create ServiceCatalog object given a auth token."""
|
"""Create ServiceCatalog object given an auth token."""
|
||||||
if ServiceCatalogV3.is_valid(resource_dict):
|
if ServiceCatalogV3.is_valid(resource_dict):
|
||||||
return ServiceCatalogV3(token, resource_dict, region_name)
|
return ServiceCatalogV3(token, resource_dict, region_name)
|
||||||
elif ServiceCatalogV2.is_valid(resource_dict):
|
elif ServiceCatalogV2.is_valid(resource_dict):
|
||||||
|
@ -129,7 +129,7 @@ class Session(object):
|
|||||||
provided such that the base URL can be determined.
|
provided such that the base URL can be determined.
|
||||||
If a fully qualified URL is provided then
|
If a fully qualified URL is provided then
|
||||||
endpoint_filter will be ignored.
|
endpoint_filter will be ignored.
|
||||||
:param string method: The http method to use. (eg. 'GET', 'POST')
|
:param string method: The http method to use. (e.g. 'GET', 'POST')
|
||||||
:param string original_ip: Mark this request as forwarded for this ip.
|
:param string original_ip: Mark this request as forwarded for this ip.
|
||||||
(optional)
|
(optional)
|
||||||
:param dict headers: Headers to be included in the request. (optional)
|
:param dict headers: Headers to be included in the request. (optional)
|
||||||
@ -186,7 +186,7 @@ class Session(object):
|
|||||||
|
|
||||||
headers['X-Auth-Token'] = token
|
headers['X-Auth-Token'] = token
|
||||||
|
|
||||||
# if we are passed a fully qualified URL and a endpoint_filter we
|
# if we are passed a fully qualified URL and an endpoint_filter we
|
||||||
# should ignore the filter. This will make it easier for clients who
|
# should ignore the filter. This will make it easier for clients who
|
||||||
# want to overrule the default endpoint_filter data added to all client
|
# want to overrule the default endpoint_filter data added to all client
|
||||||
# requests. We check fully qualified here by the presence of a host.
|
# requests. We check fully qualified here by the presence of a host.
|
||||||
|
@ -1278,7 +1278,7 @@ class v2AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest,
|
|||||||
tenant
|
tenant
|
||||||
|
|
||||||
The tests below were originally part of the generic AuthTokenMiddlewareTest
|
The tests below were originally part of the generic AuthTokenMiddlewareTest
|
||||||
class, but now, since they really are v2 specifc, they are included here.
|
class, but now, since they really are v2 specific, they are included here.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -1440,7 +1440,7 @@ class v3AuthTokenMiddlewareTest(BaseAuthTokenMiddlewareTest,
|
|||||||
"""Test auth_token middleware with v3 tokens.
|
"""Test auth_token middleware with v3 tokens.
|
||||||
|
|
||||||
Re-execute the AuthTokenMiddlewareTest class tests, but with the
|
Re-execute the AuthTokenMiddlewareTest class tests, but with the
|
||||||
the auth_token middleware configured to expect v3 tokens back from
|
auth_token middleware configured to expect v3 tokens back from
|
||||||
a keystone server.
|
a keystone server.
|
||||||
|
|
||||||
This is done by configuring the AuthTokenMiddlewareTest class via
|
This is done by configuring the AuthTokenMiddlewareTest class via
|
||||||
|
@ -570,7 +570,7 @@ class DiscoverUtils(utils.TestCase):
|
|||||||
|
|
||||||
versionRaises('hello')
|
versionRaises('hello')
|
||||||
versionRaises('1.a')
|
versionRaises('1.a')
|
||||||
versionRaises('vaccuum')
|
versionRaises('vacuum')
|
||||||
|
|
||||||
def test_keystone_version_objects(self):
|
def test_keystone_version_objects(self):
|
||||||
v31s = discover._KeystoneVersion((3, 1), 'stable')
|
v31s = discover._KeystoneVersion((3, 1), 'stable')
|
||||||
|
@ -264,7 +264,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
self.assertEqual(httpretty.last_request().headers.get('X-Auth-Token'),
|
self.assertEqual(httpretty.last_request().headers.get('X-Auth-Token'),
|
||||||
fake_token)
|
fake_token)
|
||||||
|
|
||||||
# if we clear that overriden token then we fall back to the original
|
# if we clear that overridden token then we fall back to the original
|
||||||
del cl.auth_token
|
del cl.auth_token
|
||||||
|
|
||||||
resp, body = cl.get(fake_url)
|
resp, body = cl.get(fake_url)
|
||||||
|
@ -79,7 +79,7 @@ class TenantTests(utils.TestCase):
|
|||||||
req_body['tenant']['description'],
|
req_body['tenant']['description'],
|
||||||
req_body['tenant']['enabled'],
|
req_body['tenant']['enabled'],
|
||||||
extravalue01=req_body['tenant']['extravalue01'],
|
extravalue01=req_body['tenant']['extravalue01'],
|
||||||
name="dont overwrite priors")
|
name="don't overwrite priors")
|
||||||
self.assertIsInstance(tenant, tenants.Tenant)
|
self.assertIsInstance(tenant, tenants.Tenant)
|
||||||
self.assertEqual(tenant.id, 4)
|
self.assertEqual(tenant.id, 4)
|
||||||
self.assertEqual(tenant.name, "tenantX")
|
self.assertEqual(tenant.name, "tenantX")
|
||||||
@ -188,7 +188,7 @@ class TenantTests(utils.TestCase):
|
|||||||
req_body['tenant']['description'],
|
req_body['tenant']['description'],
|
||||||
req_body['tenant']['enabled'],
|
req_body['tenant']['enabled'],
|
||||||
extravalue01=req_body['tenant']['extravalue01'],
|
extravalue01=req_body['tenant']['extravalue01'],
|
||||||
name="dont overwrite priors")
|
name="don't overwrite priors")
|
||||||
self.assertIsInstance(tenant, tenants.Tenant)
|
self.assertIsInstance(tenant, tenants.Tenant)
|
||||||
self.assertRequestBodyIs(json=req_body)
|
self.assertRequestBodyIs(json=req_body)
|
||||||
self.assertEqual(tenant.id, 4)
|
self.assertEqual(tenant.id, 4)
|
||||||
|
@ -359,7 +359,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
|||||||
self.assertEqual(httpretty.last_request().headers.get('X-Auth-Token'),
|
self.assertEqual(httpretty.last_request().headers.get('X-Auth-Token'),
|
||||||
fake_token)
|
fake_token)
|
||||||
|
|
||||||
# if we clear that overriden token then we fall back to the original
|
# if we clear that overridden token then we fall back to the original
|
||||||
del cl.auth_token
|
del cl.auth_token
|
||||||
|
|
||||||
resp, body = cl.get(fake_url)
|
resp, body = cl.get(fake_url)
|
||||||
|
@ -70,7 +70,7 @@ class IdentityProviderTests(utils.TestCase, utils.CrudTests):
|
|||||||
|
|
||||||
# req_ref argument allows you to specify a different
|
# req_ref argument allows you to specify a different
|
||||||
# signature for the request when the manager does some
|
# signature for the request when the manager does some
|
||||||
# conversion before doing the request (e.g converting
|
# conversion before doing the request (e.g. converting
|
||||||
# from datetime object to timestamp string)
|
# from datetime object to timestamp string)
|
||||||
req_ref = (req_ref or ref).copy()
|
req_ref = (req_ref or ref).copy()
|
||||||
req_ref.pop('id')
|
req_ref.pop('id')
|
||||||
@ -110,7 +110,7 @@ class MappingTests(utils.TestCase, utils.CrudTests):
|
|||||||
|
|
||||||
# req_ref argument allows you to specify a different
|
# req_ref argument allows you to specify a different
|
||||||
# signature for the request when the manager does some
|
# signature for the request when the manager does some
|
||||||
# conversion before doing the request (e.g converting
|
# conversion before doing the request (e.g. converting
|
||||||
# from datetime object to timestamp string)
|
# from datetime object to timestamp string)
|
||||||
req_ref = (req_ref or ref).copy()
|
req_ref = (req_ref or ref).copy()
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class CrudTests(object):
|
|||||||
|
|
||||||
# req_ref argument allows you to specify a different
|
# req_ref argument allows you to specify a different
|
||||||
# signature for the request when the manager does some
|
# signature for the request when the manager does some
|
||||||
# conversion before doing the request (e.g converting
|
# conversion before doing the request (e.g. converting
|
||||||
# from datetime object to timestamp string)
|
# from datetime object to timestamp string)
|
||||||
req_ref = (req_ref or ref).copy()
|
req_ref = (req_ref or ref).copy()
|
||||||
req_ref.pop('id')
|
req_ref.pop('id')
|
||||||
@ -305,7 +305,7 @@ class CrudTests(object):
|
|||||||
|
|
||||||
# req_ref argument allows you to specify a different
|
# req_ref argument allows you to specify a different
|
||||||
# signature for the request when the manager does some
|
# signature for the request when the manager does some
|
||||||
# conversion before doing the request (e.g converting
|
# conversion before doing the request (e.g. converting
|
||||||
# from datetime object to timestamp string)
|
# from datetime object to timestamp string)
|
||||||
req_ref = (req_ref or ref).copy()
|
req_ref = (req_ref or ref).copy()
|
||||||
req_ref.pop('id')
|
req_ref.pop('id')
|
||||||
|
@ -65,7 +65,7 @@ def print_list(objs, fields, formatters={}, order_by=None):
|
|||||||
|
|
||||||
|
|
||||||
def _word_wrap(string, max_length=0):
|
def _word_wrap(string, max_length=0):
|
||||||
"""wrap long strings to be no longer then max_length."""
|
"""wrap long strings to be no longer than max_length."""
|
||||||
if max_length <= 0:
|
if max_length <= 0:
|
||||||
return string
|
return string
|
||||||
return '\n'.join([string[i:i + max_length] for i in
|
return '\n'.join([string[i:i + max_length] for i in
|
||||||
|
@ -385,7 +385,7 @@ def do_user_role_list(kc, args):
|
|||||||
'the authenticated user will be used.')
|
'the authenticated user will be used.')
|
||||||
@utils.arg('--user_id', help=argparse.SUPPRESS)
|
@utils.arg('--user_id', help=argparse.SUPPRESS)
|
||||||
@utils.arg('--tenant-id', metavar='<tenant-id>',
|
@utils.arg('--tenant-id', metavar='<tenant-id>',
|
||||||
help='Tenant ID for which to to create credentials. If not '
|
help='Tenant ID for which to create credentials. If not '
|
||||||
'specified, the authenticated tenant ID will be used.')
|
'specified, the authenticated tenant ID will be used.')
|
||||||
@utils.arg('--tenant_id', help=argparse.SUPPRESS)
|
@utils.arg('--tenant_id', help=argparse.SUPPRESS)
|
||||||
def do_ec2_credentials_create(kc, args):
|
def do_ec2_credentials_create(kc, args):
|
||||||
|
Loading…
Reference in New Issue
Block a user