Skip to content

Commit 39f6506

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "network: Replace remaining use of keystoneclient"
2 parents bdb148b + 0050fd1 commit 39f6506

60 files changed

Lines changed: 452 additions & 738 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

openstackclient/network/v2/address_group.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def _get_attrs(
5454
attrs['description'] = parsed_args.description
5555
attrs['addresses'] = _format_addresses(parsed_args.address)
5656
if 'project' in parsed_args and parsed_args.project is not None:
57-
identity_client = client_manager.identity
58-
project_id = identity_common.find_project(
57+
identity_client = client_manager.sdk_connection.identity
58+
project_id = identity_common.find_project_id_sdk(
5959
identity_client,
6060
parsed_args.project,
6161
parsed_args.project_domain,
62-
).id
62+
)
6363
attrs['project_id'] = project_id
6464

6565
return attrs
@@ -199,12 +199,12 @@ def take_action(
199199
if parsed_args.name:
200200
attrs['name'] = parsed_args.name
201201
if 'project' in parsed_args and parsed_args.project is not None:
202-
identity_client = self.app.client_manager.identity
203-
project_id = identity_common.find_project(
202+
identity_client = self.app.client_manager.sdk_connection.identity
203+
project_id = identity_common.find_project_id_sdk(
204204
identity_client,
205205
parsed_args.project,
206206
parsed_args.project_domain,
207-
).id
207+
)
208208
attrs['project_id'] = project_id
209209
if parsed_args.marker is not None:
210210
attrs['marker'] = parsed_args.marker

openstackclient/network/v2/address_scope.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ def _get_attrs(
5454
if parsed_args.no_share:
5555
attrs['shared'] = False
5656
if 'project' in parsed_args and parsed_args.project is not None:
57-
identity_client = client_manager.identity
58-
project_id = identity_common.find_project(
57+
identity_client = client_manager.sdk_connection.identity
58+
project_id = identity_common.find_project_id_sdk(
5959
identity_client,
6060
parsed_args.project,
6161
parsed_args.project_domain,
62-
).id
62+
)
6363
attrs['project_id'] = project_id
6464

6565
return attrs
@@ -232,12 +232,12 @@ def take_action(
232232
if parsed_args.no_share:
233233
attrs['is_shared'] = False
234234
if 'project' in parsed_args and parsed_args.project is not None:
235-
identity_client = self.app.client_manager.identity
236-
project_id = identity_common.find_project(
235+
identity_client = self.app.client_manager.sdk_connection.identity
236+
project_id = identity_common.find_project_id_sdk(
237237
identity_client,
238238
parsed_args.project,
239239
parsed_args.project_domain,
240-
).id
240+
)
241241
attrs['project_id'] = project_id
242242
if parsed_args.marker is not None:
243243
attrs['marker'] = parsed_args.marker

openstackclient/network/v2/floating_ip.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,12 @@ def _get_attrs(
8989
attrs['description'] = parsed_args.description
9090

9191
if parsed_args.project:
92-
identity_client = client_manager.identity
93-
project_id = identity_common.find_project(
92+
identity_client = client_manager.sdk_connection.identity
93+
project_id = identity_common.find_project_id_sdk(
9494
identity_client,
9595
parsed_args.project,
9696
parsed_args.project_domain,
97-
).id
97+
)
9898
attrs['project_id'] = project_id
9999

100100
if parsed_args.dns_domain:
@@ -319,7 +319,6 @@ def take_action(
319319
self, parsed_args: argparse.Namespace
320320
) -> tuple[Sequence[str], Iterable[Any]]:
321321
network_client = self.app.client_manager.network
322-
identity_client = self.app.client_manager.identity
323322

324323
columns: tuple[str, ...] = (
325324
'id',
@@ -355,7 +354,7 @@ def take_action(
355354
'DNS Domain',
356355
)
357356

358-
query = {}
357+
query: dict[str, object] = {}
359358

360359
if parsed_args.networks is not None:
361360
network_ids = []
@@ -385,12 +384,13 @@ def take_action(
385384
query['status'] = parsed_args.status
386385

387386
if parsed_args.project is not None:
388-
project = identity_common.find_project(
387+
identity_client = self.app.client_manager.sdk_connection.identity
388+
project_id = identity_common.find_project_id_sdk(
389389
identity_client,
390390
parsed_args.project,
391391
parsed_args.project_domain,
392392
)
393-
query['project_id'] = project.id
393+
query['project_id'] = project_id
394394

395395
if parsed_args.routers is not None:
396396
router_ids = []

openstackclient/network/v2/fwaas/group.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,16 @@ def take_action(
239239
)
240240
elif parsed_args.positional_name:
241241
parsed_args.name = parsed_args.positional_name
242+
242243
attrs = _get_common_attrs(self.app.client_manager, parsed_args)
243244
if 'project' in parsed_args and parsed_args.project is not None:
244-
attrs['project_id'] = identity_common.find_project(
245-
self.app.client_manager.identity,
245+
identity_client = self.app.client_manager.sdk_connection.identity
246+
project_id = identity_common.find_project_id_sdk(
247+
identity_client,
246248
parsed_args.project,
247249
parsed_args.project_domain,
248-
).id
250+
)
251+
attrs['project_id'] = project_id
249252
obj = client.create_firewall_group(**attrs)
250253
display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
251254
obj, _attr_map_dict, ['location', 'tenant_id']

openstackclient/network/v2/fwaas/policy.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,13 @@ def take_action(
154154
client = self.app.client_manager.network
155155
attrs = _get_common_attrs(self.app.client_manager, parsed_args)
156156
if 'project' in parsed_args and parsed_args.project is not None:
157-
attrs['project_id'] = identity_common.find_project(
158-
self.app.client_manager.identity,
157+
identity_client = self.app.client_manager.sdk_connection.identity
158+
project_id = identity_common.find_project_id_sdk(
159+
identity_client,
159160
parsed_args.project,
160161
parsed_args.project_domain,
161-
).id
162+
)
163+
attrs['project_id'] = project_id
162164
obj = client.create_firewall_policy(**attrs)
163165
display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
164166
obj, _attr_map_dict, ['location', 'tenant_id']

openstackclient/network/v2/fwaas/rule.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,11 +328,13 @@ def take_action(
328328
parsed_args.name = parsed_args.positional_name
329329
attrs = _get_common_attrs(self.app.client_manager, parsed_args)
330330
if 'project' in parsed_args and parsed_args.project is not None:
331-
attrs['project_id'] = identity_common.find_project(
332-
self.app.client_manager.identity,
331+
identity_client = self.app.client_manager.sdk_connection.identity
332+
project_id = identity_common.find_project_id_sdk(
333+
identity_client,
333334
parsed_args.project,
334335
parsed_args.project_domain,
335-
).id
336+
)
337+
attrs['project_id'] = project_id
336338
obj = client.create_firewall_rule(**attrs)
337339
display_columns, columns = utils.get_osc_show_columns_for_sdk_resource(
338340
obj, _attr_map_dict, ['location', 'tenant_id']

openstackclient/network/v2/ip_availability.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ def take_action(
9191
if parsed_args.ip_version:
9292
filters['ip_version'] = parsed_args.ip_version
9393
if parsed_args.project:
94-
identity_client = self.app.client_manager.identity
95-
project_id = identity_common.find_project(
94+
identity_client = self.app.client_manager.sdk_connection.identity
95+
project_id = identity_common.find_project_id_sdk(
9696
identity_client,
9797
parsed_args.project,
9898
parsed_args.project_domain,
99-
).id
99+
)
100100
filters['project_id'] = project_id
101101
if parsed_args.marker is not None:
102102
filters['marker'] = parsed_args.marker

openstackclient/network/v2/local_ip.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ def _get_attrs(
5151
if parsed_args.description:
5252
attrs['description'] = parsed_args.description
5353
if 'project' in parsed_args and parsed_args.project is not None:
54-
identity_client = client_manager.identity
55-
project_id = identity_common.find_project(
54+
identity_client = client_manager.sdk_connection.identity
55+
project_id = identity_common.find_project_id_sdk(
5656
identity_client,
5757
parsed_args.project,
5858
parsed_args.project_domain,
59-
).id
59+
)
6060
attrs['project_id'] = project_id
6161
if parsed_args.network:
6262
network = network_client.find_network(
@@ -274,12 +274,12 @@ def take_action(
274274
if parsed_args.name:
275275
attrs['name'] = parsed_args.name
276276
if 'project' in parsed_args and parsed_args.project is not None:
277-
identity_client = self.app.client_manager.identity
278-
project_id = identity_common.find_project(
277+
identity_client = self.app.client_manager.sdk_connection.identity
278+
project_id = identity_common.find_project_id_sdk(
279279
identity_client,
280280
parsed_args.project,
281281
parsed_args.project_domain,
282-
).id
282+
)
283283
attrs['project_id'] = project_id
284284
if parsed_args.network is not None:
285285
network = client.find_network(

openstackclient/network/v2/ndp_proxy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ def take_action(
192192
self, parsed_args: argparse.Namespace
193193
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
194194
client = self.app.client_manager.network
195-
identity_client = self.app.client_manager.identity
196195

197196
columns = (
198197
'id',
@@ -222,11 +221,12 @@ def take_action(
222221
if parsed_args.ip_address is not None:
223222
query['ip_address'] = parsed_args.ip_address
224223
if parsed_args.project:
225-
project_id = identity_common.find_project(
224+
identity_client = self.app.client_manager.sdk_connection.identity
225+
project_id = identity_common.find_project_id_sdk(
226226
identity_client,
227227
parsed_args.project,
228228
parsed_args.project_domain,
229-
).id
229+
)
230230
query['project_id'] = project_id
231231
if parsed_args.name:
232232
query['name'] = parsed_args.name

openstackclient/network/v2/network.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@ def _get_attrs(
9999

100100
# "network set" command doesn't support setting project.
101101
if 'project' in parsed_args and parsed_args.project is not None:
102-
identity_client = client_manager.identity
103-
project_id = identity_common.find_project(
102+
identity_client = client_manager.sdk_connection.identity
103+
project_id = identity_common.find_project_id_sdk(
104104
identity_client,
105105
parsed_args.project,
106106
parsed_args.project_domain,
107-
).id
107+
)
108108
attrs['project_id'] = project_id
109109

110110
# "network set" command doesn't support setting availability zone hints.
@@ -568,7 +568,6 @@ def take_action(
568568
self, parsed_args: argparse.Namespace
569569
) -> tuple[Sequence[str], Iterable[Any]]:
570570
client = self.app.client_manager.network
571-
identity_client = self.app.client_manager.identity
572571
if parsed_args.long:
573572
columns: tuple[str, ...] = (
574573
'id',
@@ -626,7 +625,7 @@ def take_action(
626625
),
627626
)
628627

629-
args = {}
628+
args: dict[str, object] = {}
630629

631630
if parsed_args.external:
632631
args['router:external'] = True
@@ -646,12 +645,13 @@ def take_action(
646645
args['is_admin_state_up'] = False
647646

648647
if parsed_args.project:
649-
project = identity_common.find_project(
648+
identity_client = self.app.client_manager.sdk_connection.identity
649+
project_id = identity_common.find_project_id_sdk(
650650
identity_client,
651651
parsed_args.project,
652652
parsed_args.project_domain,
653653
)
654-
args['project_id'] = project.id
654+
args['project_id'] = project_id
655655

656656
if parsed_args.share:
657657
args['shared'] = True

0 commit comments

Comments
 (0)