Enable check for E127
E127 continuation line over-indented for visual indent Change-Id: I9dfd489565ee2d1469b2048a930c3a8384dd245d
This commit is contained in:
parent
8de2237cc4
commit
ae6c39397e
@ -765,7 +765,10 @@ class OpenStackComputeShell(object):
|
||||
commands.remove('bash_completion')
|
||||
print(' '.join(commands | options))
|
||||
|
||||
@utils.arg('command', metavar='<subcommand>', nargs='?',
|
||||
@utils.arg(
|
||||
'command',
|
||||
metavar='<subcommand>',
|
||||
nargs='?',
|
||||
help='Display help for <subcommand>')
|
||||
def do_help(self, args):
|
||||
"""
|
||||
|
@ -45,8 +45,8 @@ class FakeClient(object):
|
||||
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:
|
||||
if self.client.callstack[pos][2] != body:
|
||||
@ -68,8 +68,7 @@ class FakeClient(object):
|
||||
found = True
|
||||
break
|
||||
|
||||
assert found, 'Expected %s; got %s' % \
|
||||
(expected, self.client.callstack)
|
||||
assert found, 'Expected %s; got %s' % (expected, self.client.callstack)
|
||||
if body is not None:
|
||||
try:
|
||||
assert entry[2] == body
|
||||
|
@ -57,9 +57,8 @@ class ClientTest(utils.TestCase):
|
||||
}
|
||||
with mock.patch('requests.request', mock_request):
|
||||
instance.authenticate()
|
||||
requests.request.assert_called_with(mock.ANY, mock.ANY,
|
||||
timeout=2,
|
||||
headers=mock.ANY,
|
||||
requests.request.assert_called_with(
|
||||
mock.ANY, mock.ANY, timeout=2, headers=mock.ANY,
|
||||
verify=mock.ANY)
|
||||
|
||||
def test_client_reauth(self):
|
||||
@ -220,10 +219,8 @@ class ClientTest(utils.TestCase):
|
||||
fake_attribute_name1 = "FakeAttribute1"
|
||||
fake_attribute_name2 = "FakeAttribute2"
|
||||
extensions = [
|
||||
novaclient.extension.Extension(fake_attribute_name1,
|
||||
fakes),
|
||||
novaclient.extension.Extension(fake_attribute_name2,
|
||||
utils),
|
||||
novaclient.extension.Extension(fake_attribute_name1, fakes),
|
||||
novaclient.extension.Extension(fake_attribute_name2, utils),
|
||||
]
|
||||
|
||||
cs = novaclient.v3.client.Client("user", "password", "project_id",
|
||||
|
@ -895,14 +895,13 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
|
||||
def get_os_floating_ip_dns_testdomain_entries(self, **kw):
|
||||
if kw.get('ip'):
|
||||
return (205, {}, {'dns_entries':
|
||||
[{'dns_entry':
|
||||
{'ip': kw.get('ip'),
|
||||
return (205, {}, {
|
||||
'dns_entries': [
|
||||
{'dns_entry': {'ip': kw.get('ip'),
|
||||
'name': "host1",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}},
|
||||
{'dns_entry':
|
||||
{'ip': kw.get('ip'),
|
||||
{'dns_entry': {'ip': kw.get('ip'),
|
||||
'name': "host2",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}}]})
|
||||
@ -910,8 +909,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (404, {}, None)
|
||||
|
||||
def get_os_floating_ip_dns_testdomain_entries_testname(self, **kw):
|
||||
return (205, {}, {'dns_entry':
|
||||
{'ip': "10.10.10.10",
|
||||
return (205, {}, {
|
||||
'dns_entry': {'ip': "10.10.10.10",
|
||||
'name': 'testname',
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}})
|
||||
@ -1271,8 +1270,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
return (200, {}, {"security_groups": [
|
||||
{"name": "test",
|
||||
"description": "FAKE_SECURITY_GROUP",
|
||||
"tenant_id":
|
||||
"4ffc664c198e435e9853f2538fbcd7a7",
|
||||
"tenant_id": "4ffc664c198e435e9853f2538fbcd7a7",
|
||||
"id": 1,
|
||||
"rules": [
|
||||
{"id": 11,
|
||||
@ -1363,7 +1361,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
|
||||
def post_os_security_group_rules(self, body, **kw):
|
||||
assert list(body) == ['security_group_rule']
|
||||
fakes.assert_has_keys(body['security_group_rule'],
|
||||
fakes.assert_has_keys(
|
||||
body['security_group_rule'],
|
||||
required=['parent_group_id'],
|
||||
optional=['group_id', 'ip_protocol', 'from_port',
|
||||
'to_port', 'cidr'])
|
||||
@ -2160,12 +2159,10 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
def post_os_server_groups(self, body, **kw):
|
||||
return self._return_server_group()
|
||||
|
||||
def get_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self,
|
||||
**kw):
|
||||
def get_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self, **kw):
|
||||
return self._return_server_group()
|
||||
|
||||
def put_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self,
|
||||
**kw):
|
||||
def put_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b(self, **kw):
|
||||
return self._return_server_group()
|
||||
|
||||
def post_os_server_groups_2cbd51f4_fafe_4cdb_801b_cf913a6f288b_action(
|
||||
|
@ -28,5 +28,5 @@ class TestFloatingIPPools(utils.FixturedTestCase):
|
||||
def test_list_floating_ips(self):
|
||||
fl = self.cs.floating_ip_pools.list()
|
||||
self.assert_called('GET', '/os-floating-ip-pools')
|
||||
[self.assertIsInstance(f, floating_ip_pools.FloatingIPPool)
|
||||
for f in fl]
|
||||
for f in fl:
|
||||
self.assertIsInstance(f, floating_ip_pools.FloatingIPPool)
|
||||
|
@ -46,8 +46,8 @@ class FloatingIPsBulkTest(utils.FixturedTestCase):
|
||||
def test_create_floating_ips_bulk_with_pool_and_host(self):
|
||||
fl = self.cs.floating_ips_bulk.create('192.168.1.0/30', 'poolTest',
|
||||
'interfaceTest')
|
||||
body = {'floating_ips_bulk_create':
|
||||
{'ip_range': '192.168.1.0/30', 'pool': 'poolTest',
|
||||
body = {'floating_ips_bulk_create': {
|
||||
'ip_range': '192.168.1.0/30', 'pool': 'poolTest',
|
||||
'interface': 'interfaceTest'}}
|
||||
self.assert_called('POST', '/os-floating-ips-bulk', body)
|
||||
self.assertEqual(fl.ip_range,
|
||||
|
@ -800,8 +800,8 @@ class ShellTest(utils.TestCase):
|
||||
)
|
||||
|
||||
def test_create_image_show(self):
|
||||
output = self.run_command('image-create '
|
||||
'sample-server mysnapshot --show')
|
||||
output = self.run_command(
|
||||
'image-create sample-server mysnapshot --show')
|
||||
self.assert_called_anytime(
|
||||
'POST', '/servers/1234/action',
|
||||
{'createImage': {'name': 'mysnapshot', 'metadata': {}}},
|
||||
@ -2243,10 +2243,8 @@ class ShellTest(utils.TestCase):
|
||||
mock.mock_open(read_data='FAKE_PUBLIC_KEY'))
|
||||
def test_keypair_import(self):
|
||||
self.run_command('keypair-add --pub-key test.pub test')
|
||||
self.assert_called('POST', '/os-keypairs',
|
||||
{'keypair':
|
||||
{'public_key': 'FAKE_PUBLIC_KEY',
|
||||
'name': 'test'}})
|
||||
self.assert_called('POST', '/os-keypairs', {
|
||||
'keypair': {'public_key': 'FAKE_PUBLIC_KEY', 'name': 'test'}})
|
||||
|
||||
def test_keypair_list(self):
|
||||
self.run_command('keypair-list')
|
||||
@ -2263,8 +2261,7 @@ class ShellTest(utils.TestCase):
|
||||
def test_create_server_group(self):
|
||||
self.run_command('server-group-create wjsg affinity')
|
||||
self.assert_called('POST', '/os-server-groups',
|
||||
{'server_group':
|
||||
{'name': 'wjsg',
|
||||
{'server_group': {'name': 'wjsg',
|
||||
'policies': ['affinity']}})
|
||||
|
||||
def test_delete_multi_server_groups(self):
|
||||
|
@ -56,8 +56,7 @@ class FloatingIPDNSDomainManager(base.Manager):
|
||||
|
||||
def create_private(self, fqdomain, availability_zone):
|
||||
"""Add or modify a private DNS domain."""
|
||||
body = {'domain_entry':
|
||||
{'scope': 'private',
|
||||
body = {'domain_entry': {'scope': 'private',
|
||||
'availability_zone': availability_zone}}
|
||||
return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
|
||||
body,
|
||||
@ -65,13 +64,10 @@ class FloatingIPDNSDomainManager(base.Manager):
|
||||
|
||||
def create_public(self, fqdomain, project):
|
||||
"""Add or modify a public DNS domain."""
|
||||
body = {'domain_entry':
|
||||
{'scope': 'public',
|
||||
'project': project}}
|
||||
body = {'domain_entry': {'scope': 'public', 'project': project}}
|
||||
|
||||
return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
|
||||
body,
|
||||
'domain_entry')
|
||||
body, 'domain_entry')
|
||||
|
||||
def delete(self, fqdomain):
|
||||
"""Delete the specified domain."""
|
||||
@ -83,8 +79,7 @@ class FloatingIPDNSEntry(base.Resource):
|
||||
self.manager.delete(self.name, self.domain)
|
||||
|
||||
def create(self):
|
||||
self.manager.create(self.domain, self.name,
|
||||
self.ip, self.dns_type)
|
||||
self.manager.create(self.domain, self.name, self.ip, self.dns_type)
|
||||
|
||||
def get(self):
|
||||
return self.manager.get(self.domain, self.name)
|
||||
@ -96,8 +91,7 @@ class FloatingIPDNSEntryManager(base.Manager):
|
||||
def get(self, domain, name):
|
||||
"""Return a list of entries for the given domain and ip or name."""
|
||||
return self._get("/os-floating-ip-dns/%s/entries/%s" %
|
||||
(_quote_domain(domain), name),
|
||||
"dns_entry")
|
||||
(_quote_domain(domain), name), "dns_entry")
|
||||
|
||||
def get_for_ip(self, domain, ip):
|
||||
"""Return a list of entries for the given domain and ip or name."""
|
||||
@ -105,30 +99,21 @@ class FloatingIPDNSEntryManager(base.Manager):
|
||||
params = "?%s" % parse.urlencode(qparams)
|
||||
|
||||
return self._list("/os-floating-ip-dns/%s/entries%s" %
|
||||
(_quote_domain(domain), params),
|
||||
"dns_entries")
|
||||
(_quote_domain(domain), params), "dns_entries")
|
||||
|
||||
def create(self, domain, name, ip, dns_type):
|
||||
"""Add a new DNS entry."""
|
||||
body = {'dns_entry':
|
||||
{'ip': ip,
|
||||
'dns_type': dns_type}}
|
||||
body = {'dns_entry': {'ip': ip, 'dns_type': dns_type}}
|
||||
|
||||
return self._update("/os-floating-ip-dns/%s/entries/%s" %
|
||||
(_quote_domain(domain), name),
|
||||
body,
|
||||
"dns_entry")
|
||||
(_quote_domain(domain), name), body, "dns_entry")
|
||||
|
||||
def modify_ip(self, domain, name, ip):
|
||||
"""Add a new DNS entry."""
|
||||
body = {'dns_entry':
|
||||
{'ip': ip,
|
||||
'dns_type': 'A'}}
|
||||
body = {'dns_entry': {'ip': ip, 'dns_type': 'A'}}
|
||||
|
||||
return self._update("/os-floating-ip-dns/%s/entries/%s" %
|
||||
(_quote_domain(domain), name),
|
||||
body,
|
||||
"dns_entry")
|
||||
(_quote_domain(domain), name), body, "dns_entry")
|
||||
|
||||
def delete(self, domain, name):
|
||||
"""Delete entry specified by name and domain."""
|
||||
|
@ -87,8 +87,8 @@ class ImageManager(base.ManagerWithFind):
|
||||
:param metadata: A dict of metadata to add to the image
|
||||
"""
|
||||
body = {'metadata': metadata}
|
||||
return self._create("/images/%s/metadata" % base.getid(image), body,
|
||||
"metadata")
|
||||
return self._create("/images/%s/metadata" % base.getid(image),
|
||||
body, "metadata")
|
||||
|
||||
def delete_meta(self, image, keys):
|
||||
"""
|
||||
|
@ -2367,8 +2367,8 @@ def _print_secgroups(secgroups):
|
||||
|
||||
def _get_secgroup(cs, secgroup):
|
||||
# Check secgroup is an ID (nova-network) or UUID (neutron)
|
||||
if (utils.is_integer_like(encodeutils.safe_encode(secgroup))
|
||||
or uuidutils.is_uuid_like(secgroup)):
|
||||
if (utils.is_integer_like(encodeutils.safe_encode(secgroup)) or
|
||||
uuidutils.is_uuid_like(secgroup)):
|
||||
try:
|
||||
return cs.security_groups.get(secgroup)
|
||||
except exceptions.NotFound:
|
||||
@ -2377,9 +2377,8 @@ def _get_secgroup(cs, secgroup):
|
||||
# Check secgroup as a name
|
||||
match_found = False
|
||||
for s in cs.security_groups.list():
|
||||
encoding = (locale.getpreferredencoding() or
|
||||
sys.stdin.encoding or
|
||||
'UTF-8')
|
||||
encoding = (
|
||||
locale.getpreferredencoding() or sys.stdin.encoding or 'UTF-8')
|
||||
if not six.PY3:
|
||||
s.name = s.name.encode(encoding)
|
||||
if secgroup == s.name:
|
||||
@ -3379,8 +3378,8 @@ def do_ssh(cs, args):
|
||||
match = lambda addr: all((
|
||||
addr.get('version') == version,
|
||||
addr.get('OS-EXT-IPS:type', 'floating') == address_type))
|
||||
matching_addresses = [address.get('addr') for address in network_addresses
|
||||
if match(address)]
|
||||
matching_addresses = [address.get('addr')
|
||||
for address in network_addresses if match(address)]
|
||||
if not any(matching_addresses):
|
||||
msg = _("No address that would match network '%(network)s'"
|
||||
" and type '%(address_type)s' of version %(pretty_version)s "
|
||||
@ -3568,8 +3567,8 @@ def do_quota_defaults(cs, args):
|
||||
dest='force',
|
||||
action="store_true",
|
||||
default=None,
|
||||
help=_('Whether force update the quota even if the already used'
|
||||
' and reserved exceeds the new quota'))
|
||||
help=_('Whether force update the quota even if the already used and '
|
||||
'reserved exceeds the new quota'))
|
||||
def do_quota_update(cs, args):
|
||||
"""Update the quotas for a tenant/user."""
|
||||
|
||||
|
@ -42,8 +42,8 @@ class SnapshotManager(base.ManagerWithFind):
|
||||
"""
|
||||
resource_class = Snapshot
|
||||
|
||||
def create(self, volume_id, force=False,
|
||||
display_name=None, display_description=None):
|
||||
def create(self, volume_id, force=False, display_name=None,
|
||||
display_description=None):
|
||||
|
||||
"""
|
||||
Create a snapshot of the given volume.
|
||||
|
@ -45,10 +45,9 @@ class VolumeManager(base.ManagerWithFind):
|
||||
"""
|
||||
resource_class = Volume
|
||||
|
||||
def create(self, size, snapshot_id=None,
|
||||
display_name=None, display_description=None,
|
||||
volume_type=None, availability_zone=None,
|
||||
imageRef=None):
|
||||
def create(self, size, snapshot_id=None, display_name=None,
|
||||
display_description=None, volume_type=None,
|
||||
availability_zone=None, imageRef=None):
|
||||
"""
|
||||
Create a volume.
|
||||
|
||||
|
@ -893,8 +893,8 @@ class ServerManager(base.BootingManagerWithFind):
|
||||
:param metadata: A dict of metadata to add to the server
|
||||
"""
|
||||
body = {'metadata': metadata}
|
||||
return self._create("/servers/%s/metadata" % base.getid(server),
|
||||
body, "metadata")
|
||||
return self._create(
|
||||
"/servers/%s/metadata" % base.getid(server), body, "metadata")
|
||||
|
||||
def get_console_output(self, server, length=None):
|
||||
"""
|
||||
|
@ -94,8 +94,8 @@ def _boot(cs, args):
|
||||
max_count = args.num_instances
|
||||
elif (args.num_instances is not None and
|
||||
(args.min_count is not None or args.max_count is not None)):
|
||||
raise exceptions.CommandError("Don't mix num-instances and "
|
||||
"max/min-count")
|
||||
raise exceptions.CommandError(
|
||||
"Don't mix num-instances and max/min-count")
|
||||
if args.min_count is not None:
|
||||
if args.min_count < 1:
|
||||
raise exceptions.CommandError("min_count should be >= 1")
|
||||
@ -1945,8 +1945,8 @@ def do_secgroup_add_group_rule(cs, args):
|
||||
|
||||
if args.ip_proto or args.from_port or args.to_port:
|
||||
if not (args.ip_proto and args.from_port and args.to_port):
|
||||
raise exceptions.CommandError("ip_proto, from_port, and to_port"
|
||||
" must be specified together")
|
||||
raise exceptions.CommandError(
|
||||
"ip_proto, from_port, and to_port must be specified together")
|
||||
params['ip_protocol'] = args.ip_proto.upper()
|
||||
params['from_port'] = args.from_port
|
||||
params['to_port'] = args.to_port
|
||||
@ -1979,8 +1979,8 @@ def do_secgroup_delete_group_rule(cs, args):
|
||||
|
||||
if args.ip_proto or args.from_port or args.to_port:
|
||||
if not (args.ip_proto and args.from_port and args.to_port):
|
||||
raise exceptions.CommandError("ip_proto, from_port, and to_port"
|
||||
" must be specified together")
|
||||
raise exceptions.CommandError(
|
||||
"ip_proto, from_port, and to_port must be specified together")
|
||||
params['ip_protocol'] = args.ip_proto.upper()
|
||||
params['from_port'] = int(args.from_port)
|
||||
params['to_port'] = int(args.to_port)
|
||||
@ -2013,8 +2013,8 @@ def do_keypair_add(cs, args):
|
||||
with open(os.path.expanduser(pub_key)) as f:
|
||||
pub_key = f.read()
|
||||
except IOError as e:
|
||||
raise exceptions.CommandError("Can't open or read '%s': %s" %
|
||||
(pub_key, e))
|
||||
raise exceptions.CommandError(
|
||||
"Can't open or read '%s': %s" % (pub_key, e))
|
||||
|
||||
keypair = cs.keypairs.create(name, pub_key)
|
||||
|
||||
@ -2822,8 +2822,8 @@ def do_ssh(cs, args):
|
||||
match = lambda addr: all((
|
||||
addr.get('version') == version,
|
||||
addr.get('OS-EXT-IPS:type', 'floating') == address_type))
|
||||
matching_addresses = [address.get('addr') for address in network_addresses
|
||||
if match(address)]
|
||||
matching_addresses = [address.get('addr')
|
||||
for address in network_addresses if match(address)]
|
||||
if not any(matching_addresses):
|
||||
msg = _("No address that would match network '%(network)s'"
|
||||
" and type '%(address_type)s' of version %(pretty_version)s "
|
||||
@ -2980,8 +2980,8 @@ def do_quota_defaults(cs, args):
|
||||
dest='force',
|
||||
action="store_true",
|
||||
default=None,
|
||||
help='Whether force update the quota even if the already used'
|
||||
' and reserved exceeds the new quota')
|
||||
help='Whether force update the quota even if the already used and '
|
||||
'reserved exceeds the new quota')
|
||||
def do_quota_update(cs, args):
|
||||
"""Update the quotas for a tenant."""
|
||||
|
||||
|
2
tox.ini
2
tox.ini
@ -42,7 +42,7 @@ downloadcache = ~/cache/pip
|
||||
# reason: removed in hacking (https://review.openstack.org/#/c/101701/)
|
||||
#
|
||||
# Additional checks are also ignored on purpose: F811, F821
|
||||
ignore = E124,E127,E128,E129,F811,F821,H402,H404,H405,H904
|
||||
ignore = E124,E128,E129,F811,F821,H402,H404,H405,H904
|
||||
show-source = True
|
||||
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build,doc/source/conf.py
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user