|
18 | 18 | import copy |
19 | 19 | import json |
20 | 20 | import logging |
| 21 | +import typing as ty |
21 | 22 |
|
22 | 23 | from cliff import columns as cliff_columns |
23 | 24 | from osc_lib.cli import format_columns |
@@ -104,21 +105,21 @@ def _passed_multiple_gateways(extension_supported, external_gateways): |
104 | 105 |
|
105 | 106 |
|
106 | 107 | def _get_external_gateway_attrs(client_manager, parsed_args): |
107 | | - attrs = {} |
| 108 | + attrs: dict[str, ty.Any] = {} |
108 | 109 |
|
109 | 110 | if parsed_args.external_gateways: |
110 | 111 | external_gateways: collections.defaultdict[str, list[dict]] = ( |
111 | 112 | collections.defaultdict(list) |
112 | 113 | ) |
113 | 114 | n_client = client_manager.network |
114 | | - first_network_id = None |
| 115 | + first_network_id = '' |
115 | 116 |
|
116 | 117 | for gw_net_name_or_id in parsed_args.external_gateways: |
117 | 118 | gateway_info = {} |
118 | 119 | gw_net = n_client.find_network( |
119 | 120 | gw_net_name_or_id, ignore_missing=False |
120 | 121 | ) |
121 | | - if first_network_id is None: |
| 122 | + if not first_network_id: |
122 | 123 | first_network_id = gw_net.id |
123 | 124 | gateway_info['network_id'] = gw_net.id |
124 | 125 | if 'disable_snat' in parsed_args and parsed_args.disable_snat: |
@@ -146,7 +147,7 @@ def _get_external_gateway_attrs(client_manager, parsed_args): |
146 | 147 | for ip_spec in parsed_args.fixed_ips: |
147 | 148 | # If there is only one gateway, this value will represent the |
148 | 149 | # network ID for it, otherwise it will be overridden. |
149 | | - ip_net_id = first_network_id |
| 150 | + ip_net_id: str = first_network_id |
150 | 151 |
|
151 | 152 | if ip_spec.get('subnet', False): |
152 | 153 | subnet_name_id = ip_spec.pop('subnet') |
|
0 commit comments