Enable check for E127
E127 continuation line over-indented for visual indent Change-Id: I9dfd489565ee2d1469b2048a930c3a8384dd245d
This commit is contained in:
parent
8de2237cc4
commit
ae6c39397e
@ -32,8 +32,8 @@ class ServiceCatalog(object):
|
||||
return self.catalog['access']['token']['tenant']['id']
|
||||
|
||||
def url_for(self, attr=None, filter_value=None,
|
||||
service_type=None, endpoint_type='publicURL',
|
||||
service_name=None, volume_service_name=None):
|
||||
service_type=None, endpoint_type='publicURL',
|
||||
service_name=None, volume_service_name=None):
|
||||
"""Fetch the public URL from the Compute service for
|
||||
a particular endpoint attribute. If none given, return
|
||||
the first. See tests for sample service catalog.
|
||||
|
@ -765,8 +765,11 @@ class OpenStackComputeShell(object):
|
||||
commands.remove('bash_completion')
|
||||
print(' '.join(commands | options))
|
||||
|
||||
@utils.arg('command', metavar='<subcommand>', nargs='?',
|
||||
help='Display help for <subcommand>')
|
||||
@utils.arg(
|
||||
'command',
|
||||
metavar='<subcommand>',
|
||||
nargs='?',
|
||||
help='Display help for <subcommand>')
|
||||
def do_help(self, args):
|
||||
"""
|
||||
Display help about this program or one of its subcommands.
|
||||
|
@ -43,10 +43,10 @@ class FakeClient(object):
|
||||
called = self.client.callstack[pos][0:2]
|
||||
|
||||
assert self.client.callstack, \
|
||||
"Expected %s %s but no calls were made." % expected
|
||||
"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:
|
||||
@ -60,7 +60,7 @@ class FakeClient(object):
|
||||
expected = (method, url)
|
||||
|
||||
assert self.client.callstack, \
|
||||
"Expected %s %s but no calls were made." % expected
|
||||
"Expected %s %s but no calls were made." % expected
|
||||
|
||||
found = False
|
||||
for entry in self.client.callstack:
|
||||
@ -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
|
||||
|
@ -614,8 +614,8 @@ class V3(Base):
|
||||
context.headers['location'] = "http://blah/images/456"
|
||||
|
||||
if action not in set.union(set(body_is_none_list),
|
||||
set(body_params_check_exact.keys()),
|
||||
set(body_param_check_exists.keys())):
|
||||
set(body_params_check_exact.keys()),
|
||||
set(body_param_check_exists.keys())):
|
||||
raise AssertionError("Unexpected server action: %s" % action)
|
||||
|
||||
return _body
|
||||
|
@ -57,10 +57,9 @@ 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,
|
||||
verify=mock.ANY)
|
||||
requests.request.assert_called_with(
|
||||
mock.ANY, mock.ANY, timeout=2, headers=mock.ANY,
|
||||
verify=mock.ANY)
|
||||
|
||||
def test_client_reauth(self):
|
||||
instance = novaclient.client.HTTPClient(user='user',
|
||||
@ -208,7 +207,7 @@ class ClientTest(utils.TestCase):
|
||||
|
||||
def test_client_get_reset_timings_v3(self):
|
||||
cs = novaclient.v3.client.Client("user", "password", "project_id",
|
||||
auth_url="foo/v2")
|
||||
auth_url="foo/v2")
|
||||
self.assertEqual(0, len(cs.get_timings()))
|
||||
cs.client.times.append("somevalue")
|
||||
self.assertEqual(["somevalue"], cs.get_timings())
|
||||
@ -220,15 +219,13 @@ 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",
|
||||
auth_url="foo/v2",
|
||||
extensions=extensions)
|
||||
auth_url="foo/v2",
|
||||
extensions=extensions)
|
||||
self.assertIsInstance(getattr(cs, fake_attribute_name1, None),
|
||||
fakes.FakeManager)
|
||||
self.assertFalse(hasattr(cs, fake_attribute_name2))
|
||||
@ -236,7 +233,7 @@ class ClientTest(utils.TestCase):
|
||||
@mock.patch.object(novaclient.client.HTTPClient, 'authenticate')
|
||||
def test_authenticate_call_v3(self, mock_authenticate):
|
||||
cs = novaclient.v3.client.Client("user", "password", "project_id",
|
||||
auth_url="foo/v2")
|
||||
auth_url="foo/v2")
|
||||
cs.authenticate()
|
||||
self.assertTrue(mock_authenticate.called)
|
||||
|
||||
@ -245,7 +242,7 @@ class ClientTest(utils.TestCase):
|
||||
fake_client = mock.Mock()
|
||||
mock_http_client.return_value = fake_client
|
||||
with novaclient.v1_1.client.Client("user", "password", "project_id",
|
||||
auth_url="foo/v2"):
|
||||
auth_url="foo/v2"):
|
||||
pass
|
||||
self.assertTrue(fake_client.open_session.called)
|
||||
self.assertTrue(fake_client.close_session.called)
|
||||
@ -255,7 +252,7 @@ class ClientTest(utils.TestCase):
|
||||
fake_client = mock.Mock()
|
||||
mock_http_client.return_value = fake_client
|
||||
with novaclient.v3.client.Client("user", "password", "project_id",
|
||||
auth_url="foo/v2"):
|
||||
auth_url="foo/v2"):
|
||||
pass
|
||||
self.assertTrue(fake_client.open_session.called)
|
||||
self.assertTrue(fake_client.close_session.called)
|
||||
|
@ -879,11 +879,11 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
if body.get('pool'):
|
||||
return (200, {}, {'floating_ip':
|
||||
{'id': 1, 'fixed_ip': '10.0.0.1', 'ip': '11.0.0.1',
|
||||
'pool': 'nova'}})
|
||||
'pool': 'nova'}})
|
||||
else:
|
||||
return (200, {}, {'floating_ip':
|
||||
{'id': 1, 'fixed_ip': '10.0.0.1', 'ip': '11.0.0.1',
|
||||
'pool': None}})
|
||||
'pool': None}})
|
||||
|
||||
def delete_os_floating_ips_1(self, **kw):
|
||||
return (204, {}, None)
|
||||
@ -895,43 +895,42 @@ 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'),
|
||||
'name': "host1",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}},
|
||||
{'dns_entry':
|
||||
{'ip': kw.get('ip'),
|
||||
'name': "host2",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}}]})
|
||||
return (205, {}, {
|
||||
'dns_entries': [
|
||||
{'dns_entry': {'ip': kw.get('ip'),
|
||||
'name': "host1",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}},
|
||||
{'dns_entry': {'ip': kw.get('ip'),
|
||||
'name': "host2",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}}]})
|
||||
else:
|
||||
return (404, {}, None)
|
||||
|
||||
def get_os_floating_ip_dns_testdomain_entries_testname(self, **kw):
|
||||
return (205, {}, {'dns_entry':
|
||||
{'ip': "10.10.10.10",
|
||||
'name': 'testname',
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}})
|
||||
return (205, {}, {
|
||||
'dns_entry': {'ip': "10.10.10.10",
|
||||
'name': 'testname',
|
||||
'type': "A",
|
||||
'domain': 'testdomain'}})
|
||||
|
||||
def put_os_floating_ip_dns_testdomain(self, body, **kw):
|
||||
if body['domain_entry']['scope'] == 'private':
|
||||
fakes.assert_has_keys(body['domain_entry'],
|
||||
required=['availability_zone', 'scope'])
|
||||
required=['availability_zone', 'scope'])
|
||||
elif body['domain_entry']['scope'] == 'public':
|
||||
fakes.assert_has_keys(body['domain_entry'],
|
||||
required=['project', 'scope'])
|
||||
required=['project', 'scope'])
|
||||
|
||||
else:
|
||||
fakes.assert_has_keys(body['domain_entry'],
|
||||
required=['project', 'scope'])
|
||||
required=['project', 'scope'])
|
||||
return (205, {}, body)
|
||||
|
||||
def put_os_floating_ip_dns_testdomain_entries_testname(self, body, **kw):
|
||||
fakes.assert_has_keys(body['dns_entry'],
|
||||
required=['ip', 'dns_type'])
|
||||
required=['ip', 'dns_type'])
|
||||
return (205, {}, body)
|
||||
|
||||
def delete_os_floating_ip_dns_testdomain(self, **kw):
|
||||
@ -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,
|
||||
@ -1330,7 +1328,7 @@ class FakeHTTPClient(base_client.HTTPClient):
|
||||
fakes.assert_has_keys(body['security_group'],
|
||||
required=['name', 'description'])
|
||||
r = {'security_group':
|
||||
self.get_os_security_groups()[2]['security_groups'][0]}
|
||||
self.get_os_security_groups()[2]['security_groups'][0]}
|
||||
return (202, {}, r)
|
||||
|
||||
def put_os_security_groups_1(self, body, **kw):
|
||||
@ -1363,12 +1361,13 @@ 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'])
|
||||
r = {'security_group_rule':
|
||||
self.get_os_security_group_rules()[2]['security_group_rules'][0]}
|
||||
self.get_os_security_group_rules()[2]['security_group_rules'][0]}
|
||||
return (202, {}, r)
|
||||
|
||||
#
|
||||
@ -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,9 +46,9 @@ 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',
|
||||
'interface': 'interfaceTest'}}
|
||||
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,
|
||||
body['floating_ips_bulk_create']['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,9 +2261,8 @@ 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',
|
||||
'policies': ['affinity']}})
|
||||
{'server_group': {'name': 'wjsg',
|
||||
'policies': ['affinity']}})
|
||||
|
||||
def test_delete_multi_server_groups(self):
|
||||
self.run_command('server-group-delete 12345 56789')
|
||||
|
@ -243,9 +243,9 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
|
||||
_headers = dict(location="http://blah/images/456")
|
||||
|
||||
if action not in set.union(set(body_is_none_list),
|
||||
set(body_params_check_exact.keys()),
|
||||
set(body_param_check_exists.keys()),
|
||||
set(body_params_check_superset.keys())):
|
||||
set(body_params_check_exact.keys()),
|
||||
set(body_param_check_exists.keys()),
|
||||
set(body_params_check_superset.keys())):
|
||||
raise AssertionError("Unexpected server action: %s" % action)
|
||||
|
||||
return (resp, _headers, _body)
|
||||
|
@ -67,4 +67,4 @@ class FlavorAccessManager(base.ManagerWithFind):
|
||||
_resp, body = self.api.client.post(url, body=body)
|
||||
|
||||
return [self.resource_class(self, res)
|
||||
for res in body['flavor_access']]
|
||||
for res in body['flavor_access']]
|
||||
|
@ -56,22 +56,18 @@ class FloatingIPDNSDomainManager(base.Manager):
|
||||
|
||||
def create_private(self, fqdomain, availability_zone):
|
||||
"""Add or modify a private DNS domain."""
|
||||
body = {'domain_entry':
|
||||
{'scope': 'private',
|
||||
'availability_zone': availability_zone}}
|
||||
body = {'domain_entry': {'scope': 'private',
|
||||
'availability_zone': availability_zone}}
|
||||
return self._update('/os-floating-ip-dns/%s' % _quote_domain(fqdomain),
|
||||
body,
|
||||
'domain_entry')
|
||||
|
||||
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,32 +99,23 @@ 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."""
|
||||
self._delete("/os-floating-ip-dns/%s/entries/%s" %
|
||||
(_quote_domain(domain), name))
|
||||
(_quote_domain(domain), name))
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -1086,7 +1086,7 @@ class ServerManager(base.BootingManagerWithFind):
|
||||
"""
|
||||
body = {'metadata': metadata}
|
||||
return self._create("/servers/%s/metadata" % base.getid(server),
|
||||
body, "metadata")
|
||||
body, "metadata")
|
||||
|
||||
def set_meta_item(self, server, key, value):
|
||||
"""
|
||||
|
@ -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."""
|
||||
|
||||
@ -3902,7 +3901,7 @@ def do_secgroup_delete_default_rule(cs, args):
|
||||
default=argparse.SUPPRESS,
|
||||
nargs='*',
|
||||
help='Policies for the server groups '
|
||||
'("affinity" or "anti-affinity")')
|
||||
'("affinity" or "anti-affinity")')
|
||||
@utils.arg('--policy',
|
||||
default=[],
|
||||
action='append',
|
||||
|
@ -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.
|
||||
|
||||
@ -62,12 +61,12 @@ class VolumeManager(base.ManagerWithFind):
|
||||
:param imageRef: reference to an image stored in glance
|
||||
"""
|
||||
body = {'volume': {'size': size,
|
||||
'snapshot_id': snapshot_id,
|
||||
'display_name': display_name,
|
||||
'display_description': display_description,
|
||||
'volume_type': volume_type,
|
||||
'availability_zone': availability_zone,
|
||||
'imageRef': imageRef}}
|
||||
'snapshot_id': snapshot_id,
|
||||
'display_name': display_name,
|
||||
'display_description': display_description,
|
||||
'volume_type': volume_type,
|
||||
'availability_zone': availability_zone,
|
||||
'imageRef': imageRef}}
|
||||
return self._create('/volumes', body, 'volume')
|
||||
|
||||
def get(self, volume_id):
|
||||
@ -162,4 +161,4 @@ class VolumeManager(base.ManagerWithFind):
|
||||
:param attachment_id: The ID of the attachment
|
||||
"""
|
||||
self._delete("/servers/%s/os-volume_attachments/%s" %
|
||||
(server_id, attachment_id,))
|
||||
(server_id, attachment_id,))
|
||||
|
@ -440,7 +440,7 @@ class ServerManager(base.BootingManagerWithFind):
|
||||
if block_device_mapping:
|
||||
bdm_param = 'block_device_mapping'
|
||||
body['server'][bdm_param] = \
|
||||
self._parse_block_device_mapping(block_device_mapping)
|
||||
self._parse_block_device_mapping(block_device_mapping)
|
||||
elif block_device_mapping_v2:
|
||||
# Append the image to the list only if we have new style BDMs
|
||||
bdm_param = 'block_device_mapping_v2'
|
||||
@ -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…
Reference in New Issue
Block a user