Browse Source

Enable check for E126

E126 continuation line over-indented for hanging indent

Change-Id: Id64edce8278d96c1b2d4a6ca536e9fc8fbef478c
Andrey Kurilin 4 years ago
parent
commit
8de2237cc4

+ 1
- 1
novaclient/client.py View File

@@ -378,7 +378,7 @@ class HTTPClient(object):
378 378
                     self._session.close()
379 379
                 self._current_url = service_url
380 380
                 self._logger.debug(
381
-                        "New session created for: (%s)" % service_url)
381
+                    "New session created for: (%s)" % service_url)
382 382
                 self._session = requests.Session()
383 383
                 self._session.mount(service_url,
384 384
                         self._connection_pool.get(service_url))

+ 5
- 5
novaclient/service_catalog.py View File

@@ -72,11 +72,11 @@ class ServiceCatalog(object):
72 72
             endpoints = service['endpoints']
73 73
             for endpoint in endpoints:
74 74
                 # Ignore 1.0 compute endpoints
75
-                if service.get("type") == 'compute' and \
76
-                            endpoint.get('versionId', '2') not in ('1.1', '2'):
75
+                if (service.get("type") == 'compute' and
76
+                        endpoint.get('versionId', '2') not in ('1.1', '2')):
77 77
                     continue
78
-                if not filter_value or \
79
-                        endpoint.get(attr).lower() == filter_value.lower():
78
+                if (not filter_value or
79
+                        endpoint.get(attr).lower() == filter_value.lower()):
80 80
                     endpoint["serviceName"] = service.get("name")
81 81
                     matching_endpoints.append(endpoint)
82 82
 
@@ -84,6 +84,6 @@ class ServiceCatalog(object):
84 84
             raise novaclient.exceptions.EndpointNotFound()
85 85
         elif len(matching_endpoints) > 1:
86 86
             raise novaclient.exceptions.AmbiguousEndpoints(
87
-                    endpoints=matching_endpoints)
87
+                endpoints=matching_endpoints)
88 88
         else:
89 89
             return matching_endpoints[0][endpoint_type]

+ 4
- 4
novaclient/shell.py View File

@@ -355,8 +355,8 @@ class OpenStackComputeShell(object):
355 355
             metavar='<endpoint-type>',
356 356
             default=utils.env('NOVA_ENDPOINT_TYPE',
357 357
                         default=DEFAULT_NOVA_ENDPOINT_TYPE),
358
-            help=_('Defaults to env[NOVA_ENDPOINT_TYPE] or ')
359
-                    + DEFAULT_NOVA_ENDPOINT_TYPE + '.')
358
+            help=(_('Defaults to env[NOVA_ENDPOINT_TYPE] or ')
359
+                  + DEFAULT_NOVA_ENDPOINT_TYPE + '.'))
360 360
         # NOTE(dtroyer): We can't add --endpoint_type here due to argparse
361 361
         #                thinking usage-list --end is ambiguous; but it
362 362
         #                works fine with only --endpoint-type present
@@ -527,7 +527,7 @@ class OpenStackComputeShell(object):
527 527
 
528 528
         # build available subcommands based on version
529 529
         self.extensions = self._discover_extensions(
530
-                options.os_compute_api_version)
530
+            options.os_compute_api_version)
531 531
         self._run_extension_hooks('__pre_parse_args__')
532 532
 
533 533
         # NOTE(dtroyer): Hackery to handle --endpoint_type due to argparse
@@ -539,7 +539,7 @@ class OpenStackComputeShell(object):
539 539
             argv[spot] = '--endpoint-type'
540 540
 
541 541
         subcommand_parser = self.get_subcommand_parser(
542
-                options.os_compute_api_version)
542
+            options.os_compute_api_version)
543 543
         self.parser = subcommand_parser
544 544
 
545 545
         if options.help or not argv:

+ 11
- 11
novaclient/tests/fixture_data/floatingips.py View File

@@ -105,18 +105,18 @@ class DNSFixture(base.Fixture):
105 105
             'dns_entries': [
106 106
                 {
107 107
                     'dns_entry': {
108
-                         'ip': '1.2.3.4',
109
-                         'name': "host1",
110
-                         'type': "A",
111
-                         'domain': 'testdomain'
108
+                        'ip': '1.2.3.4',
109
+                        'name': "host1",
110
+                        'type': "A",
111
+                        'domain': 'testdomain'
112 112
                     }
113 113
                 },
114 114
                 {
115 115
                     'dns_entry': {
116
-                         'ip': '1.2.3.4',
117
-                         'name': "host2",
118
-                         'type': "A",
119
-                         'domain': 'testdomain'
116
+                        'ip': '1.2.3.4',
117
+                        'name': "host2",
118
+                        'type': "A",
119
+                        'domain': 'testdomain'
120 120
                     }
121 121
                 },
122 122
             ]
@@ -182,9 +182,9 @@ class BulkFixture(base.Fixture):
182 182
             interface = params.get('interface', 'defaultInterface')
183 183
             return {
184 184
                 'floating_ips_bulk_create': {
185
-                     'ip_range': '192.168.1.0/30',
186
-                     'pool': pool,
187
-                     'interface': interface
185
+                    'ip_range': '192.168.1.0/30',
186
+                    'pool': pool,
187
+                    'interface': interface
188 188
                 }
189 189
             }
190 190
 

+ 21
- 21
novaclient/tests/test_auth_plugins.py View File

@@ -167,9 +167,9 @@ class DeprecatedAuthPluginTest(utils.TestCase):
167 167
                 return None
168 168
 
169 169
         mock_iter_entry_points.side_effect = lambda _t, name: [
170
-                MockAuthUrlEntrypoint("fakewithauthurl",
171
-                                      "fakewithauthurl",
172
-                                      ["auth_url"])]
170
+            MockAuthUrlEntrypoint("fakewithauthurl",
171
+                                  "fakewithauthurl",
172
+                                  ["auth_url"])]
173 173
 
174 174
         plugin = auth_plugin.DeprecatedAuthPlugin("fakewithauthurl")
175 175
         self.assertRaises(
@@ -192,7 +192,7 @@ class AuthPluginTest(utils.TestCase):
192 192
                 cls._authenticate(auth_url, {"fake": "me"})
193 193
 
194 194
         mock_iter_entry_points.side_effect = lambda _t: [
195
-                MockEntrypoint("fake", "fake", ["FakePlugin"])]
195
+            MockEntrypoint("fake", "fake", ["FakePlugin"])]
196 196
 
197 197
         mock_request.side_effect = mock_http_request()
198 198
 
@@ -207,12 +207,12 @@ class AuthPluginTest(utils.TestCase):
207 207
         token_url = cs.client.auth_url + "/tokens"
208 208
 
209 209
         mock_request.assert_called_with(
210
-                "POST",
211
-                token_url,
212
-                headers=headers,
213
-                data='{"fake": "me"}',
214
-                allow_redirects=True,
215
-                **self.TEST_REQUEST_BASE)
210
+            "POST",
211
+            token_url,
212
+            headers=headers,
213
+            data='{"fake": "me"}',
214
+            allow_redirects=True,
215
+            **self.TEST_REQUEST_BASE)
216 216
 
217 217
     @mock.patch.object(pkg_resources, "iter_entry_points")
218 218
     def test_discover_auth_system_options(self, mock_iter_entry_points):
@@ -231,7 +231,7 @@ class AuthPluginTest(utils.TestCase):
231 231
                 return FakePlugin
232 232
 
233 233
         mock_iter_entry_points.side_effect = lambda _t: [
234
-                MockEntrypoint("fake", "fake", ["FakePlugin"])]
234
+            MockEntrypoint("fake", "fake", ["FakePlugin"])]
235 235
 
236 236
         parser = argparse.ArgumentParser()
237 237
         auth_plugin.discover_auth_systems()
@@ -255,7 +255,7 @@ class AuthPluginTest(utils.TestCase):
255 255
                 return self.opts
256 256
 
257 257
         mock_iter_entry_points.side_effect = lambda _t: [
258
-                MockEntrypoint("fake", "fake", ["FakePlugin"])]
258
+            MockEntrypoint("fake", "fake", ["FakePlugin"])]
259 259
 
260 260
         auth_plugin.discover_auth_systems()
261 261
         plugin = auth_plugin.load_plugin("fake")
@@ -275,7 +275,7 @@ class AuthPluginTest(utils.TestCase):
275 275
                 return "http://faked/v2.0"
276 276
 
277 277
         mock_iter_entry_points.side_effect = lambda _t: [
278
-                MockEntrypoint("fake", "fake", ["FakePlugin"])]
278
+            MockEntrypoint("fake", "fake", ["FakePlugin"])]
279 279
 
280 280
         auth_plugin.discover_auth_systems()
281 281
         plugin = auth_plugin.load_plugin("fake")
@@ -296,15 +296,15 @@ class AuthPluginTest(utils.TestCase):
296 296
             pass
297 297
 
298 298
         mock_iter_entry_points.side_effect = lambda _t: [
299
-                MockEntrypoint("fake", "fake", ["FakePlugin"])]
299
+            MockEntrypoint("fake", "fake", ["FakePlugin"])]
300 300
 
301 301
         auth_plugin.discover_auth_systems()
302 302
         plugin = auth_plugin.load_plugin("fake")
303 303
 
304 304
         self.assertRaises(
305
-                exceptions.EndpointNotFound,
306
-                client.Client, "username", "password", "project_id",
307
-                auth_system="fake", auth_plugin=plugin)
305
+            exceptions.EndpointNotFound,
306
+            client.Client, "username", "password", "project_id",
307
+            auth_system="fake", auth_plugin=plugin)
308 308
 
309 309
     @mock.patch.object(pkg_resources, "iter_entry_points")
310 310
     def test_exception_if_no_url(self, mock_iter_entry_points):
@@ -317,12 +317,12 @@ class AuthPluginTest(utils.TestCase):
317 317
             pass
318 318
 
319 319
         mock_iter_entry_points.side_effect = lambda _t: [
320
-                MockEntrypoint("fake", "fake", ["FakePlugin"])]
320
+            MockEntrypoint("fake", "fake", ["FakePlugin"])]
321 321
 
322 322
         auth_plugin.discover_auth_systems()
323 323
         plugin = auth_plugin.load_plugin("fake")
324 324
 
325 325
         self.assertRaises(
326
-                exceptions.EndpointNotFound,
327
-                client.Client, "username", "password", "project_id",
328
-                auth_system="fake", auth_plugin=plugin)
326
+            exceptions.EndpointNotFound,
327
+            client.Client, "username", "password", "project_id",
328
+            auth_system="fake", auth_plugin=plugin)

+ 10
- 9
novaclient/tests/v1_1/contrib/fakes.py View File

@@ -136,12 +136,13 @@ class FakeHTTPClient(fakes.FakeHTTPClient):
136 136
         return (202, {}, {})
137 137
 
138 138
     def post_os_server_external_events(self, **kw):
139
-        return (200, {}, {'events': [
140
-                    {'name': 'test-event',
141
-                     'status': 'completed',
142
-                     'tag': 'tag',
143
-                     'server_uuid': 'fake-uuid1'},
144
-                    {'name': 'test-event',
145
-                     'status': 'completed',
146
-                     'tag': 'tag',
147
-                     'server_uuid': 'fake-uuid2'}]})
139
+        return (200, {}, {
140
+            'events': [
141
+                {'name': 'test-event',
142
+                 'status': 'completed',
143
+                 'tag': 'tag',
144
+                 'server_uuid': 'fake-uuid1'},
145
+                {'name': 'test-event',
146
+                 'status': 'completed',
147
+                 'tag': 'tag',
148
+                 'server_uuid': 'fake-uuid2'}]})

+ 330
- 309
novaclient/tests/v1_1/fakes.py View File

@@ -126,11 +126,11 @@ class FakeHTTPClient(base_client.HTTPClient):
126 126
         return (202, {}, None)
127 127
 
128 128
     def put_os_agents_1(self, body, **kw):
129
-        return (200, {}, {"agent": {
130
-                           "url": "/yyy/yyyy/yyyy",
131
-                           "version": "8.0",
132
-                           "md5hash": "add6bb58e139be103324d04d82d8f546",
133
-                           'id': 1}})
129
+        return (200, {}, {
130
+            "agent": {"url": "/yyy/yyyy/yyyy",
131
+                      "version": "8.0",
132
+                      "md5hash": "add6bb58e139be103324d04d82d8f546",
133
+                      'id': 1}})
134 134
 
135 135
     #
136 136
     # List all extensions
@@ -1038,20 +1038,19 @@ class FakeHTTPClient(base_client.HTTPClient):
1038 1038
                           self.get_os_keypairs()[2]['keypairs'][0]['keypair']})
1039 1039
 
1040 1040
     def get_os_keypairs(self, *kw):
1041
-        return (200, {}, {"keypairs": [
1042
-                              {"keypair": {
1043
-                                  "public_key": "FAKE_SSH_RSA",
1044
-                                  "private_key": "FAKE_PRIVATE_KEY",
1045
-                                  "user_id":
1046
-                                      "81e373b596d6466e99c4896826abaa46",
1047
-                                  "name": "test",
1048
-                                  "deleted": False,
1049
-                                  "created_at": "2014-04-19T02:16:44.000000",
1050
-                                  "updated_at": "2014-04-19T10:12:3.000000",
1051
-                                  "figerprint": "FAKE_KEYPAIR",
1052
-                                  "deleted_at": None,
1053
-                                  "id": 4}
1054
-                               }]})
1041
+        return (200, {}, {
1042
+            "keypairs": [{"keypair": {
1043
+                "public_key": "FAKE_SSH_RSA",
1044
+                "private_key": "FAKE_PRIVATE_KEY",
1045
+                "user_id": "81e373b596d6466e99c4896826abaa46",
1046
+                "name": "test",
1047
+                "deleted": False,
1048
+                "created_at": "2014-04-19T02:16:44.000000",
1049
+                "updated_at": "2014-04-19T10:12:3.000000",
1050
+                "figerprint": "FAKE_KEYPAIR",
1051
+                "deleted_at": None,
1052
+                "id": 4}}
1053
+            ]})
1055 1054
 
1056 1055
     def delete_os_keypairs_test(self, **kw):
1057 1056
         return (202, {}, None)
@@ -1076,127 +1075,135 @@ class FakeHTTPClient(base_client.HTTPClient):
1076 1075
     #
1077 1076
 
1078 1077
     def get_os_quota_sets_test(self, **kw):
1079
-        return (200, {}, {'quota_set': {
1080
-                      'tenant_id': 'test',
1081
-                      'metadata_items': [],
1082
-                      'injected_file_content_bytes': 1,
1083
-                      'injected_file_path_bytes': 1,
1084
-                      'ram': 1,
1085
-                      'floating_ips': 1,
1086
-                      'instances': 1,
1087
-                      'injected_files': 1,
1088
-                      'cores': 1,
1089
-                      'keypairs': 1,
1090
-                      'security_groups': 1,
1091
-                      'security_group_rules': 1}})
1078
+        return (200, {}, {
1079
+            'quota_set': {
1080
+                'tenant_id': 'test',
1081
+                'metadata_items': [],
1082
+                'injected_file_content_bytes': 1,
1083
+                'injected_file_path_bytes': 1,
1084
+                'ram': 1,
1085
+                'floating_ips': 1,
1086
+                'instances': 1,
1087
+                'injected_files': 1,
1088
+                'cores': 1,
1089
+                'keypairs': 1,
1090
+                'security_groups': 1,
1091
+                'security_group_rules': 1}})
1092 1092
 
1093 1093
     def get_os_quota_sets_tenant_id(self, **kw):
1094
-        return (200, {}, {'quota_set': {
1095
-                      'tenant_id': 'test',
1096
-                      'metadata_items': [],
1097
-                      'injected_file_content_bytes': 1,
1098
-                      'injected_file_path_bytes': 1,
1099
-                      'ram': 1,
1100
-                      'floating_ips': 1,
1101
-                      'instances': 1,
1102
-                      'injected_files': 1,
1103
-                      'cores': 1,
1104
-                      'keypairs': 1,
1105
-                      'security_groups': 1,
1106
-                      'security_group_rules': 1}})
1094
+        return (200, {}, {
1095
+            'quota_set': {
1096
+                'tenant_id': 'test',
1097
+                'metadata_items': [],
1098
+                'injected_file_content_bytes': 1,
1099
+                'injected_file_path_bytes': 1,
1100
+                'ram': 1,
1101
+                'floating_ips': 1,
1102
+                'instances': 1,
1103
+                'injected_files': 1,
1104
+                'cores': 1,
1105
+                'keypairs': 1,
1106
+                'security_groups': 1,
1107
+                'security_group_rules': 1}})
1107 1108
 
1108 1109
     def get_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, **kw):
1109
-        return (200, {}, {'quota_set': {
1110
-                      'tenant_id': '97f4c221bff44578b0300df4ef119353',
1111
-                      'metadata_items': [],
1112
-                      'injected_file_content_bytes': 1,
1113
-                      'injected_file_path_bytes': 1,
1114
-                      'ram': 1,
1115
-                      'floating_ips': 1,
1116
-                      'instances': 1,
1117
-                      'injected_files': 1,
1118
-                      'cores': 1,
1119
-                      'keypairs': 1,
1120
-                      'security_groups': 1,
1121
-                      'security_group_rules': 1}})
1110
+        return (200, {}, {
1111
+            'quota_set': {
1112
+                'tenant_id': '97f4c221bff44578b0300df4ef119353',
1113
+                'metadata_items': [],
1114
+                'injected_file_content_bytes': 1,
1115
+                'injected_file_path_bytes': 1,
1116
+                'ram': 1,
1117
+                'floating_ips': 1,
1118
+                'instances': 1,
1119
+                'injected_files': 1,
1120
+                'cores': 1,
1121
+                'keypairs': 1,
1122
+                'security_groups': 1,
1123
+                'security_group_rules': 1}})
1122 1124
 
1123 1125
     def put_os_quota_sets_97f4c221_bff4_4578_b030_0df4ef119353(self, **kw):
1124
-        return (200, {}, {'quota_set': {
1125
-                      'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
1126
-                      'metadata_items': [],
1127
-                      'injected_file_content_bytes': 1,
1128
-                      'injected_file_path_bytes': 1,
1129
-                      'ram': 1,
1130
-                      'floating_ips': 1,
1131
-                      'instances': 1,
1132
-                      'injected_files': 1,
1133
-                      'cores': 1,
1134
-                      'keypairs': 1,
1135
-                      'security_groups': 1,
1136
-                      'security_group_rules': 1}})
1126
+        return (200, {}, {
1127
+            'quota_set': {
1128
+                'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
1129
+                'metadata_items': [],
1130
+                'injected_file_content_bytes': 1,
1131
+                'injected_file_path_bytes': 1,
1132
+                'ram': 1,
1133
+                'floating_ips': 1,
1134
+                'instances': 1,
1135
+                'injected_files': 1,
1136
+                'cores': 1,
1137
+                'keypairs': 1,
1138
+                'security_groups': 1,
1139
+                'security_group_rules': 1}})
1137 1140
 
1138 1141
     def get_os_quota_sets_97f4c221_bff4_4578_b030_0df4ef119353(self, **kw):
1139
-        return (200, {}, {'quota_set': {
1140
-                      'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
1141
-                      'metadata_items': [],
1142
-                      'injected_file_content_bytes': 1,
1143
-                      'injected_file_path_bytes': 1,
1144
-                      'ram': 1,
1145
-                      'floating_ips': 1,
1146
-                      'instances': 1,
1147
-                      'injected_files': 1,
1148
-                      'cores': 1,
1149
-                      'keypairs': 1,
1150
-                      'security_groups': 1,
1151
-                      'security_group_rules': 1}})
1142
+        return (200, {}, {
1143
+            'quota_set': {
1144
+                'tenant_id': '97f4c221-bff4-4578-b030-0df4ef119353',
1145
+                'metadata_items': [],
1146
+                'injected_file_content_bytes': 1,
1147
+                'injected_file_path_bytes': 1,
1148
+                'ram': 1,
1149
+                'floating_ips': 1,
1150
+                'instances': 1,
1151
+                'injected_files': 1,
1152
+                'cores': 1,
1153
+                'keypairs': 1,
1154
+                'security_groups': 1,
1155
+                'security_group_rules': 1}})
1152 1156
 
1153 1157
     def get_os_quota_sets_97f4c221bff44578b0300df4ef119353_defaults(self):
1154
-        return (200, {}, {'quota_set': {
1155
-                      'tenant_id': 'test',
1156
-                      'metadata_items': [],
1157
-                      'injected_file_content_bytes': 1,
1158
-                      'injected_file_path_bytes': 1,
1159
-                      'ram': 1,
1160
-                      'floating_ips': 1,
1161
-                      'instances': 1,
1162
-                      'injected_files': 1,
1163
-                      'cores': 1,
1164
-                      'keypairs': 1,
1165
-                      'security_groups': 1,
1166
-                      'security_group_rules': 1}})
1158
+        return (200, {}, {
1159
+            'quota_set': {
1160
+                'tenant_id': 'test',
1161
+                'metadata_items': [],
1162
+                'injected_file_content_bytes': 1,
1163
+                'injected_file_path_bytes': 1,
1164
+                'ram': 1,
1165
+                'floating_ips': 1,
1166
+                'instances': 1,
1167
+                'injected_files': 1,
1168
+                'cores': 1,
1169
+                'keypairs': 1,
1170
+                'security_groups': 1,
1171
+                'security_group_rules': 1}})
1167 1172
 
1168 1173
     def get_os_quota_sets_tenant_id_defaults(self):
1169
-        return (200, {}, {'quota_set': {
1170
-                      'tenant_id': 'test',
1171
-                      'metadata_items': [],
1172
-                      'injected_file_content_bytes': 1,
1173
-                      'injected_file_path_bytes': 1,
1174
-                      'ram': 1,
1175
-                      'floating_ips': 1,
1176
-                      'instances': 1,
1177
-                      'injected_files': 1,
1178
-                      'cores': 1,
1179
-                      'keypairs': 1,
1180
-                      'security_groups': 1,
1181
-                      'security_group_rules': 1}})
1174
+        return (200, {}, {
1175
+            'quota_set': {
1176
+                'tenant_id': 'test',
1177
+                'metadata_items': [],
1178
+                'injected_file_content_bytes': 1,
1179
+                'injected_file_path_bytes': 1,
1180
+                'ram': 1,
1181
+                'floating_ips': 1,
1182
+                'instances': 1,
1183
+                'injected_files': 1,
1184
+                'cores': 1,
1185
+                'keypairs': 1,
1186
+                'security_groups': 1,
1187
+                'security_group_rules': 1}})
1182 1188
 
1183 1189
     def put_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, body, **kw):
1184 1190
         assert list(body) == ['quota_set']
1185 1191
         fakes.assert_has_keys(body['quota_set'],
1186 1192
                               required=['tenant_id'])
1187
-        return (200, {}, {'quota_set': {
1188
-                      'tenant_id': '97f4c221bff44578b0300df4ef119353',
1189
-                      'metadata_items': [],
1190
-                      'injected_file_content_bytes': 1,
1191
-                      'injected_file_path_bytes': 1,
1192
-                      'ram': 1,
1193
-                      'floating_ips': 1,
1194
-                      'instances': 1,
1195
-                      'injected_files': 1,
1196
-                      'cores': 1,
1197
-                      'keypairs': 1,
1198
-                      'security_groups': 1,
1199
-                      'security_group_rules': 1}})
1193
+        return (200, {}, {
1194
+            'quota_set': {
1195
+                'tenant_id': '97f4c221bff44578b0300df4ef119353',
1196
+                'metadata_items': [],
1197
+                'injected_file_content_bytes': 1,
1198
+                'injected_file_path_bytes': 1,
1199
+                'ram': 1,
1200
+                'floating_ips': 1,
1201
+                'instances': 1,
1202
+                'injected_files': 1,
1203
+                'cores': 1,
1204
+                'keypairs': 1,
1205
+                'security_groups': 1,
1206
+                'security_group_rules': 1}})
1200 1207
 
1201 1208
     def delete_os_quota_sets_test(self, **kw):
1202 1209
         return (202, {}, {})
@@ -1209,50 +1216,53 @@ class FakeHTTPClient(base_client.HTTPClient):
1209 1216
     #
1210 1217
 
1211 1218
     def get_os_quota_class_sets_test(self, **kw):
1212
-        return (200, {}, {'quota_class_set': {
1213
-                      'id': 'test',
1214
-                      'metadata_items': 1,
1215
-                      'injected_file_content_bytes': 1,
1216
-                      'injected_file_path_bytes': 1,
1217
-                      'ram': 1,
1218
-                      'floating_ips': 1,
1219
-                      'instances': 1,
1220
-                      'injected_files': 1,
1221
-                      'cores': 1,
1222
-                      'key_pairs': 1,
1223
-                      'security_groups': 1,
1224
-                      'security_group_rules': 1}})
1219
+        return (200, {}, {
1220
+            'quota_class_set': {
1221
+                'id': 'test',
1222
+                'metadata_items': 1,
1223
+                'injected_file_content_bytes': 1,
1224
+                'injected_file_path_bytes': 1,
1225
+                'ram': 1,
1226
+                'floating_ips': 1,
1227
+                'instances': 1,
1228
+                'injected_files': 1,
1229
+                'cores': 1,
1230
+                'key_pairs': 1,
1231
+                'security_groups': 1,
1232
+                'security_group_rules': 1}})
1225 1233
 
1226 1234
     def put_os_quota_class_sets_test(self, body, **kw):
1227 1235
         assert list(body) == ['quota_class_set']
1228
-        return (200, {}, {'quota_class_set': {
1229
-                      'metadata_items': 1,
1230
-                      'injected_file_content_bytes': 1,
1231
-                      'injected_file_path_bytes': 1,
1232
-                      'ram': 1,
1233
-                      'floating_ips': 1,
1234
-                      'instances': 1,
1235
-                      'injected_files': 1,
1236
-                      'cores': 1,
1237
-                      'key_pairs': 1,
1238
-                      'security_groups': 1,
1239
-                      'security_group_rules': 1}})
1236
+        return (200, {}, {
1237
+            'quota_class_set': {
1238
+                'metadata_items': 1,
1239
+                'injected_file_content_bytes': 1,
1240
+                'injected_file_path_bytes': 1,
1241
+                'ram': 1,
1242
+                'floating_ips': 1,
1243
+                'instances': 1,
1244
+                'injected_files': 1,
1245
+                'cores': 1,
1246
+                'key_pairs': 1,
1247
+                'security_groups': 1,
1248
+                'security_group_rules': 1}})
1240 1249
 
1241 1250
     def put_os_quota_class_sets_97f4c221bff44578b0300df4ef119353(self,
1242 1251
                                                             body, **kw):
1243 1252
         assert list(body) == ['quota_class_set']
1244
-        return (200, {}, {'quota_class_set': {
1245
-                      'metadata_items': 1,
1246
-                      'injected_file_content_bytes': 1,
1247
-                      'injected_file_path_bytes': 1,
1248
-                      'ram': 1,
1249
-                      'floating_ips': 1,
1250
-                      'instances': 1,
1251
-                      'injected_files': 1,
1252
-                      'cores': 1,
1253
-                      'key_pairs': 1,
1254
-                      'security_groups': 1,
1255
-                      'security_group_rules': 1}})
1253
+        return (200, {}, {
1254
+            'quota_class_set': {
1255
+                'metadata_items': 1,
1256
+                'injected_file_content_bytes': 1,
1257
+                'injected_file_path_bytes': 1,
1258
+                'ram': 1,
1259
+                'floating_ips': 1,
1260
+                'instances': 1,
1261
+                'injected_files': 1,
1262
+                'cores': 1,
1263
+                'key_pairs': 1,
1264
+                'security_groups': 1,
1265
+                'security_group_rules': 1}})
1256 1266
 
1257 1267
     #
1258 1268
     # Security Groups
@@ -1669,110 +1679,116 @@ class FakeHTTPClient(base_client.HTTPClient):
1669 1679
         return (200, {}, result)
1670 1680
 
1671 1681
     def get_os_hypervisors(self, **kw):
1672
-        return (200, {}, {"hypervisors": [
1673
-                    {'id': 1234, 'hypervisor_hostname': 'hyper1'},
1674
-                    {'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
1682
+        return (200, {}, {
1683
+            "hypervisors": [
1684
+                {'id': 1234, 'hypervisor_hostname': 'hyper1'},
1685
+                {'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
1675 1686
 
1676 1687
     def get_os_hypervisors_detail(self, **kw):
1677
-        return (200, {}, {"hypervisors": [
1678
-                    {'id': 1234,
1679
-                     'service': {'id': 1, 'host': 'compute1'},
1680
-                     'vcpus': 4,
1681
-                     'memory_mb': 10 * 1024,
1682
-                     'local_gb': 250,
1683
-                     'vcpus_used': 2,
1684
-                     'memory_mb_used': 5 * 1024,
1685
-                     'local_gb_used': 125,
1686
-                     'hypervisor_type': "xen",
1687
-                     'hypervisor_version': 3,
1688
-                     'hypervisor_hostname': "hyper1",
1689
-                     'free_ram_mb': 5 * 1024,
1690
-                     'free_disk_gb': 125,
1691
-                     'current_workload': 2,
1692
-                     'running_vms': 2,
1693
-                     'cpu_info': 'cpu_info',
1694
-                     'disk_available_least': 100},
1695
-                    {'id': 2,
1696
-                     'service': {'id': 2, 'host': "compute2"},
1697
-                     'vcpus': 4,
1698
-                     'memory_mb': 10 * 1024,
1699
-                     'local_gb': 250,
1700
-                     'vcpus_used': 2,
1701
-                     'memory_mb_used': 5 * 1024,
1702
-                     'local_gb_used': 125,
1703
-                     'hypervisor_type': "xen",
1704
-                     'hypervisor_version': 3,
1705
-                     'hypervisor_hostname': "hyper2",
1706
-                     'free_ram_mb': 5 * 1024,
1707
-                     'free_disk_gb': 125,
1708
-                     'current_workload': 2,
1709
-                     'running_vms': 2,
1710
-                     'cpu_info': 'cpu_info',
1711
-                     'disk_available_least': 100}
1712
-        ]})
1688
+        return (200, {}, {
1689
+            "hypervisors": [
1690
+                {'id': 1234,
1691
+                 'service': {'id': 1, 'host': 'compute1'},
1692
+                 'vcpus': 4,
1693
+                 'memory_mb': 10 * 1024,
1694
+                 'local_gb': 250,
1695
+                 'vcpus_used': 2,
1696
+                 'memory_mb_used': 5 * 1024,
1697
+                 'local_gb_used': 125,
1698
+                 'hypervisor_type': "xen",
1699
+                 'hypervisor_version': 3,
1700
+                 'hypervisor_hostname': "hyper1",
1701
+                 'free_ram_mb': 5 * 1024,
1702
+                 'free_disk_gb': 125,
1703
+                 'current_workload': 2,
1704
+                 'running_vms': 2,
1705
+                 'cpu_info': 'cpu_info',
1706
+                 'disk_available_least': 100},
1707
+                {'id': 2,
1708
+                 'service': {'id': 2, 'host': "compute2"},
1709
+                 'vcpus': 4,
1710
+                 'memory_mb': 10 * 1024,
1711
+                 'local_gb': 250,
1712
+                 'vcpus_used': 2,
1713
+                 'memory_mb_used': 5 * 1024,
1714
+                 'local_gb_used': 125,
1715
+                 'hypervisor_type': "xen",
1716
+                 'hypervisor_version': 3,
1717
+                 'hypervisor_hostname': "hyper2",
1718
+                 'free_ram_mb': 5 * 1024,
1719
+                 'free_disk_gb': 125,
1720
+                 'current_workload': 2,
1721
+                 'running_vms': 2,
1722
+                 'cpu_info': 'cpu_info',
1723
+                 'disk_available_least': 100}]
1724
+        })
1713 1725
 
1714 1726
     def get_os_hypervisors_statistics(self, **kw):
1715
-        return (200, {}, {"hypervisor_statistics": {
1716
-                    'count': 2,
1717
-                    'vcpus': 8,
1718
-                    'memory_mb': 20 * 1024,
1719
-                    'local_gb': 500,
1720
-                    'vcpus_used': 4,
1721
-                    'memory_mb_used': 10 * 1024,
1722
-                    'local_gb_used': 250,
1723
-                    'free_ram_mb': 10 * 1024,
1724
-                    'free_disk_gb': 250,
1725
-                    'current_workload': 4,
1726
-                    'running_vms': 4,
1727
-                    'disk_available_least': 200,
1728
-        }})
1727
+        return (200, {}, {
1728
+            "hypervisor_statistics": {
1729
+                'count': 2,
1730
+                'vcpus': 8,
1731
+                'memory_mb': 20 * 1024,
1732
+                'local_gb': 500,
1733
+                'vcpus_used': 4,
1734
+                'memory_mb_used': 10 * 1024,
1735
+                'local_gb_used': 250,
1736
+                'free_ram_mb': 10 * 1024,
1737
+                'free_disk_gb': 250,
1738
+                'current_workload': 4,
1739
+                'running_vms': 4,
1740
+                'disk_available_least': 200}
1741
+        })
1729 1742
 
1730 1743
     def get_os_hypervisors_hyper_search(self, **kw):
1731
-        return (200, {}, {'hypervisors': [
1732
-                    {'id': 1234, 'hypervisor_hostname': 'hyper1'},
1733
-                    {'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
1744
+        return (200, {}, {
1745
+            'hypervisors': [
1746
+                {'id': 1234, 'hypervisor_hostname': 'hyper1'},
1747
+                {'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
1734 1748
 
1735 1749
     def get_os_hypervisors_hyper_servers(self, **kw):
1736
-        return (200, {}, {'hypervisors': [
1737
-                    {'id': 1234,
1738
-                     'hypervisor_hostname': 'hyper1',
1739
-                     'servers': [
1740
-                            {'name': 'inst1', 'uuid': 'uuid1'},
1741
-                            {'name': 'inst2', 'uuid': 'uuid2'}]},
1742
-                    {'id': 5678,
1743
-                     'hypervisor_hostname': 'hyper2',
1744
-                     'servers': [
1745
-                            {'name': 'inst3', 'uuid': 'uuid3'},
1746
-                            {'name': 'inst4', 'uuid': 'uuid4'}]}
1747
-        ]})
1750
+        return (200, {}, {
1751
+            'hypervisors': [
1752
+                {'id': 1234,
1753
+                 'hypervisor_hostname': 'hyper1',
1754
+                 'servers': [
1755
+                     {'name': 'inst1', 'uuid': 'uuid1'},
1756
+                     {'name': 'inst2', 'uuid': 'uuid2'}]},
1757
+                {'id': 5678,
1758
+                 'hypervisor_hostname': 'hyper2',
1759
+                 'servers': [
1760
+                     {'name': 'inst3', 'uuid': 'uuid3'},
1761
+                     {'name': 'inst4', 'uuid': 'uuid4'}]}]
1762
+        })
1748 1763
 
1749 1764
     def get_os_hypervisors_hyper_no_servers_servers(self, **kw):
1750 1765
         return (200, {}, {'hypervisors':
1751 1766
                           [{'id': 1234, 'hypervisor_hostname': 'hyper1'}]})
1752 1767
 
1753 1768
     def get_os_hypervisors_1234(self, **kw):
1754
-        return (200, {}, {'hypervisor':
1755
-                          {'id': 1234,
1756
-                           'service': {'id': 1, 'host': 'compute1'},
1757
-                           'vcpus': 4,
1758
-                           'memory_mb': 10 * 1024,
1759
-                           'local_gb': 250,
1760
-                           'vcpus_used': 2,
1761
-                           'memory_mb_used': 5 * 1024,
1762
-                           'local_gb_used': 125,
1763
-                           'hypervisor_type': "xen",
1764
-                           'hypervisor_version': 3,
1765
-                           'hypervisor_hostname': "hyper1",
1766
-                           'free_ram_mb': 5 * 1024,
1767
-                           'free_disk_gb': 125,
1768
-                           'current_workload': 2,
1769
-                           'running_vms': 2,
1770
-                           'cpu_info': 'cpu_info',
1771
-                           'disk_available_least': 100}})
1769
+        return (200, {}, {
1770
+            'hypervisor':
1771
+                {'id': 1234,
1772
+                 'service': {'id': 1, 'host': 'compute1'},
1773
+                 'vcpus': 4,
1774
+                 'memory_mb': 10 * 1024,
1775
+                 'local_gb': 250,
1776
+                 'vcpus_used': 2,
1777
+                 'memory_mb_used': 5 * 1024,
1778
+                 'local_gb_used': 125,
1779
+                 'hypervisor_type': "xen",
1780
+                 'hypervisor_version': 3,
1781
+                 'hypervisor_hostname': "hyper1",
1782
+                 'free_ram_mb': 5 * 1024,
1783
+                 'free_disk_gb': 125,
1784
+                 'current_workload': 2,
1785
+                 'running_vms': 2,
1786
+                 'cpu_info': 'cpu_info',
1787
+                 'disk_available_least': 100}})
1772 1788
 
1773 1789
     def get_os_hypervisors_1234_uptime(self, **kw):
1774
-        return (200, {}, {'hypervisor':
1775
-                          {'id': 1234,
1790
+        return (200, {}, {
1791
+            'hypervisor': {'id': 1234,
1776 1792
                            'hypervisor_hostname': "hyper1",
1777 1793
                            'uptime': "fake uptime"}})
1778 1794
 
@@ -1839,13 +1855,15 @@ class FakeHTTPClient(base_client.HTTPClient):
1839 1855
         return (202, {}, None)
1840 1856
 
1841 1857
     def get_os_availability_zone(self, **kw):
1842
-        return (200, {}, {"availabilityZoneInfo": [
1843
-                              {"zoneName": "zone-1",
1844
-                               "zoneState": {"available": True},
1845
-                               "hosts": None},
1846
-                              {"zoneName": "zone-2",
1847
-                               "zoneState": {"available": False},
1848
-                               "hosts": None}]})
1858
+        return (200, {}, {
1859
+            "availabilityZoneInfo": [
1860
+                {"zoneName": "zone-1",
1861
+                 "zoneState": {"available": True},
1862
+                 "hosts": None},
1863
+                {"zoneName": "zone-2",
1864
+                 "zoneState": {"available": False},
1865
+                 "hosts": None}]
1866
+        })
1849 1867
 
1850 1868
     def get_os_availability_zone_detail(self, **kw):
1851 1869
         return (200, {}, {
@@ -1879,19 +1897,21 @@ class FakeHTTPClient(base_client.HTTPClient):
1879 1897
                  "hosts": None}]})
1880 1898
 
1881 1899
     def get_servers_1234_os_interface(self, **kw):
1882
-        return (200, {}, {"interfaceAttachments": [
1883
-                             {"port_state": "ACTIVE",
1884
-                              "net_id": "net-id-1",
1885
-                              "port_id": "port-id-1",
1886
-                              "mac_address": "aa:bb:cc:dd:ee:ff",
1887
-                              "fixed_ips": [{"ip_address": "1.2.3.4"}],
1888
-                              },
1889
-                             {"port_state": "ACTIVE",
1890
-                              "net_id": "net-id-1",
1891
-                              "port_id": "port-id-1",
1892
-                              "mac_address": "aa:bb:cc:dd:ee:ff",
1893
-                              "fixed_ips": [{"ip_address": "1.2.3.4"}],
1894
-                              }]})
1900
+        return (200, {}, {
1901
+            "interfaceAttachments": [
1902
+                {"port_state": "ACTIVE",
1903
+                 "net_id": "net-id-1",
1904
+                 "port_id": "port-id-1",
1905
+                 "mac_address": "aa:bb:cc:dd:ee:ff",
1906
+                 "fixed_ips": [{"ip_address": "1.2.3.4"}],
1907
+                 },
1908
+                {"port_state": "ACTIVE",
1909
+                 "net_id": "net-id-1",
1910
+                 "port_id": "port-id-1",
1911
+                 "mac_address": "aa:bb:cc:dd:ee:ff",
1912
+                 "fixed_ips": [{"ip_address": "1.2.3.4"}],
1913
+                 }]
1914
+        })
1895 1915
 
1896 1916
     def post_servers_1234_os_interface(self, **kw):
1897 1917
         return (200, {}, {'interfaceAttachment': {}})
@@ -1989,7 +2009,8 @@ class FakeHTTPClient(base_client.HTTPClient):
1989 2009
         return (200, {}, {})
1990 2010
 
1991 2011
     def post_servers_1234_os_volume_attachments(self, **kw):
1992
-        return (200, {}, {"volumeAttachment":
2012
+        return (200, {}, {
2013
+            "volumeAttachment":
1993 2014
                 {"device": "/dev/vdb",
1994 2015
                  "volumeId": 2}})
1995 2016
 
@@ -1997,38 +2018,37 @@ class FakeHTTPClient(base_client.HTTPClient):
1997 2018
         return (200, {}, {"volumeAttachment": {"volumeId": 2}})
1998 2019
 
1999 2020
     def get_servers_1234_os_volume_attachments(self, **kw):
2000
-        return (200, {}, {"volumeAttachments": [
2001
-                            {"display_name": "Work",
2002
-                             "display_description": "volume for work",
2003
-                             "status": "ATTACHED",
2004
-                             "id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
2005
-                             "created_at": "2011-09-09T00:00:00Z",
2006
-                             "attached": "2011-11-11T00:00:00Z",
2007
-                             "size": 1024,
2008
-                             "attachments": [
2009
-                                 {"id": "3333",
2010
-                                  "links": ''}],
2011
-                             "metadata": {}}]})
2021
+        return (200, {}, {
2022
+            "volumeAttachments": [
2023
+                {"display_name": "Work",
2024
+                 "display_description": "volume for work",
2025
+                 "status": "ATTACHED",
2026
+                 "id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
2027
+                 "created_at": "2011-09-09T00:00:00Z",
2028
+                 "attached": "2011-11-11T00:00:00Z",
2029
+                 "size": 1024,
2030
+                 "attachments": [{"id": "3333", "links": ''}],
2031
+                 "metadata": {}}]})
2012 2032
 
2013 2033
     def get_servers_1234_os_volume_attachments_Work(self, **kw):
2014
-        return (200, {}, {"volumeAttachment":
2015
-                            {"display_name": "Work",
2016
-                             "display_description": "volume for work",
2017
-                             "status": "ATTACHED",
2018
-                             "id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
2019
-                             "created_at": "2011-09-09T00:00:00Z",
2020
-                             "attached": "2011-11-11T00:00:00Z",
2021
-                             "size": 1024,
2022
-                             "attachments": [
2023
-                                 {"id": "3333",
2024
-                                  "links": ''}],
2025
-                             "metadata": {}}})
2034
+        return (200, {}, {
2035
+            "volumeAttachment":
2036
+                {"display_name": "Work",
2037
+                 "display_description": "volume for work",
2038
+                 "status": "ATTACHED",
2039
+                 "id": "15e59938-07d5-11e1-90e3-e3dffe0c5983",
2040
+                 "created_at": "2011-09-09T00:00:00Z",
2041
+                 "attached": "2011-11-11T00:00:00Z",
2042
+                 "size": 1024,
2043
+                 "attachments": [{"id": "3333", "links": ''}],
2044
+                 "metadata": {}}})
2026 2045
 
2027 2046
     def delete_servers_1234_os_volume_attachments_Work(self, **kw):
2028 2047
         return (200, {}, {})
2029 2048
 
2030 2049
     def get_servers_1234_os_instance_actions(self, **kw):
2031
-        return (200, {}, {"instanceActions":
2050
+        return (200, {}, {
2051
+            "instanceActions":
2032 2052
                 [{"instance_uuid": "1234",
2033 2053
                   "user_id": "b968c25e04ab405f9fe4e6ca54cce9a5",
2034 2054
                   "start_time": "2013-03-25T13:45:09.000000",
@@ -2038,7 +2058,8 @@ class FakeHTTPClient(base_client.HTTPClient):
2038 2058
                   "project_id": "04019601fe3648c0abd4f4abfb9e6106"}]})
2039 2059
 
2040 2060
     def get_servers_1234_os_instance_actions_req_abcde12345(self, **kw):
2041
-        return (200, {}, {"instanceAction":
2061
+        return (200, {}, {
2062
+            "instanceAction":
2042 2063
                 {"instance_uuid": "1234",
2043 2064
                  "user_id": "b968c25e04ab405f9fe4e6ca54cce9a5",
2044 2065
                  "start_time": "2013-03-25T13:45:09.000000",
@@ -2061,18 +2082,18 @@ class FakeHTTPClient(base_client.HTTPClient):
2061 2082
 
2062 2083
     def get_os_cells_child_cell(self, **kw):
2063 2084
         cell = {'cell': {
2064
-                    'username': 'cell1_user',
2065
-                    'name': 'cell1',
2066
-                    'rpc_host': '10.0.1.10',
2067
-                    'info': {
2068
-                        'username': 'cell1_user',
2069
-                        'rpc_host': '10.0.1.10',
2070
-                        'type': 'child',
2071
-                        'name': 'cell1',
2072
-                        'rpc_port': 5673},
2073
-                    'type': 'child',
2074
-                    'rpc_port': 5673,
2075
-                    'loaded': True
2085
+            'username': 'cell1_user',
2086
+            'name': 'cell1',
2087
+            'rpc_host': '10.0.1.10',
2088
+            'info': {
2089
+                'username': 'cell1_user',
2090
+                'rpc_host': '10.0.1.10',
2091
+                'type': 'child',
2092
+                'name': 'cell1',
2093
+                'rpc_port': 5673},
2094
+            'type': 'child',
2095
+            'rpc_port': 5673,
2096
+            'loaded': True
2076 2097
         }}
2077 2098
         return (200, {}, cell)
2078 2099
 
@@ -2107,8 +2128,8 @@ class FakeHTTPClient(base_client.HTTPClient):
2107 2128
 
2108 2129
     def post_os_server_external_events(self, **kw):
2109 2130
         return (200, {}, {'events': [
2110
-                    {'name': 'network-changed',
2111
-                     'server_uuid': '1234'}]})
2131
+            {'name': 'network-changed',
2132
+             'server_uuid': '1234'}]})
2112 2133
 
2113 2134
     #
2114 2135
     # Server Groups

+ 6
- 6
novaclient/tests/v1_1/test_agents.py View File

@@ -77,12 +77,12 @@ class AgentsTest(utils.FixturedTestCase):
77 77
                               'add6bb58e139be103324d04d82d8f546',
78 78
                               'xen')
79 79
         body = {'agent': {
80
-                        'url': '/xxx/xxx/xxx',
81
-                        'hypervisor': 'xen',
82
-                        'md5hash': 'add6bb58e139be103324d04d82d8f546',
83
-                        'version': '7.0',
84
-                        'architecture': 'x86',
85
-                        'os': 'win'}}
80
+            'url': '/xxx/xxx/xxx',
81
+            'hypervisor': 'xen',
82
+            'md5hash': 'add6bb58e139be103324d04d82d8f546',
83
+            'version': '7.0',
84
+            'architecture': 'x86',
85
+            'os': 'win'}}
86 86
         self.assert_called('POST', '/os-agents', body)
87 87
         self.assertEqual(1, ag._info.copy()['id'])
88 88
 

+ 46
- 44
novaclient/tests/v3/fakes.py View File

@@ -152,19 +152,20 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
152 152
         fakes_v1_1.FakeHTTPClient.delete_servers_1234_os_interface_port_id)
153 153
 
154 154
     def get_servers_1234_os_attach_interfaces(self, **kw):
155
-        return (200, {}, {"interface_attachments": [
156
-                             {"port_state": "ACTIVE",
157
-                              "net_id": "net-id-1",
158
-                              "port_id": "port-id-1",
159
-                              "mac_address": "aa:bb:cc:dd:ee:ff",
160
-                              "fixed_ips": [{"ip_address": "1.2.3.4"}],
161
-                              },
162
-                             {"port_state": "ACTIVE",
163
-                              "net_id": "net-id-1",
164
-                              "port_id": "port-id-1",
165
-                              "mac_address": "aa:bb:cc:dd:ee:ff",
166
-                              "fixed_ips": [{"ip_address": "1.2.3.4"}],
167
-                              }]})
155
+        return (200, {}, {
156
+            "interface_attachments": [
157
+                {"port_state": "ACTIVE",
158
+                 "net_id": "net-id-1",
159
+                 "port_id": "port-id-1",
160
+                 "mac_address": "aa:bb:cc:dd:ee:ff",
161
+                 "fixed_ips": [{"ip_address": "1.2.3.4"}],
162
+                 },
163
+                {"port_state": "ACTIVE",
164
+                 "net_id": "net-id-1",
165
+                 "port_id": "port-id-1",
166
+                 "mac_address": "aa:bb:cc:dd:ee:ff",
167
+                 "fixed_ips": [{"ip_address": "1.2.3.4"}]}]
168
+        })
168 169
 
169 170
     def post_servers_1234_os_attach_interfaces(self, **kw):
170 171
         return (200, {}, {'interface_attachment': {}})
@@ -263,13 +264,12 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
263 264
     # Availability Zones
264 265
     #
265 266
     def get_os_availability_zone(self, **kw):
266
-        return (200, {}, {"availability_zone_info": [
267
-                              {"zone_name": "zone-1",
268
-                               "zone_state": {"available": True},
269
-                               "hosts": None},
270
-                              {"zone_name": "zone-2",
271
-                               "zone_state": {"available": False},
272
-                               "hosts": None}]})
267
+        return (200, {}, {
268
+            "availability_zone_info": [
269
+                {"zone_name": "zone-1", "zone_state": {"available": True},
270
+                 "hosts": None},
271
+                {"zone_name": "zone-2", "zone_state": {"available": False},
272
+                 "hosts": None}]})
273 273
 
274 274
     def get_os_availability_zone_detail(self, **kw):
275 275
         return (200, {}, {
@@ -308,21 +308,22 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
308 308
     #
309 309
     def put_os_quota_sets_97f4c221bff44578b0300df4ef119353(self, body, **kw):
310 310
         assert list(body) == ['quota_set']
311
-        return (200, {}, {'quota_set': {
312
-                      'tenant_id': '97f4c221bff44578b0300df4ef119353',
313
-                      'metadata_items': [],
314
-                      'injected_file_content_bytes': 1,
315
-                      'injected_file_path_bytes': 1,
316
-                      'ram': 1,
317
-                      'floating_ips': 1,
318
-                      'instances': 1,
319
-                      'injected_files': 1,
320
-                      'cores': 1,
321
-                      'keypairs': 1,
322
-                      'security_groups': 1,
323
-                      'security_group_rules': 1,
324
-                      'server_groups': 1,
325
-                      'server_group_members': 1}})
311
+        return (200, {}, {
312
+            'quota_set': {
313
+                'tenant_id': '97f4c221bff44578b0300df4ef119353',
314
+                'metadata_items': [],
315
+                'injected_file_content_bytes': 1,
316
+                'injected_file_path_bytes': 1,
317
+                'ram': 1,
318
+                'floating_ips': 1,
319
+                'instances': 1,
320
+                'injected_files': 1,
321
+                'cores': 1,
322
+                'keypairs': 1,
323
+                'security_groups': 1,
324
+                'security_group_rules': 1,
325
+                'server_groups': 1,
326
+                'server_group_members': 1}})
326 327
 
327 328
     def get_os_quota_sets_test_detail(self, **kw):
328 329
         return (200, {}, {'quota_set': {
@@ -337,17 +338,18 @@ class FakeHTTPClient(fakes_v1_1.FakeHTTPClient):
337 338
         if kw['query'] == 'hyper1':
338 339
             return (200, {}, {'hypervisors': [
339 340
                 {'id': 1234, 'hypervisor_hostname': 'hyper1'}]})
340
-        return (200, {}, {'hypervisors': [
341
-                    {'id': 1234, 'hypervisor_hostname': 'hyper1'},
342
-                    {'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
341
+        return (200, {}, {
342
+            'hypervisors': [
343
+                {'id': 1234, 'hypervisor_hostname': 'hyper1'},
344
+                {'id': 5678, 'hypervisor_hostname': 'hyper2'}]})
343 345
 
344 346
     def get_os_hypervisors_1234_servers(self, **kw):
345
-        return (200, {}, {'hypervisor':
346
-                    {'id': 1234,
347
-                     'hypervisor_hostname': 'hyper1',
348
-                     'servers': [
349
-                            {'name': 'inst1', 'id': 'uuid1'},
350
-                            {'name': 'inst2', 'id': 'uuid2'}]}})
347
+        return (200, {}, {
348
+            'hypervisor':
349
+                {'id': 1234, 'hypervisor_hostname': 'hyper1',
350
+                 'servers': [
351
+                     {'name': 'inst1', 'id': 'uuid1'},
352
+                     {'name': 'inst2', 'id': 'uuid2'}]}})
351 353
 
352 354
     #
353 355
     # Keypairs

+ 3
- 3
novaclient/utils.py View File

@@ -224,9 +224,9 @@ def find_resource(manager, name_or_id, **find_args):
224 224
             kwargs.update(find_args)
225 225
             return manager.find(**kwargs)
226 226
         except exceptions.NotFound:
227
-            msg = _("No %(class)s with a name or ID of '%(name)s' exists.") % \
228
-                  {'class': manager.resource_class.__name__.lower(),
229
-                   'name': name_or_id}
227
+            msg = (_("No %(class)s with a name or ID of '%(name)s' exists.") %
228
+                   {'class': manager.resource_class.__name__.lower(),
229
+                    'name': name_or_id})
230 230
             raise exceptions.CommandError(msg)
231 231
     except exceptions.NoUniqueMatch:
232 232
         msg = (_("Multiple %(class)s matches found for '%(name)s', use an ID "

+ 9
- 11
novaclient/v1_1/agents.py View File

@@ -41,10 +41,9 @@ class AgentsManager(base.ManagerWithFind):
41 41
         return self._list(url, "agents")
42 42
 
43 43
     def _build_update_body(self, version, url, md5hash):
44
-        return {'para': {
45
-                       'version': version,
46
-                       'url': url,
47
-                       'md5hash': md5hash}}
44
+        return {'para': {'version': version,
45
+                         'url': url,
46
+                         'md5hash': md5hash}}
48 47
 
49 48
     def update(self, id, version,
50 49
                url, md5hash):
@@ -55,13 +54,12 @@ class AgentsManager(base.ManagerWithFind):
55 54
     def create(self, os, architecture, version,
56 55
                url, md5hash, hypervisor):
57 56
         """Create a new agent build."""
58
-        body = {'agent': {
59
-                        'hypervisor': hypervisor,
60
-                        'os': os,
61
-                        'architecture': architecture,
62
-                        'version': version,
63
-                        'url': url,
64
-                        'md5hash': md5hash}}
57
+        body = {'agent': {'hypervisor': hypervisor,
58
+                          'os': os,
59
+                          'architecture': architecture,
60
+                          'version': version,
61
+                          'url': url,
62
+                          'md5hash': md5hash}}
65 63
         return self._create('/os-agents', body, 'agent')
66 64
 
67 65
     def delete(self, id):

+ 3
- 3
novaclient/v1_1/certs.py View File

@@ -24,9 +24,9 @@ from novaclient import base
24 24
 
25 25
 class Certificate(base.Resource):
26 26
     def __repr__(self):
27
-        return "<Certificate: private_key=[%s bytes] data=[%s bytes]>" % \
28
-                        (len(self.private_key) if self.private_key else 0,
29
-                         len(self.data))
27
+        return ("<Certificate: private_key=[%s bytes] data=[%s bytes]>" %
28
+                (len(self.private_key) if self.private_key else 0,
29
+                 len(self.data)))
30 30
 
31 31
 
32 32
 class CertificateManager(base.Manager):

+ 1
- 1
novaclient/v1_1/contrib/assisted_volume_snapshots.py View File

@@ -42,7 +42,7 @@ class AssistedSnapshotManager(base.Manager):
42 42
 
43 43
     def delete(self, snapshot, delete_info):
44 44
         self._delete("/os-assisted-volume-snapshots/%s?delete_info=%s" % (
45
-                base.getid(snapshot), json.dumps(delete_info)))
45
+            base.getid(snapshot), json.dumps(delete_info)))
46 46
 
47 47
 manager_class = AssistedSnapshotManager
48 48
 name = 'assisted_volume_snapshots'

+ 3
- 6
novaclient/v1_1/flavors.py View File

@@ -55,8 +55,7 @@ class Flavor(base.Resource):
55 55
         :param flavor: The :class:`Flavor` to get extra specs from
56 56
         """
57 57
         _resp, body = self.manager.api.client.get(
58
-                            "/flavors/%s/os-extra_specs" %
59
-                            base.getid(self))
58
+            "/flavors/%s/os-extra_specs" % base.getid(self))
60 59
         return body["extra_specs"]
61 60
 
62 61
     def set_keys(self, metadata):
@@ -70,10 +69,8 @@ class Flavor(base.Resource):
70 69
 
71 70
         body = {'extra_specs': metadata}
72 71
         return self.manager._create(
73
-                            "/flavors/%s/os-extra_specs" % base.getid(self),
74
-                            body,
75
-                            "extra_specs",
76
-                            return_raw=True)
72
+            "/flavors/%s/os-extra_specs" % base.getid(self), body,
73
+            "extra_specs", return_raw=True)
77 74
 
78 75
     def unset_keys(self, keys):
79 76
         """

+ 4
- 4
novaclient/v1_1/security_group_default_rules.py View File

@@ -54,10 +54,10 @@ class SecurityGroupDefaultRuleManager(base.Manager):
54 54
                                             ", or 'icmp'."))
55 55
 
56 56
         body = {"security_group_default_rule": {
57
-                    "ip_protocol": ip_protocol,
58
-                    "from_port": from_port,
59
-                    "to_port": to_port,
60
-                    "cidr": cidr}}
57
+            "ip_protocol": ip_protocol,
58
+            "from_port": from_port,
59
+            "to_port": to_port,
60
+            "cidr": cidr}}
61 61
 
62 62
         return self._create('/os-security-group-default-rules', body,
63 63
                             'security_group_default_rule')

+ 6
- 6
novaclient/v1_1/security_group_rules.py View File

@@ -59,12 +59,12 @@ class SecurityGroupRuleManager(base.Manager):
59 59
                                             ", or 'icmp'."))
60 60
 
61 61
         body = {"security_group_rule": {
62
-                    "ip_protocol": ip_protocol,
63
-                    "from_port": from_port,
64
-                    "to_port": to_port,
65
-                    "cidr": cidr,
66
-                    "group_id": group_id,
67
-                    "parent_group_id": parent_group_id}}
62
+            "ip_protocol": ip_protocol,
63
+            "from_port": from_port,
64
+            "to_port": to_port,
65
+            "cidr": cidr,
66
+            "group_id": group_id,
67
+            "parent_group_id": parent_group_id}}
68 68
 
69 69
         return self._create('/os-security-group-rules', body,
70 70
                             'security_group_rule')

+ 1
- 1
novaclient/v1_1/servers.py View File

@@ -517,7 +517,7 @@ class ServerManager(base.BootingManagerWithFind):
517 517
         # Block device mappings are passed as a list of dictionaries
518 518
         if block_device_mapping:
519 519
             body['server']['block_device_mapping'] = \
520
-                    self._parse_block_device_mapping(block_device_mapping)
520
+                self._parse_block_device_mapping(block_device_mapping)
521 521
         elif block_device_mapping_v2:
522 522
             # Append the image to the list only if we have new style BDMs
523 523
             if image:

+ 33
- 33
novaclient/v1_1/shell.py View File

@@ -294,19 +294,19 @@ def _boot(cs, args):
294 294
         config_drive = args.config_drive
295 295
 
296 296
     boot_kwargs = dict(
297
-            meta=meta,
298
-            files=files,
299
-            key_name=key_name,
300
-            min_count=min_count,
301
-            max_count=max_count,
302
-            userdata=userdata,
303
-            availability_zone=availability_zone,
304
-            security_groups=security_groups,
305
-            block_device_mapping=block_device_mapping,
306
-            block_device_mapping_v2=block_device_mapping_v2,
307
-            nics=nics,
308
-            scheduler_hints=hints,
309
-            config_drive=config_drive)
297
+        meta=meta,
298
+        files=files,
299
+        key_name=key_name,
300
+        min_count=min_count,
301
+        max_count=max_count,
302
+        userdata=userdata,
303
+        availability_zone=availability_zone,
304
+        security_groups=security_groups,
305
+        block_device_mapping=block_device_mapping,
306
+        block_device_mapping_v2=block_device_mapping_v2,
307
+        nics=nics,
308
+        scheduler_hints=hints,
309
+        config_drive=config_drive)
310 310
 
311 311
     return boot_args, boot_kwargs
312 312
 
@@ -1209,19 +1209,19 @@ def do_list(cs, args):
1209 1209
     if args.tenant or args.user:
1210 1210
         args.all_tenants = 1
1211 1211
     search_opts = {
1212
-            'all_tenants': args.all_tenants,
1213
-            'reservation_id': args.reservation_id,
1214
-            'ip': args.ip,
1215
-            'ip6': args.ip6,
1216
-            'name': args.name,
1217
-            'image': imageid,
1218
-            'flavor': flavorid,
1219
-            'status': args.status,
1220
-            'tenant_id': args.tenant,
1221
-            'user_id': args.user,
1222
-            'host': args.host,
1223
-            'deleted': args.deleted,
1224
-            'instance_name': args.instance_name}
1212
+        'all_tenants': args.all_tenants,
1213
+        'reservation_id': args.reservation_id,
1214
+        'ip': args.ip,
1215
+        'ip6': args.ip6,
1216
+        'name': args.name,
1217
+        'image': imageid,
1218
+        'flavor': flavorid,
1219
+        'status': args.status,
1220
+        'tenant_id': args.tenant,
1221
+        'user_id': args.user,
1222
+        'host': args.host,
1223
+        'deleted': args.deleted,
1224
+        'instance_name': args.instance_name}
1225 1225
 
1226 1226
     filters = {'flavor': lambda f: f['id'],
1227 1227
                'security_groups': utils._format_security_groups}
@@ -2281,7 +2281,7 @@ def do_dns_list(cs, args):
2281 2281
     """List current DNS entries for domain and ip or domain and name."""
2282 2282
     if not (args.ip or args.name):
2283 2283
         raise exceptions.CommandError(
2284
-              _("You must specify either --ip or --name"))
2284
+            _("You must specify either --ip or --name"))
2285 2285
     if args.name:
2286 2286
         entry = cs.dns_entries.get(args.domain, args.name)
2287 2287
         _print_dns_list([entry])
@@ -2576,12 +2576,12 @@ def do_secgroup_delete_group_rule(cs, args):
2576 2576
         params['to_port'] = int(args.to_port)
2577 2577
 
2578 2578
     for rule in secgroup.rules:
2579
-        if (rule.get('ip_protocol') and rule['ip_protocol'].upper() ==
2580
-                           params.get('ip_protocol').upper() and
2581
-            rule.get('from_port') == params.get('from_port') and
2582
-            rule.get('to_port') == params.get('to_port') and
2583
-            rule.get('group', {}).get('name') ==
2584
-                     params.get('group_name')):
2579
+        if (rule.get('ip_protocol') and
2580
+                rule['ip_protocol'].upper() == params.get(
2581
+                    'ip_protocol').upper() and
2582
+                rule.get('from_port') == params.get('from_port') and
2583
+                rule.get('to_port') == params.get('to_port') and
2584
+                rule.get('group', {}).get('name') == params.get('group_name')):
2585 2585
             return cs.security_group_rules.delete(rule['id'])
2586 2586
 
2587 2587
     raise exceptions.CommandError(_("Rule not found"))

+ 3
- 3
novaclient/v1_1/usage.py View File

@@ -43,9 +43,9 @@ class UsageManager(base.ManagerWithFind):
43 43
         :rtype: list of :class:`Usage`.
44 44
         """
45 45
         return self._list(
46
-                    "/os-simple-tenant-usage?start=%s&end=%s&detailed=%s" %
47
-                    (start.isoformat(), end.isoformat(), int(bool(detailed))),
48
-                    "tenant_usages")
46
+            "/os-simple-tenant-usage?start=%s&end=%s&detailed=%s" %
47
+            (start.isoformat(), end.isoformat(), int(bool(detailed))),
48
+            "tenant_usages")
49 49
 
50 50
     def get(self, tenant_id, start, end):
51 51
         """

+ 3
- 3
novaclient/v3/agents.py View File

@@ -29,6 +29,6 @@ class AgentsManager(agents.AgentsManager):
29 29
 
30 30
     def _build_update_body(self, version, url, md5hash):
31 31
         return {'agent': {
32
-                       'version': version,
33
-                       'url': url,
34
-                       'md5hash': md5hash}}
32
+            'version': version,
33
+            'url': url,
34
+            'md5hash': md5hash}}

+ 3
- 5
novaclient/v3/flavors.py View File

@@ -45,8 +45,7 @@ class Flavor(base.Resource):
45 45
         :param flavor: The :class:`Flavor` to get extra specs from
46 46
         """
47 47
         _resp, body = self.manager.api.client.get(
48
-                            "/flavors/%s/flavor-extra-specs" %
49
-                            base.getid(self))
48
+            "/flavors/%s/flavor-extra-specs" % base.getid(self))
50 49
         return body["extra_specs"]
51 50
 
52 51
     def set_keys(self, metadata):
@@ -60,9 +59,8 @@ class Flavor(base.Resource):
60 59
 
61 60
         body = {'extra_specs': metadata}
62 61
         return self.manager._create(
63
-                            "/flavors/%s/flavor-extra-specs" %
64
-                            base.getid(self), body, "extra_specs",
65
-                            return_raw=True)
62
+            "/flavors/%s/flavor-extra-specs" % base.getid(self), body,
63
+            "extra_specs", return_raw=True)
66 64
 
67 65
     def unset_keys(self, keys):
68 66
         """

+ 32
- 34
novaclient/v3/shell.py View File

@@ -201,18 +201,18 @@ def _boot(cs, args):
201 201
         config_drive = args.config_drive
202 202
 
203 203
     boot_kwargs = dict(
204
-            meta=meta,
205
-            files=files,
206
-            key_name=key_name,
207
-            min_count=min_count,
208
-            max_count=max_count,
209
-            userdata=userdata,
210
-            availability_zone=availability_zone,
211
-            security_groups=security_groups,
212
-            block_device_mapping=block_device_mapping,
213
-            nics=nics,
214
-            scheduler_hints=hints,
215
-            config_drive=config_drive)
204
+        meta=meta,
205
+        files=files,
206
+        key_name=key_name,
207
+        min_count=min_count,
208
+        max_count=max_count,
209
+        userdata=userdata,
210
+        availability_zone=availability_zone,
211
+        security_groups=security_groups,
212
+        block_device_mapping=block_device_mapping,
213
+        nics=nics,
214
+        scheduler_hints=hints,
215
+        config_drive=config_drive)
216 216
 
217 217
     return boot_args, boot_kwargs
218 218
 
@@ -980,18 +980,18 @@ def do_list(cs, args):
980 980
     if args.flavor:
981 981
         flavorid = _find_flavor(cs, args.flavor).id
982 982
     search_opts = {
983
-            'all_tenants': args.all_tenants,
984
-            'reservation_id': args.reservation_id,
985
-            'ip': args.ip,
986
-            'ip6': args.ip6,
987
-            'name': args.name,
988
-            'image': imageid,
989
-            'flavor': flavorid,
990
-            'status': args.status,
991
-            'tenant_id': args.tenant,
992
-            'host': args.host,
993
-            'deleted': args.deleted,
994
-            'instance_name': args.instance_name}
983
+        'all_tenants': args.all_tenants,
984
+        'reservation_id': args.reservation_id,
985
+        'ip': args.ip,
986
+        'ip6': args.ip6,
987
+        'name': args.name,
988
+        'image': imageid,
989
+        'flavor': flavorid,
990
+        'status': args.status,
991
+        'tenant_id': args.tenant,
992
+        'host': args.host,
993
+        'deleted': args.deleted,
994
+        'instance_name': args.instance_name}
995 995
 
996 996
     filters = {'flavor': lambda f: f['id'],
997 997
                'security_groups': utils._format_security_groups}
@@ -1696,8 +1696,7 @@ def do_dns_domains(cs, args):
1696 1696
 def do_dns_list(cs, args):
1697 1697
     """List current DNS entries for domain and ip or domain and name."""
1698 1698
     if not (args.ip or args.name):
1699
-        raise exceptions.CommandError(
1700
-              "You must specify either --ip or --name")
1699
+        raise exceptions.CommandError("You must specify either --ip or --name")
1701 1700
     if args.name:
1702 1701
         entry = cs.dns_entries.get(args.domain, args.name)
1703 1702
         _print_dns_list([entry])
@@ -1988,11 +1987,10 @@ def do_secgroup_delete_group_rule(cs, args):
1988 1987
 
1989 1988
     for rule in secgroup.rules:
1990 1989
         if (rule.get('ip_protocol').upper() == params.get(
1991
-                                               'ip_protocol').upper() and
1992
-            rule.get('from_port') == params.get('from_port') and
1993
-            rule.get('to_port') == params.get('to_port') and
1994
-            rule.get('group', {}).get('name') ==
1995
-                     params.get('group_name')):
1990
+                'ip_protocol').upper() and
1991
+                rule.get('from_port') == params.get('from_port') and
1992
+                rule.get('to_port') == params.get('to_port') and
1993
+                rule.get('group', {}).get('name') == params.get('group_name')):
1996 1994
             return cs.security_group_rules.delete(rule['id'])
1997 1995
 
1998 1996
     raise exceptions.CommandError("Rule not found")
@@ -3108,9 +3106,9 @@ def _treeizeAvailabilityZone(zone):
3108 3106
                                       copy.deepcopy(zone._info), zone._loaded)
3109 3107
                 az.zone_name = '| |- %s' % svc
3110 3108
                 az.zone_state = '%s %s %s' % (
3111
-                               'enabled' if state['active'] else 'disabled',
3112
-                               ':-)' if state['available'] else 'XXX',
3113
-                               state['updated_at'])
3109
+                    'enabled' if state['active'] else 'disabled',
3110
+                    ':-)' if state['available'] else 'XXX',
3111
+                    state['updated_at'])
3114 3112
                 az._info['zone_name'] = az.zone_name
3115 3113
                 az._info['zone_state'] = az.zone_state
3116 3114
                 result.append(az)

+ 1
- 1
tox.ini View File

@@ -42,7 +42,7 @@ downloadcache = ~/cache/pip
42 42
 # reason: removed in hacking (https://review.openstack.org/#/c/101701/)
43 43
 #
44 44
 # Additional checks are also ignored on purpose: F811, F821
45
-ignore = E124,E126,E127,E128,E129,F811,F821,H402,H404,H405,H904
45
+ignore = E124,E127,E128,E129,F811,F821,H402,H404,H405,H904
46 46
 show-source = True
47 47
 exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,build,doc/source/conf.py
48 48
 

Loading…
Cancel
Save