diff --git a/cinderclient/shell.py b/cinderclient/shell.py index 04dfe71..5e8ccfb 100644 --- a/cinderclient/shell.py +++ b/cinderclient/shell.py @@ -160,8 +160,9 @@ class OpenStackCinderShell(object): parser.add_argument('--endpoint-type', metavar='', - default=utils.env('CINDER_ENDPOINT_TYPE', - default=DEFAULT_CINDER_ENDPOINT_TYPE), + default=utils.env( + 'CINDER_ENDPOINT_TYPE', + default=DEFAULT_CINDER_ENDPOINT_TYPE), help='Endpoint type, which is publicURL or ' 'internalURL. ' 'Default=nova env[CINDER_ENDPOINT_TYPE] or ' diff --git a/cinderclient/tests/v1/fakes.py b/cinderclient/tests/v1/fakes.py index f191b4a..fe9a71f 100644 --- a/cinderclient/tests/v1/fakes.py +++ b/cinderclient/tests/v1/fakes.py @@ -448,19 +448,22 @@ class FakeHTTPClient(base_client.HTTPClient): 'extra_specs': {}}]}) def get_types_1(self, **kw): - return (200, {}, {'volume_type': {'id': 1, - 'name': 'test-type-1', - 'extra_specs': {}}}) + return (200, {}, { + 'volume_type': {'id': 1, + 'name': 'test-type-1', + 'extra_specs': {}}}) def get_types_2(self, **kw): - return (200, {}, {'volume_type': {'id': 2, - 'name': 'test-type-2', - 'extra_specs': {}}}) + return (200, {}, { + 'volume_type': {'id': 2, + 'name': 'test-type-2', + 'extra_specs': {}}}) def post_types(self, body, **kw): - return (202, {}, {'volume_type': {'id': 3, - 'name': 'test-type-3', - 'extra_specs': {}}}) + return (202, {}, { + 'volume_type': {'id': 3, + 'name': 'test-type-3', + 'extra_specs': {}}}) def post_types_1_extra_specs(self, body, **kw): assert list(body) == ['extra_specs'] @@ -721,8 +724,8 @@ class FakeHTTPClient(base_client.HTTPClient): def put_os_services_disable_log_reason(self, body, **kw): return (200, {}, {'host': body['host'], 'binary': body['binary'], - 'status': 'disabled', - 'disabled_reason': body['disabled_reason']}) + 'status': 'disabled', + 'disabled_reason': body['disabled_reason']}) def get_os_availability_zone(self, **kw): return (200, {}, { @@ -737,7 +740,7 @@ class FakeHTTPClient(base_client.HTTPClient): "zoneState": {"available": False}, "hosts": None, }, - ] + ] }) def get_os_availability_zone_detail(self, **kw): @@ -776,7 +779,7 @@ class FakeHTTPClient(base_client.HTTPClient): "zoneState": {"available": False}, "hosts": None, }, - ] + ] }) def post_snapshots_1234_metadata(self, **kw): diff --git a/cinderclient/tests/v1/test_shell.py b/cinderclient/tests/v1/test_shell.py index fb42328..b4e3e4a 100644 --- a/cinderclient/tests/v1/test_shell.py +++ b/cinderclient/tests/v1/test_shell.py @@ -79,7 +79,7 @@ class ShellTest(utils.TestCase): def test_extract_metadata(self): # mimic the result of argparse's parse_args() method - class Arguments: + class Arguments(object): def __init__(self, metadata=[]): self.metadata = metadata @@ -102,8 +102,8 @@ class ShellTest(utils.TestCase): v = cs.volumes.list()[0] setattr(v, 'os-vol-tenant-attr:tenant_id', 'fake_tenant') setattr(v, '_info', {'attachments': [{'server_id': 1234}], - 'id': 1234, 'name': 'sample-volume', - 'os-vol-tenant-attr:tenant_id': 'fake_tenant'}) + 'id': 1234, 'name': 'sample-volume', + 'os-vol-tenant-attr:tenant_id': 'fake_tenant'}) shell_v1._translate_volume_keys([v]) self.assertEqual(v.tenant_id, 'fake_tenant') diff --git a/cinderclient/tests/v2/fakes.py b/cinderclient/tests/v2/fakes.py index dbb50f2..3a6af5f 100644 --- a/cinderclient/tests/v2/fakes.py +++ b/cinderclient/tests/v2/fakes.py @@ -530,19 +530,22 @@ class FakeHTTPClient(base_client.HTTPClient): 'extra_specs': {}}]}) def get_types_1(self, **kw): - return (200, {}, {'volume_type': {'id': 1, - 'name': 'test-type-1', - 'extra_specs': {}}}) + return (200, {}, { + 'volume_type': {'id': 1, + 'name': 'test-type-1', + 'extra_specs': {}}}) def get_types_2(self, **kw): - return (200, {}, {'volume_type': {'id': 2, - 'name': 'test-type-2', - 'extra_specs': {}}}) + return (200, {}, { + 'volume_type': {'id': 2, + 'name': 'test-type-2', + 'extra_specs': {}}}) def post_types(self, body, **kw): - return (202, {}, {'volume_type': {'id': 3, - 'name': 'test-type-3', - 'extra_specs': {}}}) + return (202, {}, { + 'volume_type': {'id': 3, + 'name': 'test-type-3', + 'extra_specs': {}}}) def post_types_1_extra_specs(self, body, **kw): assert list(body) == ['extra_specs'] @@ -825,8 +828,8 @@ class FakeHTTPClient(base_client.HTTPClient): def put_os_services_disable_log_reason(self, body, **kw): return (200, {}, {'host': body['host'], 'binary': body['binary'], - 'status': 'disabled', - 'disabled_reason': body['disabled_reason']}) + 'status': 'disabled', + 'disabled_reason': body['disabled_reason']}) def get_os_availability_zone(self, **kw): return (200, {}, { @@ -841,7 +844,7 @@ class FakeHTTPClient(base_client.HTTPClient): "zoneState": {"available": False}, "hosts": None, }, - ] + ] }) def get_os_availability_zone_detail(self, **kw): @@ -880,7 +883,7 @@ class FakeHTTPClient(base_client.HTTPClient): "zoneState": {"available": False}, "hosts": None, }, - ] + ] }) def post_snapshots_1234_metadata(self, **kw): diff --git a/cinderclient/v1/volume_types.py b/cinderclient/v1/volume_types.py index 7e1a779..1539de2 100644 --- a/cinderclient/v1/volume_types.py +++ b/cinderclient/v1/volume_types.py @@ -68,8 +68,7 @@ class VolumeType(base.Resource): resp = None for k in keys: resp = self.manager._delete( - "/types/%s/extra_specs/%s" % ( - base.getid(self), k)) + "/types/%s/extra_specs/%s" % (base.getid(self), k)) if resp is not None: return resp diff --git a/cinderclient/v1/volumes.py b/cinderclient/v1/volumes.py index 37a4b88..d93fdf2 100644 --- a/cinderclient/v1/volumes.py +++ b/cinderclient/v1/volumes.py @@ -361,9 +361,9 @@ class VolumeManager(base.ManagerWithFind): return self._action('os-volume_upload_image', volume, {'force': force, - 'image_name': image_name, - 'container_format': container_format, - 'disk_format': disk_format}) + 'image_name': image_name, + 'container_format': container_format, + 'disk_format': disk_format}) def force_delete(self, volume): return self._action('os-force_delete', base.getid(volume)) diff --git a/cinderclient/v2/shell.py b/cinderclient/v2/shell.py index 41972a1..7da8efd 100644 --- a/cinderclient/v2/shell.py +++ b/cinderclient/v2/shell.py @@ -331,7 +331,7 @@ def do_create(cs, args): if args.metadata is not None: volume_metadata = _extract_metadata(args) - #NOTE(N.S.): take this piece from novaclient + # NOTE(N.S.): take this piece from novaclient hints = {} if args.scheduler_hints: for hint in args.scheduler_hints: @@ -344,7 +344,7 @@ def do_create(cs, args): hints[key] += [value] else: hints[key] = value - #NOTE(N.S.): end of taken piece + # NOTE(N.S.): end of taken piece volume = cs.volumes.create(args.size, args.consisgroup_id, @@ -649,9 +649,8 @@ def do_snapshot_rename(cs, args): @utils.arg('--state', metavar='', default='available', help=('The state to assign to the snapshot. Valid values are ' - '"available," "error," "creating," "deleting," and ' - '"error_deleting." ' - 'Default is "available."')) + '"available," "error," "creating," "deleting," and ' + '"error_deleting." Default is "available."')) @utils.service_type('volumev2') def do_snapshot_reset_state(cs, args): """Explicitly updates the snapshot state.""" diff --git a/cinderclient/v2/volume_types.py b/cinderclient/v2/volume_types.py index dc2ec5b..2e4001b 100644 --- a/cinderclient/v2/volume_types.py +++ b/cinderclient/v2/volume_types.py @@ -60,8 +60,7 @@ class VolumeType(base.Resource): # and return if there's an error for k in keys: resp = self.manager._delete( - "/types/%s/extra_specs/%s" % ( - base.getid(self), k)) + "/types/%s/extra_specs/%s" % (base.getid(self), k)) if resp is not None: return resp diff --git a/cinderclient/v2/volumes.py b/cinderclient/v2/volumes.py index ae8ed29..aff8c27 100644 --- a/cinderclient/v2/volumes.py +++ b/cinderclient/v2/volumes.py @@ -411,9 +411,9 @@ class VolumeManager(base.ManagerWithFind): return self._action('os-volume_upload_image', volume, {'force': force, - 'image_name': image_name, - 'container_format': container_format, - 'disk_format': disk_format}) + 'image_name': image_name, + 'container_format': container_format, + 'disk_format': disk_format}) def force_delete(self, volume): return self._action('os-force_delete', base.getid(volume)) diff --git a/test-requirements.txt b/test-requirements.txt index fd514fe..0d73af9 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -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 already pins down pep8, pyflakes and flake8 -hacking<0.9,>=0.8.0 +hacking>=0.10.0,<0.11 coverage>=3.6 discover fixtures>=0.3.14 diff --git a/tox.ini b/tox.ini index 510cfb5..d31c3aa 100644 --- a/tox.ini +++ b/tox.ini @@ -31,5 +31,5 @@ downloadcache = ~/cache/pip [flake8] show-source = True -ignore = F811,F821,H302,H306,H404 +ignore = F811,F821,H302,H306,H404,H405 exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,tools