Enable check for E126
E126 continuation line over-indented for hanging indent Change-Id: Id64edce8278d96c1b2d4a6ca536e9fc8fbef478c
This commit is contained in:
parent
bda83f92d1
commit
8de2237cc4
|
@ -378,7 +378,7 @@ class HTTPClient(object):
|
|||
self._session.close()
|
||||
self._current_url = service_url
|
||||
self._logger.debug(
|
||||
"New session created for: (%s)" % service_url)
|
||||
"New session created for: (%s)" % service_url)
|
||||
self._session = requests.Session()
|
||||
self._session.mount(service_url,
|
||||
self._connection_pool.get(service_url))
|
||||
|
|
|
@ -72,11 +72,11 @@ class ServiceCatalog(object):
|
|||
endpoints = service['endpoints']
|
||||
for endpoint in endpoints:
|
||||
# Ignore 1.0 compute endpoints
|
||||
if service.get("type") == 'compute' and \
|
||||
endpoint.get('versionId', '2') not in ('1.1', '2'):
|
||||
if (service.get("type") == 'compute' and
|
||||
endpoint.get('versionId', '2') not in ('1.1', '2')):
|
||||
continue
|
||||
if not filter_value or \
|
||||
endpoint.get(attr).lower() == filter_value.lower():
|
||||
if (not filter_value or
|
||||
endpoint.get(attr).lower() == filter_value.lower()):
|
||||
endpoint["serviceName"] = service.get("name")
|
||||
matching_endpoints.append(endpoint)
|
||||
|
||||
|
@ -84,6 +84,6 @@ class ServiceCatalog(object):
|
|||
raise novaclient.exceptions.EndpointNotFound()
|
||||
elif len(matching_endpoints) > 1:
|
||||
raise novaclient.exceptions.AmbiguousEndpoints(
|
||||
endpoints=matching_endpoints)
|
||||
endpoints=matching_endpoints)
|
||||
else:
|
||||
return matching_endpoints[0][endpoint_type]
|
||||
|
|
|
@ -355,8 +355,8 @@ class OpenStackComputeShell(object):
|
|||
metavar='<endpoint-type>',
|
||||
default=utils.env('NOVA_ENDPOINT_TYPE',
|
||||
default=DEFAULT_NOVA_ENDPOINT_TYPE),
|
||||
help=_('Defaults to env[NOVA_ENDPOINT_TYPE] or ')
|
||||
+ DEFAULT_NOVA_ENDPOINT_TYPE + '.')
|
||||
help=(_('Defaults to env[NOVA_ENDPOINT_TYPE] or ')
|
||||
+ DEFAULT_NOVA_ENDPOINT_TYPE + '.'))
|
||||
# NOTE(dtroyer): We can't add --endpoint_type here due to argparse
|
||||
# thinking usage-list --end is ambiguous; but it
|
||||
# works fine with only --endpoint-type present
|
||||
|
@ -527,7 +527,7 @@ class OpenStackComputeShell(object):
|
|||
|
||||
# build available subcommands based on version
|
||||
self.extensions = self._discover_extensions(
|
||||
options.os_compute_api_version)
|
||||
options.os_compute_api_version)
|
||||
self._run_extension_hooks('__pre_parse_args__')
|
||||
|
||||
# NOTE(dtroyer): Hackery to handle --endpoint_type due to argparse
|
||||
|
@ -539,7 +539,7 @@ class OpenStackComputeShell(object):
|
|||
argv[spot] = '--endpoint-type'
|
||||
|
||||
subcommand_parser = self.get_subcommand_parser(
|
||||
options.os_compute_api_version)
|
||||
options.os_compute_api_version)
|
||||
self.parser = subcommand_parser
|
||||
|
||||
if options.help or not argv:
|
||||
|
|
|
@ -105,18 +105,18 @@ class DNSFixture(base.Fixture):
|
|||
'dns_entries': [
|
||||
{
|
||||
'dns_entry': {
|
||||
'ip': '1.2.3.4',
|
||||
'name': "host1",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'
|
||||
'ip': '1.2.3.4',
|
||||
'name': "host1",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'
|
||||
}
|
||||
},
|
||||
{
|
||||
'dns_entry': {
|
||||
'ip': '1.2.3.4',
|
||||
'name': "host2",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'
|
||||
'ip': '1.2.3.4',
|
||||
'name': "host2",
|
||||
'type': "A",
|
||||
'domain': 'testdomain'
|
||||
}
|
||||
},
|
||||
]
|
||||
|
@ -182,9 +182,9 @@ class BulkFixture(base.Fixture):
|
|||
interface = params.get('interface', 'defaultInterface')
|
||||
return {
|
||||
'floating_ips_bulk_create': {
|
||||
'ip_range': '192.168.1.0/30',
|
||||
'pool': pool,
|
||||
'interface': interface
|
||||
'ip_range': '192.168.1.0/30',
|
||||
'pool': pool,
|
||||
'interface': interface
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -167,9 +167,9 @@ class DeprecatedAuthPluginTest(utils.TestCase):
|
|||
return None
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t, name: [
|
||||
MockAuthUrlEntrypoint("fakewithauthurl",
|
||||
"fakewithauthurl",
|
||||
["auth_url"])]
|
||||
MockAuthUrlEntrypoint("fakewithauthurl",
|
||||
"fakewithauthurl",
|
||||
["auth_url"])]
|
||||
|
||||
plugin = auth_plugin.DeprecatedAuthPlugin("fakewithauthurl")
|
||||
self.assertRaises(
|
||||
|
@ -192,7 +192,7 @@ class AuthPluginTest(utils.TestCase):
|
|||
cls._authenticate(auth_url, {"fake": "me"})
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t: [
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
|
||||
mock_request.side_effect = mock_http_request()
|
||||
|
||||
|
@ -207,12 +207,12 @@ class AuthPluginTest(utils.TestCase):
|
|||
token_url = cs.client.auth_url + "/tokens"
|
||||
|
||||
mock_request.assert_called_with(
|
||||
"POST",
|
||||
token_url,
|
||||
headers=headers,
|
||||
data='{"fake": "me"}',
|
||||
allow_redirects=True,
|
||||
**self.TEST_REQUEST_BASE)
|
||||
"POST",
|
||||
token_url,
|
||||
headers=headers,
|
||||
data='{"fake": "me"}',
|
||||
allow_redirects=True,
|
||||
**self.TEST_REQUEST_BASE)
|
||||
|
||||
@mock.patch.object(pkg_resources, "iter_entry_points")
|
||||
def test_discover_auth_system_options(self, mock_iter_entry_points):
|
||||
|
@ -231,7 +231,7 @@ class AuthPluginTest(utils.TestCase):
|
|||
return FakePlugin
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t: [
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
auth_plugin.discover_auth_systems()
|
||||
|
@ -255,7 +255,7 @@ class AuthPluginTest(utils.TestCase):
|
|||
return self.opts
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t: [
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
|
||||
auth_plugin.discover_auth_systems()
|
||||
plugin = auth_plugin.load_plugin("fake")
|
||||
|
@ -275,7 +275,7 @@ class AuthPluginTest(utils.TestCase):
|
|||
return "http://faked/v2.0"
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t: [
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
|
||||
auth_plugin.discover_auth_systems()
|
||||
plugin = auth_plugin.load_plugin("fake")
|
||||
|
@ -296,15 +296,15 @@ class AuthPluginTest(utils.TestCase):
|
|||
pass
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t: [
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
|
||||
auth_plugin.discover_auth_systems()
|
||||
plugin = auth_plugin.load_plugin("fake")
|
||||
|
||||
self.assertRaises(
|
||||
exceptions.EndpointNotFound,
|
||||
client.Client, "username", "password", "project_id",
|
||||
auth_system="fake", auth_plugin=plugin)
|
||||
exceptions.EndpointNotFound,
|
||||
client.Client, "username", "password", "project_id",
|
||||
auth_system="fake", auth_plugin=plugin)
|
||||
|
||||
@mock.patch.object(pkg_resources, "iter_entry_points")
|
||||
def test_exception_if_no_url(self, mock_iter_entry_points):
|
||||
|
@ -317,12 +317,12 @@ class AuthPluginTest(utils.TestCase):
|
|||
pass
|
||||
|
||||
mock_iter_entry_points.side_effect = lambda _t: [
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
MockEntrypoint("fake", "fake", ["FakePlugin"])]
|
||||
|
||||
auth_plugin.discover_auth_systems()
|
||||
plugin = auth_plugin.load_plugin("fake")
|
||||
|
||||
self.assertRaises(
|
||||
exceptions.EndpointNotFound,
|
||||
client.Client, "username", "password", "project_id",
|
||||
auth_system="fake", auth_plugin=plugin)
|
||||
exceptions.EndpointNotFound,
|
||||
client.Client, "username", "password", "project_id",
|
||||
auth_system="fake", auth_plugin=plugin)
|
||||
|
|
|
@ -136,12 +136,13 @@ class FakeHTTPClient(fakes.FakeHTTPClient):
|
|||
return (202, {}, {})
|
||||
|
||||
def post_os_server_external_events(self, **kw):
|
||||
return (200, {}, {'events': [
|
||||
{'name': 'test-event',
|
||||
'status': 'completed',
|
||||
'tag': 'tag',
|
||||
'server_uuid': 'fake-uuid1'},
|
||||
{'name': 'test-event',
|
||||
'status': 'completed',
|
||||
'tag': 'tag',
|
||||
'server_uuid': 'fake-uuid2'}]})
|
||||
return (200, {}, {
|
||||
'events': [
|
||||
{'name': 'test-event',
|
||||
'status': 'completed',
|
||||
'tag': 'tag',
|
||||
'server_uuid': 'fake-uuid1'},
|
||||
{'name': 'test-event',
|
||||
'status': 'completed',
|
||||
'tag': 'tag',
|
||||
'server_uuid': 'fake-uuid2'}]})
|
||||
|
|
|
@ -126,11 +126,11 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
return (202, {}, None)
|
||||
|
||||
def put_os_agents_1(self, body, **kw):
|
||||
return (200, {}, {"agent": {
|
||||
"url": "/yyy/yyyy/yyyy",
|
||||
"version": "8.0",
|
||||
"md5hash": "add6bb58e139be103324d04d82d8f546",
|
||||
'id': 1}})
|
||||
return (200, {}, {
|
||||
"agent": {"url": "/yyy/yyyy/yyyy",
|
||||
"version": "8.0",
|
||||
"md5hash": "add6bb58e139be103324d04d82d8f546",
|
||||
'id': 1}})
|
||||
|
||||
#
|
||||
# List all extensions
|
||||
|
@ -1038,20 +1038,19 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
self.get_os_keypairs()[2]['keypairs'][0]['keypair']})
|
||||
|
||||
def get_os_keypairs(self, *kw):
|
||||
return (200, {}, {"keypairs": [
|
||||
{"keypair": {
|
||||
"public_key": "FAKE_SSH_RSA",
|
||||
"private_key": "FAKE_PRIVATE_KEY",
|
||||
"user_id":
|
||||
"81e373b596d6466e99c4896826abaa46",
|
||||
"name": "test",
|
||||
"deleted": False,
|
||||
"created_at": "2014-04-19T02:16:44.000000",
|
||||
"updated_at": "2014-04-19T10:12:3.000000",
|
||||
"figerprint": "FAKE_KEYPAIR",
|
||||
"deleted_at": None,
|
||||
"id": 4}
|
||||
}]})
|
||||
return (200, {}, {
|
||||
"keypairs": [{"keypair": {
|
||||
"public_key": "FAKE_SSH_RSA",
|
||||
"private_key": "FAKE_PRIVATE_KEY",
|
||||
"user_id": "81e373b596d6466e99c4896826abaa46",
|
||||
"name": "test",
|
||||
"deleted": False,
|
||||
"created_at": "2014-04-19T02:16:44.000000",
|
||||
"updated_at": "2014-04-19T10:12:3.000000",
|
||||
"figerprint": "FAKE_KEYPAIR",
|
||||
"deleted_at": None,
|
||||
"id": 4}}
|
||||
]})
|
||||
|
||||
def delete_os_keypairs_test(self, **kw):
|
||||
return (202, {}, None)
|
||||
|
@ -1076,127 +1075,135 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
#
|
||||
|
||||
def get_os_quota_sets_test(self, **kw):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def get_os_quota_sets_tenant_id(self, **kw):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def get_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, **kw):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def put_os_quota_sets_97f4c221_bff4_4578_b030_0df4ef119353(self, **kw):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def get_os_quota_sets_97f4c221_bff4_4578_b030_0df4ef119353(self, **kw):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def get_os_quota_sets_97f4c221bff44578b0300df4ef119353_defaults(self):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def get_os_quota_sets_tenant_id_defaults(self):
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': 'test',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def put_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, body, **kw):
|
||||
assert list(body) == ['quota_set']
|
||||
fakes.assert_has_keys(body['quota_set'],
|
||||
required=['tenant_id'])
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def delete_os_quota_sets_test(self, **kw):
|
||||
return (202, {}, {})
|
||||
|
@ -1209,50 +1216,53 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
#
|
||||
|
||||
def get_os_quota_class_sets_test(self, **kw):
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'id': 'test',
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_class_set': {
|
||||
'id': 'test',
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def put_os_quota_class_sets_test(self, body, **kw):
|
||||
assert list(body) == ['quota_class_set']
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_class_set': {
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
def put_os_quota_class_sets_97f4c221bff44578b0300df4ef119353(self,
|
||||
body, **kw):
|
||||
assert list(body) == ['quota_class_set']
|
||||
return (200, {}, {'quota_class_set': {
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
return (200, {}, {
|
||||
'quota_class_set': {
|
||||
'metadata_items': 1,
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'key_pairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1}})
|
||||
|
||||
#
|
||||
# Security Groups
|
||||
|
@ -1669,110 +1679,116 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
return (200, {}, result)
|
||||
|
||||
def get_os_hypervisors(self, **kw):
|
||||
return (200, {}, {"hypervisors": [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'},
|
||||
{'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
|
||||
return (200, {}, {
|
||||
"hypervisors": [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'},
|
||||
{'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
|
||||
|
||||
def get_os_hypervisors_detail(self, **kw):
|
||||
return (200, {}, {"hypervisors": [
|
||||
{'id': 1234,
|
||||
'service': {'id': 1, 'host': 'compute1'},
|
||||
'vcpus': 4,
|
||||
'memory_mb': 10 * 1024,
|
||||
'local_gb': 250,
|
||||
'vcpus_used': 2,
|
||||
'memory_mb_used': 5 * 1024,
|
||||
'local_gb_used': 125,
|
||||
'hypervisor_type': "xen",
|
||||
'hypervisor_version': 3,
|
||||
'hypervisor_hostname': "hyper1",
|
||||
'free_ram_mb': 5 * 1024,
|
||||
'free_disk_gb': 125,
|
||||
'current_workload': 2,
|
||||
'running_vms': 2,
|
||||
'cpu_info': 'cpu_info',
|
||||
'disk_available_least': 100},
|
||||
{'id': 2,
|
||||
'service': {'id': 2, 'host': "compute2"},
|
||||
'vcpus': 4,
|
||||
'memory_mb': 10 * 1024,
|
||||
'local_gb': 250,
|
||||
'vcpus_used': 2,
|
||||
'memory_mb_used': 5 * 1024,
|
||||
'local_gb_used': 125,
|
||||
'hypervisor_type': "xen",
|
||||
'hypervisor_version': 3,
|
||||
'hypervisor_hostname': "hyper2",
|
||||
'free_ram_mb': 5 * 1024,
|
||||
'free_disk_gb': 125,
|
||||
'current_workload': 2,
|
||||
'running_vms': 2,
|
||||
'cpu_info': 'cpu_info',
|
||||
'disk_available_least': 100}
|
||||
]})
|
||||
return (200, {}, {
|
||||
"hypervisors": [
|
||||
{'id': 1234,
|
||||
'service': {'id': 1, 'host': 'compute1'},
|
||||
'vcpus': 4,
|
||||
'memory_mb': 10 * 1024,
|
||||
'local_gb': 250,
|
||||
'vcpus_used': 2,
|
||||
'memory_mb_used': 5 * 1024,
|
||||
'local_gb_used': 125,
|
||||
'hypervisor_type': "xen",
|
||||
'hypervisor_version': 3,
|
||||
'hypervisor_hostname': "hyper1",
|
||||
'free_ram_mb': 5 * 1024,
|
||||
'free_disk_gb': 125,
|
||||
'current_workload': 2,
|
||||
'running_vms': 2,
|
||||
'cpu_info': 'cpu_info',
|
||||
'disk_available_least': 100},
|
||||
{'id': 2,
|
||||
'service': {'id': 2, 'host': "compute2"},
|
||||
'vcpus': 4,
|
||||
'memory_mb': 10 * 1024,
|
||||
'local_gb': 250,
|
||||
'vcpus_used': 2,
|
||||
'memory_mb_used': 5 * 1024,
|
||||
'local_gb_used': 125,
|
||||
'hypervisor_type': "xen",
|
||||
'hypervisor_version': 3,
|
||||
'hypervisor_hostname': "hyper2",
|
||||
'free_ram_mb': 5 * 1024,
|
||||
'free_disk_gb': 125,
|
||||
'current_workload': 2,
|
||||
'running_vms': 2,
|
||||
'cpu_info': 'cpu_info',
|
||||
'disk_available_least': 100}]
|
||||
})
|
||||
|
||||
def get_os_hypervisors_statistics(self, **kw):
|
||||
return (200, {}, {"hypervisor_statistics": {
|
||||
'count': 2,
|
||||
'vcpus': 8,
|
||||
'memory_mb': 20 * 1024,
|
||||
'local_gb': 500,
|
||||
'vcpus_used': 4,
|
||||
'memory_mb_used': 10 * 1024,
|
||||
'local_gb_used': 250,
|
||||
'free_ram_mb': 10 * 1024,
|
||||
'free_disk_gb': 250,
|
||||
'current_workload': 4,
|
||||
'running_vms': 4,
|
||||
'disk_available_least': 200,
|
||||
}})
|
||||
return (200, {}, {
|
||||
"hypervisor_statistics": {
|
||||
'count': 2,
|
||||
'vcpus': 8,
|
||||
'memory_mb': 20 * 1024,
|
||||
'local_gb': 500,
|
||||
'vcpus_used': 4,
|
||||
'memory_mb_used': 10 * 1024,
|
||||
'local_gb_used': 250,
|
||||
'free_ram_mb': 10 * 1024,
|
||||
'free_disk_gb': 250,
|
||||
'current_workload': 4,
|
||||
'running_vms': 4,
|
||||
'disk_available_least': 200}
|
||||
})
|
||||
|
||||
def get_os_hypervisors_hyper_search(self, **kw):
|
||||
return (200, {}, {'hypervisors': [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'},
|
||||
{'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
|
||||
return (200, {}, {
|
||||
'hypervisors': [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'},
|
||||
{'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
|
||||
|
||||
def get_os_hypervisors_hyper_servers(self, **kw):
|
||||
return (200, {}, {'hypervisors': [
|
||||
{'id': 1234,
|
||||
'hypervisor_hostname': 'hyper1',
|
||||
'servers': [
|
||||
{'name': 'inst1', 'uuid': 'uuid1'},
|
||||
{'name': 'inst2', 'uuid': 'uuid2'}]},
|
||||
{'id': 5678,
|
||||
'hypervisor_hostname': 'hyper2',
|
||||
'servers': [
|
||||
{'name': 'inst3', 'uuid': 'uuid3'},
|
||||
{'name': 'inst4', 'uuid': 'uuid4'}]}
|
||||
]})
|
||||
return (200, {}, {
|
||||
'hypervisors': [
|
||||
{'id': 1234,
|
||||
'hypervisor_hostname': 'hyper1',
|
||||
'servers': [
|
||||
{'name': 'inst1', 'uuid': 'uuid1'},
|
||||
{'name': 'inst2', 'uuid': 'uuid2'}]},
|
||||
{'id': 5678,
|
||||
'hypervisor_hostname': 'hyper2',
|
||||
'servers': [
|
||||
{'name': 'inst3', 'uuid': 'uuid3'},
|
||||
{'name': 'inst4', 'uuid': 'uuid4'}]}]
|
||||
})
|
||||
|
||||
def get_os_hypervisors_hyper_no_servers_servers(self, **kw):
|
||||
return (200, {}, {'hypervisors':
|
||||
[{'id': 1234, 'hypervisor_hostname': 'hyper1'}]})
|
||||
|
||||
def get_os_hypervisors_1234(self, **kw):
|
||||
return (200, {}, {'hypervisor':
|
||||
{'id': 1234,
|
||||
'service': {'id': 1, 'host': 'compute1'},
|
||||
'vcpus': 4,
|
||||
'memory_mb': 10 * 1024,
|
||||
'local_gb': 250,
|
||||
'vcpus_used': 2,
|
||||
'memory_mb_used': 5 * 1024,
|
||||
'local_gb_used': 125,
|
||||
'hypervisor_type': "xen",
|
||||
'hypervisor_version': 3,
|
||||
'hypervisor_hostname': "hyper1",
|
||||
'free_ram_mb': 5 * 1024,
|
||||
'free_disk_gb': 125,
|
||||
'current_workload': 2,
|
||||
'running_vms': 2,
|
||||
'cpu_info': 'cpu_info',
|
||||
'disk_available_least': 100}})
|
||||
return (200, {}, {
|
||||
'hypervisor':
|
||||
{'id': 1234,
|
||||
'service': {'id': 1, 'host': 'compute1'},
|
||||
'vcpus': 4,
|
||||
'memory_mb': 10 * 1024,
|
||||
'local_gb': 250,
|
||||
'vcpus_used': 2,
|
||||
'memory_mb_used': 5 * 1024,
|
||||
'local_gb_used': 125,
|
||||
'hypervisor_type': "xen",
|
||||
'hypervisor_version': 3,
|
||||
'hypervisor_hostname': "hyper1",
|
||||
'free_ram_mb': 5 * 1024,
|
||||
'free_disk_gb': 125,
|
||||
'current_workload': 2,
|
||||
'running_vms': 2,
|
||||
'cpu_info': 'cpu_info',
|
||||
'disk_available_least': 100}})
|
||||
|
||||
def get_os_hypervisors_1234_uptime(self, **kw):
|
||||
return (200, {}, {'hypervisor':
|
||||
{'id': 1234,
|
||||
return (200, {}, {
|
||||
'hypervisor': {'id': 1234,
|
||||
'hypervisor_hostname': "hyper1",
|
||||
'uptime': "fake uptime"}})
|
||||
|
||||
|
@ -1839,13 +1855,15 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
return (202, {}, None)
|
||||
|
||||
def get_os_availability_zone(self, **kw):
|
||||
return (200, {}, {"availabilityZoneInfo": [
|
||||
{"zoneName": "zone-1",
|
||||
"zoneState": {"available": True},
|
||||
"hosts": None},
|
||||
{"zoneName": "zone-2",
|
||||
"zoneState": {"available": False},
|
||||
"hosts": None}]})
|
||||
return (200, {}, {
|
||||
"availabilityZoneInfo": [
|
||||
{"zoneName": "zone-1",
|
||||
"zoneState": {"available": True},
|
||||
"hosts": None},
|
||||
{"zoneName": "zone-2",
|
||||
"zoneState": {"available": False},
|
||||
"hosts": None}]
|
||||
})
|
||||
|
||||
def get_os_availability_zone_detail(self, **kw):
|
||||
return (200, {}, {
|
||||
|
@ -1879,19 +1897,21 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
"hosts": None}]})
|
||||
|
||||
def get_servers_1234_os_interface(self, **kw):
|
||||
return (200, {}, {"interfaceAttachments": [
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
},
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
}]})
|
||||
return (200, {}, {
|
||||
"interfaceAttachments": [
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
},
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
}]
|
||||
})
|
||||
|
||||
def post_servers_1234_os_interface(self, **kw):
|
||||
return (200, {}, {'interfaceAttachment': {}})
|
||||
|
@ -1989,7 +2009,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
return (200, {}, {})
|
||||
|
||||
def post_servers_1234_os_volume_attachments(self, **kw):
|
||||
return (200, {}, {"volumeAttachment":
|
||||
return (200, {}, {
|
||||
"volumeAttachment":
|
||||
{"device": "/dev/vdb",
|
||||
"volumeId": 2}})
|
||||
|
||||
|
@ -1997,38 +2018,37 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
return (200, {}, {"volumeAttachment": {"volumeId": 2}})
|
||||
|
||||
def get_servers_1234_os_volume_attachments(self, **kw):
|
||||
return (200, {}, {"volumeAttachments": [
|
||||
{"display_name": "Work",
|
||||
"display_description": "volume for work",
|
||||
"status": "ATTACHED",
|
||||
"id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
|
||||
"created_at": "2011-09-09T00:00:00Z",
|
||||
"attached": "2011-11-11T00:00:00Z",
|
||||
"size": 1024,
|
||||
"attachments": [
|
||||
{"id": "3333",
|
||||
"links": ''}],
|
||||
"metadata": {}}]})
|
||||
return (200, {}, {
|
||||
"volumeAttachments": [
|
||||
{"display_name": "Work",
|
||||
"display_description": "volume for work",
|
||||
"status": "ATTACHED",
|
||||
"id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
|
||||
"created_at": "2011-09-09T00:00:00Z",
|
||||
"attached": "2011-11-11T00:00:00Z",
|
||||
"size": 1024,
|
||||
"attachments": [{"id": "3333", "links": ''}],
|
||||
"metadata": {}}]})
|
||||
|
||||
def get_servers_1234_os_volume_attachments_Work(self, **kw):
|
||||
return (200, {}, {"volumeAttachment":
|
||||
{"display_name": "Work",
|
||||
"display_description": "volume for work",
|
||||
"status": "ATTACHED",
|
||||
"id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
|
||||
"created_at": "2011-09-09T00:00:00Z",
|
||||
"attached": "2011-11-11T00:00:00Z",
|
||||
"size": 1024,
|
||||
"attachments": [
|
||||
{"id": "3333",
|
||||
"links": ''}],
|
||||
"metadata": {}}})
|
||||
return (200, {}, {
|
||||
"volumeAttachment":
|
||||
{"display_name": "Work",
|
||||
"display_description": "volume for work",
|
||||
"status": "ATTACHED",
|
||||
"id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
|
||||
"created_at": "2011-09-09T00:00:00Z",
|
||||
"attached": "2011-11-11T00:00:00Z",
|
||||
"size": 1024,
|
||||
"attachments": [{"id": "3333", "links": ''}],
|
||||
"metadata": {}}})
|
||||
|
||||
def delete_servers_1234_os_volume_attachments_Work(self, **kw):
|
||||
return (200, {}, {})
|
||||
|
||||
def get_servers_1234_os_instance_actions(self, **kw):
|
||||
return (200, {}, {"instanceActions":
|
||||
return (200, {}, {
|
||||
"instanceActions":
|
||||
[{"instance_uuid": "1234",
|
||||
"user_id": "b968c25e04ab405f9fe4e6ca54cce9a5",
|
||||
"start_time": "2013-03-25T13:45:09.000000",
|
||||
|
@ -2038,7 +2058,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
"project_id": "04019601fe3648c0abd4f4abfb9e6106"}]})
|
||||
|
||||
def get_servers_1234_os_instance_actions_req_abcde12345(self, **kw):
|
||||
return (200, {}, {"instanceAction":
|
||||
return (200, {}, {
|
||||
"instanceAction":
|
||||
{"instance_uuid": "1234",
|
||||
"user_id": "b968c25e04ab405f9fe4e6ca54cce9a5",
|
||||
"start_time": "2013-03-25T13:45:09.000000",
|
||||
|
@ -2061,18 +2082,18 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
|
||||
def get_os_cells_child_cell(self, **kw):
|
||||
cell = {'cell': {
|
||||
'username': 'cell1_user',
|
||||
'name': 'cell1',
|
||||
'rpc_host': '10.0.1.10',
|
||||
'info': {
|
||||
'username': 'cell1_user',
|
||||
'rpc_host': '10.0.1.10',
|
||||
'type': 'child',
|
||||
'name': 'cell1',
|
||||
'rpc_port': 5673},
|
||||
'type': 'child',
|
||||
'rpc_port': 5673,
|
||||
'loaded': True
|
||||
'username': 'cell1_user',
|
||||
'name': 'cell1',
|
||||
'rpc_host': '10.0.1.10',
|
||||
'info': {
|
||||
'username': 'cell1_user',
|
||||
'rpc_host': '10.0.1.10',
|
||||
'type': 'child',
|
||||
'name': 'cell1',
|
||||
'rpc_port': 5673},
|
||||
'type': 'child',
|
||||
'rpc_port': 5673,
|
||||
'loaded': True
|
||||
}}
|
||||
return (200, {}, cell)
|
||||
|
||||
|
@ -2107,8 +2128,8 @@ class FakeHTTPClient(base_client.HTTPClient):
|
|||
|
||||
def post_os_server_external_events(self, **kw):
|
||||
return (200, {}, {'events': [
|
||||
{'name': 'network-changed',
|
||||
'server_uuid': '1234'}]})
|
||||
{'name': 'network-changed',
|
||||
'server_uuid': '1234'}]})
|
||||
|
||||
#
|
||||
# Server Groups
|
||||
|
|
|
@ -77,12 +77,12 @@ class AgentsTest(utils.FixturedTestCase):
|
|||
'add6bb58e139be103324d04d82d8f546',
|
||||
'xen')
|
||||
body = {'agent': {
|
||||
'url': '/xxx/xxx/xxx',
|
||||
'hypervisor': 'xen',
|
||||
'md5hash': 'add6bb58e139be103324d04d82d8f546',
|
||||
'version': '7.0',
|
||||
'architecture': 'x86',
|
||||
'os': 'win'}}
|
||||
'url': '/xxx/xxx/xxx',
|
||||
'hypervisor': 'xen',
|
||||
'md5hash': 'add6bb58e139be103324d04d82d8f546',
|
||||
'version': '7.0',
|
||||
'architecture': 'x86',
|
||||
'os': 'win'}}
|
||||
self.assert_called('POST', '/os-agents', body)
|
||||
self.assertEqual(1, ag._info.copy()['id'])
|
||||
|
||||
|
|
|
@ -152,19 +152,20 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
|
|||
fakes_v1_1.FakeHTTPClient.delete_servers_1234_os_interface_port_id)
|
||||
|
||||
def get_servers_1234_os_attach_interfaces(self, **kw):
|
||||
return (200, {}, {"interface_attachments": [
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
},
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
}]})
|
||||
return (200, {}, {
|
||||
"interface_attachments": [
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}],
|
||||
},
|
||||
{"port_state": "ACTIVE",
|
||||
"net_id": "net-id-1",
|
||||
"port_id": "port-id-1",
|
||||
"mac_address": "aa:bb:cc:dd:ee:ff",
|
||||
"fixed_ips": [{"ip_address": "1.2.3.4"}]}]
|
||||
})
|
||||
|
||||
def post_servers_1234_os_attach_interfaces(self, **kw):
|
||||
return (200, {}, {'interface_attachment': {}})
|
||||
|
@ -263,13 +264,12 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
|
|||
# Availability Zones
|
||||
#
|
||||
def get_os_availability_zone(self, **kw):
|
||||
return (200, {}, {"availability_zone_info": [
|
||||
{"zone_name": "zone-1",
|
||||
"zone_state": {"available": True},
|
||||
"hosts": None},
|
||||
{"zone_name": "zone-2",
|
||||
"zone_state": {"available": False},
|
||||
"hosts": None}]})
|
||||
return (200, {}, {
|
||||
"availability_zone_info": [
|
||||
{"zone_name": "zone-1", "zone_state": {"available": True},
|
||||
"hosts": None},
|
||||
{"zone_name": "zone-2", "zone_state": {"available": False},
|
||||
"hosts": None}]})
|
||||
|
||||
def get_os_availability_zone_detail(self, **kw):
|
||||
return (200, {}, {
|
||||
|
@ -308,21 +308,22 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
|
|||
#
|
||||
def put_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, body, **kw):
|
||||
assert list(body) == ['quota_set']
|
||||
return (200, {}, {'quota_set': {
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1,
|
||||
'server_groups': 1,
|
||||
'server_group_members': 1}})
|
||||
return (200, {}, {
|
||||
'quota_set': {
|
||||
'tenant_id': '97f4c221bff44578b0300df4ef119353',
|
||||
'metadata_items': [],
|
||||
'injected_file_content_bytes': 1,
|
||||
'injected_file_path_bytes': 1,
|
||||
'ram': 1,
|
||||
'floating_ips': 1,
|
||||
'instances': 1,
|
||||
'injected_files': 1,
|
||||
'cores': 1,
|
||||
'keypairs': 1,
|
||||
'security_groups': 1,
|
||||
'security_group_rules': 1,
|
||||
'server_groups': 1,
|
||||
'server_group_members': 1}})
|
||||
|
||||
def get_os_quota_sets_test_detail(self, **kw):
|
||||
return (200, {}, {'quota_set': {
|
||||
|
@ -337,17 +338,18 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
|
|||
if kw['query'] == 'hyper1':
|
||||
return (200, {}, {'hypervisors': [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'}]})
|
||||
return (200, {}, {'hypervisors': [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'},
|
||||
{'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
|
||||
return (200, {}, {
|
||||
'hypervisors': [
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1'},
|
||||
{'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
|
||||
|
||||
def get_os_hypervisors_1234_servers(self, **kw):
|
||||
return (200, {}, {'hypervisor':
|
||||
{'id': 1234,
|
||||
'hypervisor_hostname': 'hyper1',
|
||||
'servers': [
|
||||
{'name': 'inst1', 'id': 'uuid1'},
|
||||
{'name': 'inst2', 'id': 'uuid2'}]}})
|
||||
return (200, {}, {
|
||||
'hypervisor':
|
||||
{'id': 1234, 'hypervisor_hostname': 'hyper1',
|
||||
'servers': [
|
||||
{'name': 'inst1', 'id': 'uuid1'},
|
||||
{'name': 'inst2', 'id': 'uuid2'}]}})
|
||||
|
||||
#
|
||||
# Keypairs
|
||||
|
|
|
@ -224,9 +224,9 @@ def find_resource(manager, name_or_id, **find_args):
|
|||
kwargs.update(find_args)
|
||||
return manager.find(**kwargs)
|
||||
except exceptions.NotFound:
|
||||
msg = _("No %(class)s with a name or ID of '%(name)s' exists.") % \
|
||||
{'class': manager.resource_class.__name__.lower(),
|
||||
'name': name_or_id}
|
||||
msg = (_("No %(class)s with a name or ID of '%(name)s' exists.") %
|
||||
{'class': manager.resource_class.__name__.lower(),
|
||||
'name': name_or_id})
|
||||
raise exceptions.CommandError(msg)
|
||||
except exceptions.NoUniqueMatch:
|
||||
msg = (_("Multiple %(class)s matches found for '%(name)s', use an ID "
|
||||
|
|
|
@ -41,10 +41,9 @@ class AgentsManager(base.ManagerWithFind):
|
|||
return self._list(url, "agents")
|
||||
|
||||
def _build_update_body(self, version, url, md5hash):
|
||||
return {'para': {
|
||||
'version': version,
|
||||
'url': url,
|
||||
'md5hash': md5hash}}
|
||||
return {'para': {'version': version,
|
||||
'url': url,
|
||||
'md5hash': md5hash}}
|
||||
|
||||
def update(self, id, version,
|
||||
url, md5hash):
|
||||
|
@ -55,13 +54,12 @@ class AgentsManager(base.ManagerWithFind):
|
|||
def create(self, os, architecture, version,
|
||||
url, md5hash, hypervisor):
|
||||
"""Create a new agent build."""
|
||||
body = {'agent': {
|
||||
'hypervisor': hypervisor,
|
||||
'os': os,
|
||||
'architecture': architecture,
|
||||
'version': version,
|
||||
'url': url,
|
||||
'md5hash': md5hash}}
|
||||
body = {'agent': {'hypervisor': hypervisor,
|
||||
'os': os,
|
||||
'architecture': architecture,
|
||||
'version': version,
|
||||
'url': url,
|
||||
'md5hash': md5hash}}
|
||||
return self._create('/os-agents', body, 'agent')
|
||||
|
||||
def delete(self, id):
|
||||
|
|
|
@ -24,9 +24,9 @@ from novaclient import base
|
|||
|
||||
class Certificate(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Certificate: private_key=[%s bytes] data=[%s bytes]>" % \
|
||||
(len(self.private_key) if self.private_key else 0,
|
||||
len(self.data))
|
||||
return ("<Certificate: private_key=[%s bytes] data=[%s bytes]>" %
|
||||
(len(self.private_key) if self.private_key else 0,
|
||||
len(self.data)))
|
||||
|
||||
|
||||
class CertificateManager(base.Manager):
|
||||
|
|
|
@ -42,7 +42,7 @@ class AssistedSnapshotManager(base.Manager):
|
|||
|
||||
def delete(self, snapshot, delete_info):
|
||||
self._delete("/os-assisted-volume-snapshots/%s?delete_info=%s" % (
|
||||
base.getid(snapshot), json.dumps(delete_info)))
|
||||
base.getid(snapshot), json.dumps(delete_info)))
|
||||
|
||||
manager_class = AssistedSnapshotManager
|
||||
name = 'assisted_volume_snapshots'
|
||||
|
|
|
@ -55,8 +55,7 @@ class Flavor(base.Resource):
|
|||
:param flavor: The :class:`Flavor` to get extra specs from
|
||||
"""
|
||||
_resp, body = self.manager.api.client.get(
|
||||
"/flavors/%s/os-extra_specs" %
|
||||
base.getid(self))
|
||||
"/flavors/%s/os-extra_specs" % base.getid(self))
|
||||
return body["extra_specs"]
|
||||
|
||||
def set_keys(self, metadata):
|
||||
|
@ -70,10 +69,8 @@ class Flavor(base.Resource):
|
|||
|
||||
body = {'extra_specs': metadata}
|
||||
return self.manager._create(
|
||||
"/flavors/%s/os-extra_specs" % base.getid(self),
|
||||
body,
|
||||
"extra_specs",
|
||||
return_raw=True)
|
||||
"/flavors/%s/os-extra_specs" % base.getid(self), body,
|
||||
"extra_specs", return_raw=True)
|
||||
|
||||
def unset_keys(self, keys):
|
||||
"""
|
||||
|
|
|
@ -54,10 +54,10 @@ class SecurityGroupDefaultRuleManager(base.Manager):
|
|||
", or 'icmp'."))
|
||||
|
||||
body = {"security_group_default_rule": {
|
||||
"ip_protocol": ip_protocol,
|
||||
"from_port": from_port,
|
||||
"to_port": to_port,
|
||||
"cidr": cidr}}
|
||||
"ip_protocol": ip_protocol,
|
||||
"from_port": from_port,
|
||||
"to_port": to_port,
|
||||
"cidr": cidr}}
|
||||
|
||||
return self._create('/os-security-group-default-rules', body,
|
||||
'security_group_default_rule')
|
||||
|
|
|
@ -59,12 +59,12 @@ class SecurityGroupRuleManager(base.Manager):
|
|||
", or 'icmp'."))
|
||||
|
||||
body = {"security_group_rule": {
|
||||
"ip_protocol": ip_protocol,
|
||||
"from_port": from_port,
|
||||
"to_port": to_port,
|
||||
"cidr": cidr,
|
||||
"group_id": group_id,
|
||||
"parent_group_id": parent_group_id}}
|
||||
"ip_protocol": ip_protocol,
|
||||
"from_port": from_port,
|
||||
"to_port": to_port,
|
||||
"cidr": cidr,
|
||||
"group_id": group_id,
|
||||
"parent_group_id": parent_group_id}}
|
||||
|
||||
return self._create('/os-security-group-rules', body,
|
||||
'security_group_rule')
|
||||
|
|
|
@ -517,7 +517,7 @@ class ServerManager(base.BootingManagerWithFind):
|
|||
# Block device mappings are passed as a list of dictionaries
|
||||
if block_device_mapping:
|
||||
body['server']['block_device_mapping'] = \
|
||||
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
|
||||
if image:
|
||||
|
|
|
@ -294,19 +294,19 @@ def _boot(cs, args):
|
|||
config_drive = args.config_drive
|
||||
|
||||
boot_kwargs = dict(
|
||||
meta=meta,
|
||||
files=files,
|
||||
key_name=key_name,
|
||||
min_count=min_count,
|
||||
max_count=max_count,
|
||||
userdata=userdata,
|
||||
availability_zone=availability_zone,
|
||||
security_groups=security_groups,
|
||||
block_device_mapping=block_device_mapping,
|
||||
block_device_mapping_v2=block_device_mapping_v2,
|
||||
nics=nics,
|
||||
scheduler_hints=hints,
|
||||
config_drive=config_drive)
|
||||
meta=meta,
|
||||
files=files,
|
||||
key_name=key_name,
|
||||
min_count=min_count,
|
||||
max_count=max_count,
|
||||
userdata=userdata,
|
||||
availability_zone=availability_zone,
|
||||
security_groups=security_groups,
|
||||
block_device_mapping=block_device_mapping,
|
||||
block_device_mapping_v2=block_device_mapping_v2,
|
||||
nics=nics,
|
||||
scheduler_hints=hints,
|
||||
config_drive=config_drive)
|
||||
|
||||
return boot_args, boot_kwargs
|
||||
|
||||
|
@ -1209,19 +1209,19 @@ def do_list(cs, args):
|
|||
if args.tenant or args.user:
|
||||
args.all_tenants = 1
|
||||
search_opts = {
|
||||
'all_tenants': args.all_tenants,
|
||||
'reservation_id': args.reservation_id,
|
||||
'ip': args.ip,
|
||||
'ip6': args.ip6,
|
||||
'name': args.name,
|
||||
'image': imageid,
|
||||
'flavor': flavorid,
|
||||
'status': args.status,
|
||||
'tenant_id': args.tenant,
|
||||
'user_id': args.user,
|
||||
'host': args.host,
|
||||
'deleted': args.deleted,
|
||||
'instance_name': args.instance_name}
|
||||
'all_tenants': args.all_tenants,
|
||||
'reservation_id': args.reservation_id,
|
||||
'ip': args.ip,
|
||||
'ip6': args.ip6,
|
||||
'name': args.name,
|
||||
'image': imageid,
|
||||
'flavor': flavorid,
|
||||
'status': args.status,
|
||||
'tenant_id': args.tenant,
|
||||
'user_id': args.user,
|
||||
'host': args.host,
|
||||
'deleted': args.deleted,
|
||||
'instance_name': args.instance_name}
|
||||
|
||||
filters = {'flavor': lambda f: f['id'],
|
||||
'security_groups': utils._format_security_groups}
|
||||
|
@ -2281,7 +2281,7 @@ def do_dns_list(cs, args):
|
|||
"""List current DNS entries for domain and ip or domain and name."""
|
||||
if not (args.ip or args.name):
|
||||
raise exceptions.CommandError(
|
||||
_("You must specify either --ip or --name"))
|
||||
_("You must specify either --ip or --name"))
|
||||
if args.name:
|
||||
entry = cs.dns_entries.get(args.domain, args.name)
|
||||
_print_dns_list([entry])
|
||||
|
@ -2576,12 +2576,12 @@ def do_secgroup_delete_group_rule(cs, args):
|
|||
params['to_port'] = int(args.to_port)
|
||||
|
||||
for rule in secgroup.rules:
|
||||
if (rule.get('ip_protocol') and rule['ip_protocol'].upper() ==
|
||||
params.get('ip_protocol').upper() and
|
||||
rule.get('from_port') == params.get('from_port') and
|
||||
rule.get('to_port') == params.get('to_port') and
|
||||
rule.get('group', {}).get('name') ==
|
||||
params.get('group_name')):
|
||||
if (rule.get('ip_protocol') and
|
||||
rule['ip_protocol'].upper() == params.get(
|
||||
'ip_protocol').upper() and
|
||||
rule.get('from_port') == params.get('from_port') and
|
||||
rule.get('to_port') == params.get('to_port') and
|
||||
rule.get('group', {}).get('name') == params.get('group_name')):
|
||||
return cs.security_group_rules.delete(rule['id'])
|
||||
|
||||
raise exceptions.CommandError(_("Rule not found"))
|
||||
|
|
|
@ -43,9 +43,9 @@ class UsageManager(base.ManagerWithFind):
|
|||
:rtype: list of :class:`Usage`.
|
||||
"""
|
||||
return self._list(
|
||||
"/os-simple-tenant-usage?start=%s&end=%s&detailed=%s" %
|
||||
(start.isoformat(), end.isoformat(), int(bool(detailed))),
|
||||
"tenant_usages")
|
||||
"/os-simple-tenant-usage?start=%s&end=%s&detailed=%s" %
|
||||
(start.isoformat(), end.isoformat(), int(bool(detailed))),
|
||||
"tenant_usages")
|
||||
|
||||
def get(self, tenant_id, start, end):
|
||||
"""
|
||||
|
|
|
@ -29,6 +29,6 @@ class AgentsManager(agents.AgentsManager):
|
|||
|
||||
def _build_update_body(self, version, url, md5hash):
|
||||
return {'agent': {
|
||||
'version': version,
|
||||
'url': url,
|
||||
'md5hash': md5hash}}
|
||||
'version': version,
|
||||
'url': url,
|
||||
'md5hash': md5hash}}
|
||||
|
|
|
@ -45,8 +45,7 @@ class Flavor(base.Resource):
|
|||
:param flavor: The :class:`Flavor` to get extra specs from
|
||||
"""
|
||||
_resp, body = self.manager.api.client.get(
|
||||
"/flavors/%s/flavor-extra-specs" %
|
||||
base.getid(self))
|
||||
"/flavors/%s/flavor-extra-specs" % base.getid(self))
|
||||
return body["extra_specs"]
|
||||
|
||||
def set_keys(self, metadata):
|
||||
|
@ -60,9 +59,8 @@ class Flavor(base.Resource):
|
|||
|
||||
body = {'extra_specs': metadata}
|
||||
return self.manager._create(
|
||||
"/flavors/%s/flavor-extra-specs" %
|
||||
base.getid(self), body, "extra_specs",
|
||||
return_raw=True)
|
||||
"/flavors/%s/flavor-extra-specs" % base.getid(self), body,
|
||||
"extra_specs", return_raw=True)
|
||||
|
||||
def unset_keys(self, keys):
|
||||
"""
|
||||
|
|
|
@ -201,18 +201,18 @@ def _boot(cs, args):
|
|||
config_drive = args.config_drive
|
||||
|
||||
boot_kwargs = dict(
|
||||
meta=meta,
|
||||
files=files,
|
||||
key_name=key_name,
|
||||
min_count=min_count,
|
||||
max_count=max_count,
|
||||
userdata=userdata,
|
||||
availability_zone=availability_zone,
|
||||
security_groups=security_groups,
|
||||
block_device_mapping=block_device_mapping,
|
||||
nics=nics,
|
||||
scheduler_hints=hints,
|
||||
config_drive=config_drive)
|
||||
meta=meta,
|
||||
files=files,
|
||||
key_name=key_name,
|
||||
min_count=min_count,
|
||||
max_count=max_count,
|
||||
userdata=userdata,
|
||||
availability_zone=availability_zone,
|
||||
security_groups=security_groups,
|
||||
block_device_mapping=block_device_mapping,
|
||||
nics=nics,
|
||||
scheduler_hints=hints,
|
||||
config_drive=config_drive)
|
||||
|
||||
return boot_args, boot_kwargs
|
||||
|
||||
|
@ -980,18 +980,18 @@ def do_list(cs, args):
|
|||
if args.flavor:
|
||||
flavorid = _find_flavor(cs, args.flavor).id
|
||||
search_opts = {
|
||||
'all_tenants': args.all_tenants,
|
||||
'reservation_id': args.reservation_id,
|
||||
'ip': args.ip,
|
||||
'ip6': args.ip6,
|
||||
'name': args.name,
|
||||
'image': imageid,
|
||||
'flavor': flavorid,
|
||||
'status': args.status,
|
||||
'tenant_id': args.tenant,
|
||||
'host': args.host,
|
||||
'deleted': args.deleted,
|
||||
'instance_name': args.instance_name}
|
||||
'all_tenants': args.all_tenants,
|
||||
'reservation_id': args.reservation_id,
|
||||
'ip': args.ip,
|
||||
'ip6': args.ip6,
|
||||
'name': args.name,
|
||||
'image': imageid,
|
||||
'flavor': flavorid,
|
||||
'status': args.status,
|
||||
'tenant_id': args.tenant,
|
||||
'host': args.host,
|
||||
'deleted': args.deleted,
|
||||
'instance_name': args.instance_name}
|
||||
|
||||
filters = {'flavor': lambda f: f['id'],
|
||||
'security_groups': utils._format_security_groups}
|
||||
|
@ -1696,8 +1696,7 @@ def do_dns_domains(cs, args):
|
|||
def do_dns_list(cs, args):
|
||||
"""List current DNS entries for domain and ip or domain and name."""
|
||||
if not (args.ip or args.name):
|
||||
raise exceptions.CommandError(
|
||||
"You must specify either --ip or --name")
|
||||
raise exceptions.CommandError("You must specify either --ip or --name")
|
||||
if args.name:
|
||||
entry = cs.dns_entries.get(args.domain, args.name)
|
||||
_print_dns_list([entry])
|
||||
|
@ -1988,11 +1987,10 @@ def do_secgroup_delete_group_rule(cs, args):
|
|||
|
||||
for rule in secgroup.rules:
|
||||
if (rule.get('ip_protocol').upper() == params.get(
|
||||
'ip_protocol').upper() and
|
||||
rule.get('from_port') == params.get('from_port') and
|
||||
rule.get('to_port') == params.get('to_port') and
|
||||
rule.get('group', {}).get('name') ==
|
||||
params.get('group_name')):
|
||||
'ip_protocol').upper() and
|
||||
rule.get('from_port') == params.get('from_port') and
|
||||
rule.get('to_port') == params.get('to_port') and
|
||||
rule.get('group', {}).get('name') == params.get('group_name')):
|
||||
return cs.security_group_rules.delete(rule['id'])
|
||||
|
||||
raise exceptions.CommandError("Rule not found")
|
||||
|
@ -3108,9 +3106,9 @@ def _treeizeAvailabilityZone(zone):
|
|||
copy.deepcopy(zone._info), zone._loaded)
|
||||
az.zone_name = '| |- %s' % svc
|
||||
az.zone_state = '%s %s %s' % (
|
||||
'enabled' if state['active'] else 'disabled',
|
||||
':-)' if state['available'] else 'XXX',
|
||||
state['updated_at'])
|
||||
'enabled' if state['active'] else 'disabled',
|
||||
':-)' if state['available'] else 'XXX',
|
||||
state['updated_at'])
|
||||
az._info['zone_name'] = az.zone_name
|
||||
az._info['zone_state'] = az.zone_state
|
||||
result.append(az)
|
||||
|
|
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,E126,E127,E128,E129,F811,F821,H402,H404,H405,H904
|
||||
ignore = E124,E127,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