Set pep8 version to 1.1 in test_requires
* Fixes bug 1007520 * Changes in pep8 cause new failures Change-Id: Ie678f01a5008b0df6ef43a360b599890cab40776
This commit is contained in:
@@ -165,7 +165,7 @@ class HTTPClient(httplib2.Http):
|
||||
endpoint_type=self.endpoint_type,
|
||||
service_type=self.service_type,
|
||||
service_name=self.service_name,
|
||||
volume_service_name=self.volume_service_name,)
|
||||
volume_service_name=self.volume_service_name)
|
||||
self.management_url = management_url.rstrip('/')
|
||||
return None
|
||||
except exceptions.AmbiguousEndpoints:
|
||||
@@ -219,8 +219,8 @@ class HTTPClient(httplib2.Http):
|
||||
# TODO(sandy): Assume admin endpoint is 35357 for now.
|
||||
# Ideally this is going to have to be provided by the service catalog.
|
||||
new_netloc = netloc.replace(':%d' % port, ':%d' % (35357,))
|
||||
admin_url = urlparse.urlunsplit(
|
||||
(scheme, new_netloc, path, query, frag))
|
||||
admin_url = urlparse.urlunsplit((scheme, new_netloc,
|
||||
path, query, frag))
|
||||
|
||||
auth_url = self.auth_url
|
||||
if self.version == "v2.0":
|
||||
|
||||
@@ -117,7 +117,8 @@ class HTTPNotImplemented(ClientException):
|
||||
#
|
||||
# Instead, we have to hardcode it:
|
||||
_code_map = dict((c.http_status, c) for c in [BadRequest, Unauthorized,
|
||||
Forbidden, NotFound, OverLimit, HTTPNotImplemented])
|
||||
Forbidden, NotFound,
|
||||
OverLimit, HTTPNotImplemented])
|
||||
|
||||
|
||||
def from_response(response, body):
|
||||
|
||||
@@ -69,7 +69,7 @@ class OpenStackCinderShell(object):
|
||||
parser = CinderClientArgumentParser(
|
||||
prog='cinder',
|
||||
description=__doc__.strip(),
|
||||
epilog='See "cinder help COMMAND" '\
|
||||
epilog='See "cinder help COMMAND" '
|
||||
'for help on a specific command.',
|
||||
add_help=False,
|
||||
formatter_class=OpenStackHelpFormatter,
|
||||
@@ -78,8 +78,7 @@ class OpenStackCinderShell(object):
|
||||
# Global arguments
|
||||
parser.add_argument('-h', '--help',
|
||||
action='store_true',
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
parser.add_argument('--debug',
|
||||
default=False,
|
||||
@@ -87,23 +86,28 @@ class OpenStackCinderShell(object):
|
||||
help="Print debugging output")
|
||||
|
||||
parser.add_argument('--os_username',
|
||||
default=utils.env('OS_USERNAME', 'CINDER_USERNAME'),
|
||||
default=utils.env('OS_USERNAME',
|
||||
'CINDER_USERNAME'),
|
||||
help='Defaults to env[OS_USERNAME].')
|
||||
|
||||
parser.add_argument('--os_password',
|
||||
default=utils.env('OS_PASSWORD', 'CINDER_PASSWORD'),
|
||||
default=utils.env('OS_PASSWORD',
|
||||
'CINDER_PASSWORD'),
|
||||
help='Defaults to env[OS_PASSWORD].')
|
||||
|
||||
parser.add_argument('--os_tenant_name',
|
||||
default=utils.env('OS_TENANT_NAME', 'CINDER_PROJECT_ID'),
|
||||
default=utils.env('OS_TENANT_NAME',
|
||||
'CINDER_PROJECT_ID'),
|
||||
help='Defaults to env[OS_TENANT_NAME].')
|
||||
|
||||
parser.add_argument('--os_auth_url',
|
||||
default=utils.env('OS_AUTH_URL', 'CINDER_URL'),
|
||||
default=utils.env('OS_AUTH_URL',
|
||||
'CINDER_URL'),
|
||||
help='Defaults to env[OS_AUTH_URL].')
|
||||
|
||||
parser.add_argument('--os_region_name',
|
||||
default=utils.env('OS_REGION_NAME', 'CINDER_REGION_NAME'),
|
||||
default=utils.env('OS_REGION_NAME',
|
||||
'CINDER_REGION_NAME'),
|
||||
help='Defaults to env[OS_REGION_NAME].')
|
||||
|
||||
parser.add_argument('--service_type',
|
||||
@@ -126,10 +130,12 @@ class OpenStackCinderShell(object):
|
||||
parser.add_argument('--os_volume_api_version',
|
||||
default=utils.env('OS_VOLUME_API_VERSION',
|
||||
default=DEFAULT_OS_VOLUME_API_VERSION),
|
||||
help='Accepts 1, defaults to env[OS_VOLUME_API_VERSION].')
|
||||
help='Accepts 1,defaults '
|
||||
'to env[OS_VOLUME_API_VERSION].')
|
||||
|
||||
parser.add_argument('--insecure',
|
||||
default=utils.env('CINDERCLIENT_INSECURE', default=False),
|
||||
default=utils.env('CINDERCLIENT_INSECURE',
|
||||
default=False),
|
||||
action='store_true',
|
||||
help=argparse.SUPPRESS)
|
||||
|
||||
@@ -222,10 +228,11 @@ class OpenStackCinderShell(object):
|
||||
yield name, module
|
||||
|
||||
def _add_bash_completion_subparser(self, subparsers):
|
||||
subparser = subparsers.add_parser('bash_completion',
|
||||
subparser = subparsers.add_parser(
|
||||
'bash_completion',
|
||||
add_help=False,
|
||||
formatter_class=OpenStackHelpFormatter
|
||||
)
|
||||
formatter_class=OpenStackHelpFormatter)
|
||||
|
||||
self.subcommands['bash_completion'] = subparser
|
||||
subparser.set_defaults(func=self.do_bash_completion)
|
||||
|
||||
@@ -238,16 +245,17 @@ class OpenStackCinderShell(object):
|
||||
help = desc.strip().split('\n')[0]
|
||||
arguments = getattr(callback, 'arguments', [])
|
||||
|
||||
subparser = subparsers.add_parser(command,
|
||||
subparser = subparsers.add_parser(
|
||||
command,
|
||||
help=help,
|
||||
description=desc,
|
||||
add_help=False,
|
||||
formatter_class=OpenStackHelpFormatter
|
||||
)
|
||||
formatter_class=OpenStackHelpFormatter)
|
||||
|
||||
subparser.add_argument('-h', '--help',
|
||||
action='help',
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
help=argparse.SUPPRESS,)
|
||||
|
||||
self.subcommands[command] = subparser
|
||||
for (args, kwargs) in arguments:
|
||||
subparser.add_argument(*args, **kwargs)
|
||||
@@ -320,7 +328,8 @@ class OpenStackCinderShell(object):
|
||||
if not utils.isunauthenticated(args.func):
|
||||
if not os_username:
|
||||
if not username:
|
||||
raise exc.CommandError("You must provide a username "
|
||||
raise exc.CommandError(
|
||||
"You must provide a username "
|
||||
"via either --os_username or env[OS_USERNAME]")
|
||||
else:
|
||||
os_username = username
|
||||
@@ -343,7 +352,8 @@ class OpenStackCinderShell(object):
|
||||
|
||||
if not os_auth_url:
|
||||
if not url:
|
||||
raise exc.CommandError("You must provide an auth url "
|
||||
raise exc.CommandError(
|
||||
"You must provide an auth url "
|
||||
"via either --os_auth_url or env[OS_AUTH_URL]")
|
||||
else:
|
||||
os_auth_url = url
|
||||
@@ -352,17 +362,21 @@ class OpenStackCinderShell(object):
|
||||
os_region_name = region_name
|
||||
|
||||
if not os_tenant_name:
|
||||
raise exc.CommandError("You must provide a tenant name "
|
||||
raise exc.CommandError(
|
||||
"You must provide a tenant name "
|
||||
"via either --os_tenant_name or env[OS_TENANT_NAME]")
|
||||
|
||||
if not os_auth_url:
|
||||
raise exc.CommandError("You must provide an auth url "
|
||||
raise exc.CommandError(
|
||||
"You must provide an auth url "
|
||||
"via either --os_auth_url or env[OS_AUTH_URL]")
|
||||
|
||||
self.cs = client.Client(options.os_volume_api_version, os_username,
|
||||
os_password, os_tenant_name, os_auth_url, insecure,
|
||||
region_name=os_region_name, endpoint_type=endpoint_type,
|
||||
extensions=self.extensions, service_type=service_type,
|
||||
os_password, os_tenant_name, os_auth_url,
|
||||
insecure, region_name=os_region_name,
|
||||
endpoint_type=endpoint_type,
|
||||
extensions=self.extensions,
|
||||
service_type=service_type,
|
||||
service_name=service_name,
|
||||
volume_service_name=volume_service_name)
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ class Client(object):
|
||||
setattr(self, extension.name,
|
||||
extension.manager_class(self))
|
||||
|
||||
self.client = client.HTTPClient(username,
|
||||
self.client = client.HTTPClient(
|
||||
username,
|
||||
password,
|
||||
project_id,
|
||||
auth_url,
|
||||
|
||||
@@ -115,7 +115,8 @@ def do_show(cs, args):
|
||||
metavar='<size>',
|
||||
type=int,
|
||||
help='Size of volume in GB')
|
||||
@utils.arg('--snapshot_id',
|
||||
@utils.arg(
|
||||
'--snapshot_id',
|
||||
metavar='<snapshot_id>',
|
||||
help='Optional snapshot id to create the volume from. (Default=None)',
|
||||
default=None)
|
||||
@@ -152,8 +153,8 @@ def do_snapshot_list(cs, args):
|
||||
"""List all the snapshots."""
|
||||
snapshots = cs.volume_snapshots.list()
|
||||
_translate_volume_snapshot_keys(snapshots)
|
||||
utils.print_list(snapshots, ['ID', 'Volume ID', 'Status', 'Display Name',
|
||||
'Size'])
|
||||
utils.print_list(snapshots,
|
||||
['ID', 'Volume ID', 'Status', 'Display Name', 'Size'])
|
||||
|
||||
|
||||
@utils.arg('snapshot', metavar='<snapshot>', help='ID of the snapshot.')
|
||||
@@ -169,7 +170,8 @@ def do_snapshot_show(cs, args):
|
||||
help='ID of the volume to snapshot')
|
||||
@utils.arg('--force',
|
||||
metavar='<True|False>',
|
||||
help='Optional flag to indicate whether to snapshot a volume even if its '
|
||||
help='Optional flag to indicate whether '
|
||||
'to snapshot a volume even if its '
|
||||
'attached to an instance. (Default=False)',
|
||||
default=False)
|
||||
@utils.arg('--display_name', metavar='<display_name>',
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# python-cinderclient documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Dec 6 14:19:25 2009.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its containing dir.
|
||||
# This file is execfile()d with current directory set to its containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
|
||||
@@ -27,11 +27,11 @@ class FakeClient(object):
|
||||
expected = (method, url)
|
||||
called = self.client.callstack[pos][0:2]
|
||||
|
||||
assert self.client.callstack, \
|
||||
"Expected %s %s but no calls were made." % expected
|
||||
assert(self.client.callstack,
|
||||
"Expected %s %s but no calls were made." % expected)
|
||||
|
||||
assert expected == called, 'Expected %s %s; got %s %s' % \
|
||||
(expected + called)
|
||||
assert (expected == called, 'Expected %s %s; got %s %s' %
|
||||
(expected + called))
|
||||
|
||||
if body is not None:
|
||||
assert self.client.callstack[pos][2] == body
|
||||
@@ -42,8 +42,8 @@ class FakeClient(object):
|
||||
"""
|
||||
expected = (method, url)
|
||||
|
||||
assert self.client.callstack, \
|
||||
"Expected %s %s but no calls were made." % expected
|
||||
assert(self.client.callstack,
|
||||
"Expected %s %s but no calls were made." % expected)
|
||||
|
||||
found = False
|
||||
for entry in self.client.callstack:
|
||||
@@ -51,8 +51,9 @@ class FakeClient(object):
|
||||
found = True
|
||||
break
|
||||
|
||||
assert found, 'Expected %s %s; got %s' % \
|
||||
(expected, self.client.callstack)
|
||||
assert(found, 'Expected %s %s; got %s' %
|
||||
(expected, self.client.callstack))
|
||||
|
||||
if body is not None:
|
||||
try:
|
||||
assert entry[2] == body
|
||||
|
||||
@@ -36,8 +36,7 @@ class ClientTest(utils.TestCase):
|
||||
headers = {"X-Auth-Token": "token",
|
||||
"X-Auth-Project-Id": "project_id",
|
||||
"User-Agent": cl.USER_AGENT,
|
||||
'Accept': 'application/json',
|
||||
}
|
||||
'Accept': 'application/json', }
|
||||
mock_request.assert_called_with("http://example.com/hi",
|
||||
"GET", headers=headers)
|
||||
# Automatic JSON parsing
|
||||
|
||||
@@ -120,10 +120,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
"maxServerMeta": 5,
|
||||
"maxImageMeta": 5,
|
||||
"maxPersonality": 5,
|
||||
"maxPersonalitySize": 10240
|
||||
},
|
||||
},
|
||||
})
|
||||
"maxPersonalitySize": 10240}, }, })
|
||||
|
||||
#
|
||||
# Servers
|
||||
@@ -141,8 +138,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {"volumes": [
|
||||
{'id': 1234,
|
||||
'name': 'sample-volume',
|
||||
'attachments': [{'server_id': 1234}]
|
||||
},
|
||||
'attachments': [{'server_id': 1234}]},
|
||||
]})
|
||||
|
||||
def get_volumes_1234(self, **kw):
|
||||
@@ -194,7 +190,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {'data': 'Fake diagnostics'})
|
||||
|
||||
def get_servers_1234_actions(self, **kw):
|
||||
return (200, {'actions': [
|
||||
return (
|
||||
200, {'actions': [
|
||||
{
|
||||
'action': 'rebuild',
|
||||
'error': None,
|
||||
@@ -588,8 +585,10 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
# Security Groups
|
||||
#
|
||||
def get_os_security_groups(self, **kw):
|
||||
return (200, {"security_groups": [
|
||||
{'id': 1, 'name': 'test', 'description': 'FAKE_SECURITY_GROUP'}
|
||||
return (200, {"security_groups":
|
||||
[
|
||||
{'id': 1, 'name': 'test',
|
||||
'description': 'FAKE_SECURITY_GROUP'}
|
||||
]})
|
||||
|
||||
def get_os_security_groups_1(self, **kw):
|
||||
|
||||
@@ -42,8 +42,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
}
|
||||
auth_response = httplib2.Response({
|
||||
"status": 200,
|
||||
"body": json.dumps(resp),
|
||||
})
|
||||
"body": json.dumps(resp), })
|
||||
|
||||
mock_request = mock.Mock(return_value=(auth_response,
|
||||
json.dumps(resp)))
|
||||
@@ -85,8 +84,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
resp = {"unauthorized": {"message": "Unauthorized", "code": "401"}}
|
||||
auth_response = httplib2.Response({
|
||||
"status": 401,
|
||||
"body": json.dumps(resp),
|
||||
})
|
||||
"body": json.dumps(resp), })
|
||||
|
||||
mock_request = mock.Mock(return_value=(auth_response,
|
||||
json.dumps(resp)))
|
||||
@@ -138,7 +136,7 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
"body": correct_response}
|
||||
]
|
||||
|
||||
responses = [(to_http_response(resp), resp['body']) \
|
||||
responses = [(to_http_response(resp), resp['body'])
|
||||
for resp in dict_responses]
|
||||
|
||||
def side_effect(*args, **kwargs):
|
||||
@@ -214,7 +212,8 @@ class AuthenticateAgainstKeystoneTests(utils.TestCase):
|
||||
],
|
||||
},
|
||||
}
|
||||
auth_response = httplib2.Response({
|
||||
auth_response = httplib2.Response(
|
||||
{
|
||||
"status": 200,
|
||||
"body": json.dumps(resp),
|
||||
})
|
||||
|
||||
@@ -207,8 +207,8 @@ def print_help():
|
||||
python-cinderclient development uses virtualenv to track and manage Python
|
||||
dependencies while in development and testing.
|
||||
|
||||
To activate the python-cinderclient virtualenv for the extent of your current
|
||||
shell session you can run:
|
||||
To activate the python-cinderclient virtualenv for the extent of your
|
||||
current shell session you can run:
|
||||
|
||||
$ source .venv/bin/activate
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
|
||||
distribute>=0.6.24
|
||||
|
||||
mock
|
||||
nose
|
||||
nosexcover
|
||||
openstack.nose_plugin
|
||||
pep8>=1.0
|
||||
pep8==1.1
|
||||
sphinx>=1.1.2
|
||||
unittest2
|
||||
|
||||
Reference in New Issue
Block a user