python-openstackclient 7.3.1__py3-none-any.whl → 8.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. openstackclient/common/availability_zone.py +3 -6
  2. openstackclient/common/clientmanager.py +2 -1
  3. openstackclient/common/envvars.py +57 -0
  4. openstackclient/common/extension.py +3 -11
  5. openstackclient/common/limits.py +1 -1
  6. openstackclient/common/project_cleanup.py +3 -2
  7. openstackclient/common/quota.py +54 -28
  8. openstackclient/compute/client.py +2 -5
  9. openstackclient/compute/v2/agent.py +5 -5
  10. openstackclient/compute/v2/aggregate.py +17 -15
  11. openstackclient/compute/v2/console.py +3 -4
  12. openstackclient/compute/v2/flavor.py +14 -18
  13. openstackclient/compute/v2/host.py +3 -3
  14. openstackclient/compute/v2/hypervisor.py +10 -4
  15. openstackclient/compute/v2/hypervisor_stats.py +1 -1
  16. openstackclient/compute/v2/keypair.py +8 -10
  17. openstackclient/compute/v2/server.py +70 -112
  18. openstackclient/compute/v2/server_backup.py +1 -1
  19. openstackclient/compute/v2/server_event.py +7 -16
  20. openstackclient/compute/v2/server_group.py +6 -6
  21. openstackclient/compute/v2/server_image.py +1 -1
  22. openstackclient/compute/v2/server_migration.py +6 -6
  23. openstackclient/compute/v2/server_volume.py +4 -4
  24. openstackclient/compute/v2/service.py +9 -13
  25. openstackclient/compute/v2/usage.py +4 -6
  26. openstackclient/identity/client.py +2 -4
  27. openstackclient/identity/common.py +16 -17
  28. openstackclient/identity/v2_0/ec2creds.py +4 -3
  29. openstackclient/identity/v2_0/endpoint.py +12 -10
  30. openstackclient/identity/v2_0/project.py +6 -6
  31. openstackclient/identity/v2_0/role.py +1 -1
  32. openstackclient/identity/v2_0/service.py +7 -7
  33. openstackclient/identity/v2_0/user.py +6 -21
  34. openstackclient/identity/v3/access_rule.py +2 -5
  35. openstackclient/identity/v3/consumer.py +4 -3
  36. openstackclient/identity/v3/credential.py +8 -9
  37. openstackclient/identity/v3/domain.py +1 -1
  38. openstackclient/identity/v3/ec2creds.py +4 -3
  39. openstackclient/identity/v3/endpoint.py +104 -88
  40. openstackclient/identity/v3/endpoint_group.py +1 -1
  41. openstackclient/identity/v3/group.py +3 -4
  42. openstackclient/identity/v3/identity_provider.py +1 -2
  43. openstackclient/identity/v3/limit.py +4 -9
  44. openstackclient/identity/v3/mapping.py +4 -3
  45. openstackclient/identity/v3/policy.py +5 -8
  46. openstackclient/identity/v3/project.py +6 -6
  47. openstackclient/identity/v3/region.py +2 -5
  48. openstackclient/identity/v3/registered_limit.py +4 -8
  49. openstackclient/identity/v3/role.py +15 -16
  50. openstackclient/identity/v3/service.py +8 -8
  51. openstackclient/identity/v3/service_provider.py +3 -6
  52. openstackclient/identity/v3/tag.py +2 -2
  53. openstackclient/identity/v3/token.py +1 -2
  54. openstackclient/identity/v3/trust.py +74 -25
  55. openstackclient/identity/v3/user.py +9 -6
  56. openstackclient/image/client.py +2 -5
  57. openstackclient/image/v1/image.py +11 -15
  58. openstackclient/image/v2/cache.py +2 -4
  59. openstackclient/image/v2/image.py +30 -37
  60. openstackclient/image/v2/metadef_namespaces.py +4 -3
  61. openstackclient/image/v2/metadef_resource_type_association.py +1 -2
  62. openstackclient/image/v2/metadef_resource_types.py +1 -2
  63. openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +9 -1370
  64. openstackclient/network/client.py +4 -10
  65. openstackclient/network/common.py +16 -12
  66. openstackclient/network/utils.py +3 -3
  67. openstackclient/network/v2/address_group.py +5 -9
  68. openstackclient/network/v2/address_scope.py +2 -3
  69. openstackclient/network/v2/default_security_group_rule.py +1 -2
  70. openstackclient/network/v2/floating_ip.py +14 -21
  71. openstackclient/network/v2/floating_ip_port_forwarding.py +7 -7
  72. openstackclient/network/v2/ip_availability.py +1 -2
  73. openstackclient/network/v2/l3_conntrack_helper.py +8 -12
  74. openstackclient/network/v2/local_ip.py +24 -26
  75. openstackclient/network/v2/local_ip_association.py +4 -5
  76. openstackclient/network/v2/ndp_proxy.py +9 -10
  77. openstackclient/network/v2/network.py +12 -16
  78. openstackclient/network/v2/network_agent.py +29 -37
  79. openstackclient/network/v2/network_auto_allocated_topology.py +4 -5
  80. openstackclient/network/v2/network_flavor.py +1 -1
  81. openstackclient/network/v2/network_flavor_profile.py +5 -5
  82. openstackclient/network/v2/network_meter.py +3 -3
  83. openstackclient/network/v2/network_meter_rule.py +5 -8
  84. openstackclient/network/v2/network_qos_policy.py +4 -4
  85. openstackclient/network/v2/network_qos_rule.py +4 -5
  86. openstackclient/network/v2/network_rbac.py +4 -4
  87. openstackclient/network/v2/network_segment.py +6 -7
  88. openstackclient/network/v2/network_segment_range.py +16 -20
  89. openstackclient/network/v2/network_trunk.py +24 -16
  90. openstackclient/network/v2/port.py +42 -31
  91. openstackclient/network/v2/router.py +55 -41
  92. openstackclient/network/v2/security_group.py +8 -15
  93. openstackclient/network/v2/security_group_rule.py +9 -10
  94. openstackclient/network/v2/subnet.py +31 -30
  95. openstackclient/network/v2/subnet_pool.py +4 -4
  96. openstackclient/object/client.py +2 -3
  97. openstackclient/object/v1/container.py +2 -3
  98. openstackclient/object/v1/object.py +2 -9
  99. openstackclient/shell.py +22 -5
  100. openstackclient/tests/functional/base.py +2 -2
  101. openstackclient/tests/functional/common/test_quota.py +3 -1
  102. openstackclient/tests/functional/compute/v2/common.py +12 -6
  103. openstackclient/tests/functional/compute/v2/test_server.py +2 -3
  104. openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
  105. openstackclient/tests/functional/identity/v2/test_user.py +1 -1
  106. openstackclient/tests/functional/identity/v3/common.py +3 -8
  107. openstackclient/tests/functional/identity/v3/test_application_credential.py +10 -10
  108. openstackclient/tests/functional/identity/v3/test_endpoint.py +3 -3
  109. openstackclient/tests/functional/identity/v3/test_group.py +3 -3
  110. openstackclient/tests/functional/identity/v3/test_idp.py +3 -7
  111. openstackclient/tests/functional/identity/v3/test_limit.py +4 -4
  112. openstackclient/tests/functional/identity/v3/test_project.py +5 -14
  113. openstackclient/tests/functional/identity/v3/test_region.py +1 -3
  114. openstackclient/tests/functional/identity/v3/test_registered_limit.py +3 -3
  115. openstackclient/tests/functional/identity/v3/test_role.py +1 -1
  116. openstackclient/tests/functional/identity/v3/test_role_assignment.py +13 -31
  117. openstackclient/tests/functional/identity/v3/test_service_provider.py +3 -7
  118. openstackclient/tests/functional/identity/v3/test_user.py +8 -8
  119. openstackclient/tests/functional/network/v2/common.py +7 -3
  120. openstackclient/tests/functional/network/v2/test_address_group.py +4 -0
  121. openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +15 -11
  122. openstackclient/tests/functional/network/v2/test_local_ip.py +4 -0
  123. openstackclient/tests/functional/network/v2/test_network_meter_rule.py +2 -2
  124. openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +2 -3
  125. openstackclient/tests/functional/network/v2/test_network_rbac.py +2 -2
  126. openstackclient/tests/functional/network/v2/test_network_trunk.py +1 -1
  127. openstackclient/tests/functional/network/v2/test_port.py +17 -7
  128. openstackclient/tests/functional/network/v2/test_router.py +42 -0
  129. openstackclient/tests/functional/network/v2/test_subnet_pool.py +4 -0
  130. openstackclient/tests/unit/api/test_compute_v2.py +67 -87
  131. openstackclient/tests/unit/common/test_availability_zone.py +6 -14
  132. openstackclient/tests/unit/common/test_command.py +1 -1
  133. openstackclient/tests/unit/common/test_extension.py +5 -7
  134. openstackclient/tests/unit/common/test_limits.py +1 -1
  135. openstackclient/tests/unit/common/test_project_cleanup.py +5 -6
  136. openstackclient/tests/unit/common/test_quota.py +51 -28
  137. openstackclient/tests/unit/compute/v2/fakes.py +4 -10
  138. openstackclient/tests/unit/compute/v2/test_agent.py +16 -16
  139. openstackclient/tests/unit/compute/v2/test_aggregate.py +56 -60
  140. openstackclient/tests/unit/compute/v2/test_console.py +16 -16
  141. openstackclient/tests/unit/compute/v2/test_flavor.py +71 -71
  142. openstackclient/tests/unit/compute/v2/test_host.py +8 -8
  143. openstackclient/tests/unit/compute/v2/test_hypervisor.py +22 -30
  144. openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
  145. openstackclient/tests/unit/compute/v2/test_keypair.py +24 -24
  146. openstackclient/tests/unit/compute/v2/test_server.py +524 -560
  147. openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -7
  148. openstackclient/tests/unit/compute/v2/test_server_event.py +16 -18
  149. openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
  150. openstackclient/tests/unit/compute/v2/test_server_image.py +6 -8
  151. openstackclient/tests/unit/compute/v2/test_server_migration.py +37 -37
  152. openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -12
  153. openstackclient/tests/unit/compute/v2/test_service.py +39 -45
  154. openstackclient/tests/unit/compute/v2/test_usage.py +5 -5
  155. openstackclient/tests/unit/identity/v2_0/fakes.py +1 -1
  156. openstackclient/tests/unit/identity/v3/test_access_rule.py +1 -3
  157. openstackclient/tests/unit/identity/v3/test_application_credential.py +1 -1
  158. openstackclient/tests/unit/identity/v3/test_credential.py +4 -4
  159. openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
  160. openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
  161. openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
  162. openstackclient/tests/unit/identity/v3/test_user.py +16 -0
  163. openstackclient/tests/unit/image/v1/fakes.py +2 -2
  164. openstackclient/tests/unit/image/v2/test_image.py +39 -1
  165. openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
  166. openstackclient/tests/unit/network/test_common.py +2 -2
  167. openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
  168. openstackclient/tests/unit/network/v2/test_floating_ip_network.py +49 -35
  169. openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
  170. openstackclient/tests/unit/network/v2/test_network_compute.py +11 -11
  171. openstackclient/tests/unit/network/v2/test_network_trunk.py +2 -2
  172. openstackclient/tests/unit/network/v2/test_port.py +33 -5
  173. openstackclient/tests/unit/network/v2/test_router.py +120 -7
  174. openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
  175. openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +14 -14
  176. openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
  177. openstackclient/tests/unit/test_shell.py +16 -13
  178. openstackclient/tests/unit/volume/v2/test_volume.py +1 -1
  179. openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +1 -1
  180. openstackclient/tests/unit/volume/v3/fakes.py +2 -8
  181. openstackclient/tests/unit/volume/v3/test_volume.py +1 -1
  182. openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -3
  183. openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +1 -2
  184. openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +1 -1
  185. openstackclient/volume/client.py +1 -3
  186. openstackclient/volume/v2/consistency_group.py +4 -8
  187. openstackclient/volume/v2/consistency_group_snapshot.py +1 -2
  188. openstackclient/volume/v2/qos_specs.py +1 -2
  189. openstackclient/volume/v2/volume.py +8 -16
  190. openstackclient/volume/v2/volume_backup.py +6 -7
  191. openstackclient/volume/v2/volume_snapshot.py +8 -9
  192. openstackclient/volume/v2/volume_transfer_request.py +0 -3
  193. openstackclient/volume/v2/volume_type.py +10 -21
  194. openstackclient/volume/v3/block_storage_cluster.py +3 -3
  195. openstackclient/volume/v3/block_storage_manage.py +1 -3
  196. openstackclient/volume/v3/volume.py +18 -19
  197. openstackclient/volume/v3/volume_attachment.py +3 -2
  198. openstackclient/volume/v3/volume_backup.py +7 -8
  199. openstackclient/volume/v3/volume_group.py +2 -1
  200. openstackclient/volume/v3/volume_group_snapshot.py +2 -1
  201. openstackclient/volume/v3/volume_snapshot.py +4 -3
  202. openstackclient/volume/v3/volume_type.py +10 -21
  203. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/AUTHORS +4 -0
  204. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/METADATA +7 -13
  205. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/RECORD +210 -233
  206. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/WHEEL +1 -1
  207. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/entry_points.txt +0 -41
  208. python_openstackclient-8.0.0.dist-info/pbr.json +1 -0
  209. openstackclient/tests/functional/volume/v1/__init__.py +0 -0
  210. openstackclient/tests/functional/volume/v1/common.py +0 -35
  211. openstackclient/tests/functional/volume/v1/test_qos.py +0 -100
  212. openstackclient/tests/functional/volume/v1/test_service.py +0 -76
  213. openstackclient/tests/functional/volume/v1/test_snapshot.py +0 -232
  214. openstackclient/tests/functional/volume/v1/test_transfer_request.py +0 -111
  215. openstackclient/tests/functional/volume/v1/test_volume.py +0 -228
  216. openstackclient/tests/functional/volume/v1/test_volume_type.py +0 -213
  217. openstackclient/tests/unit/volume/v1/__init__.py +0 -0
  218. openstackclient/tests/unit/volume/v1/fakes.py +0 -615
  219. openstackclient/tests/unit/volume/v1/test_qos_specs.py +0 -471
  220. openstackclient/tests/unit/volume/v1/test_service.py +0 -295
  221. openstackclient/tests/unit/volume/v1/test_transfer_request.py +0 -380
  222. openstackclient/tests/unit/volume/v1/test_type.py +0 -633
  223. openstackclient/tests/unit/volume/v1/test_volume.py +0 -1447
  224. openstackclient/tests/unit/volume/v1/test_volume_backup.py +0 -435
  225. openstackclient/volume/v1/__init__.py +0 -0
  226. openstackclient/volume/v1/qos_specs.py +0 -377
  227. openstackclient/volume/v1/service.py +0 -136
  228. openstackclient/volume/v1/volume.py +0 -734
  229. openstackclient/volume/v1/volume_backup.py +0 -302
  230. openstackclient/volume/v1/volume_snapshot.py +0 -433
  231. openstackclient/volume/v1/volume_transfer_request.py +0 -200
  232. openstackclient/volume/v1/volume_type.py +0 -520
  233. python_openstackclient-7.3.1.dist-info/pbr.json +0 -1
  234. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/LICENSE +0 -0
  235. {python_openstackclient-7.3.1.dist-info → python_openstackclient-8.0.0.dist-info}/top_level.txt +0 -0
@@ -9,7 +9,6 @@
9
9
  # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10
10
  # License for the specific language governing permissions and limitations
11
11
  # under the License.
12
- #
13
12
 
14
13
  import logging
15
14
 
@@ -17,16 +16,13 @@ from osc_lib import utils
17
16
 
18
17
  from openstackclient.i18n import _
19
18
 
20
-
21
19
  LOG = logging.getLogger(__name__)
22
20
 
21
+ # global variables used when building the shell
23
22
  DEFAULT_API_VERSION = '2.0'
24
23
  API_VERSION_OPTION = 'os_network_api_version'
25
- API_NAME = "network"
26
- API_VERSIONS = {
27
- "2.0": "openstack.connection.Connection",
28
- "2": "openstack.connection.Connection",
29
- }
24
+ API_NAME = 'network'
25
+ API_VERSIONS = ('2.0', '2')
30
26
 
31
27
 
32
28
  def make_client(instance):
@@ -50,9 +46,7 @@ def build_option_parser(parser):
50
46
  '--os-network-api-version',
51
47
  metavar='<network-api-version>',
52
48
  default=utils.env('OS_NETWORK_API_VERSION'),
53
- help=_(
54
- "Network API version, default=%s " "(Env: OS_NETWORK_API_VERSION)"
55
- )
49
+ help=_("Network API version, default=%s (Env: OS_NETWORK_API_VERSION)")
56
50
  % DEFAULT_API_VERSION,
57
51
  )
58
52
  return parser
@@ -12,9 +12,12 @@
12
12
  #
13
13
 
14
14
  import abc
15
+ import argparse
15
16
  import contextlib
16
17
  import logging
18
+ import typing as ty
17
19
 
20
+ import cliff.app
18
21
  import openstack.exceptions
19
22
  from osc_lib.cli import parseractions
20
23
  from osc_lib.command import command
@@ -65,6 +68,8 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
65
68
  present the options for both network types, often qualified accordingly.
66
69
  """
67
70
 
71
+ app: cliff.app.App
72
+
68
73
  @property
69
74
  def _network_type(self):
70
75
  """Discover whether the running cloud is using neutron or nova-network.
@@ -131,9 +136,9 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
131
136
  )
132
137
  )
133
138
 
134
- def get_parser(self, prog_name):
139
+ def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
135
140
  LOG.debug('get_parser(%s)', prog_name)
136
- parser = super().get_parser(prog_name)
141
+ parser = super().get_parser(prog_name) # type: ignore
137
142
  parser = self.update_parser_common(parser)
138
143
  LOG.debug('common parser: %s', parser)
139
144
  if self.is_neutron or self.is_docs_build:
@@ -162,7 +167,7 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
162
167
  )
163
168
  elif self.is_nova_network:
164
169
  return self.take_action_compute(
165
- self.app.client_manager.sdk_connection.compute, parsed_args
170
+ self.app.client_manager.compute, parsed_args
166
171
  )
167
172
 
168
173
  def take_action_network(self, client, parsed_args):
@@ -211,7 +216,7 @@ class NetworkAndComputeDelete(NetworkAndComputeCommand, metaclass=abc.ABCMeta):
211
216
  )
212
217
  else:
213
218
  self.take_action_compute(
214
- self.app.client_manager.sdk_connection.compute,
219
+ self.app.client_manager.compute,
215
220
  parsed_args,
216
221
  )
217
222
  except Exception as e:
@@ -269,7 +274,7 @@ class NetworkAndComputeShowOne(
269
274
  )
270
275
  else:
271
276
  return self.take_action_compute(
272
- self.app.client_manager.sdk_connection.compute, parsed_args
277
+ self.app.client_manager.compute, parsed_args
273
278
  )
274
279
  except openstack.exceptions.HttpException as exc:
275
280
  msg = _("Error while executing command: %s") % exc.message
@@ -295,16 +300,15 @@ class NeutronCommandWithExtraArgs(command.Command):
295
300
  }
296
301
 
297
302
  def _get_property_converter(self, _property):
298
- if 'type' not in _property:
299
- converter = str
300
- else:
303
+ if 'type' in _property:
301
304
  converter = self._allowed_types_dict.get(_property['type'])
305
+ else:
306
+ converter = str
302
307
 
303
308
  if not converter:
304
309
  raise exceptions.CommandError(
305
310
  _(
306
- "Type {property_type} of property {name} "
307
- "is not supported"
311
+ "Type {property_type} of property {name} is not supported"
308
312
  ).format(
309
313
  property_type=_property['type'], name=_property['name']
310
314
  )
@@ -312,7 +316,7 @@ class NeutronCommandWithExtraArgs(command.Command):
312
316
  return converter
313
317
 
314
318
  def _parse_extra_properties(self, extra_properties):
315
- result = {}
319
+ result: dict[str, ty.Any] = {}
316
320
  if extra_properties:
317
321
  for _property in extra_properties:
318
322
  converter = self._get_property_converter(_property)
@@ -345,7 +349,7 @@ class NeutronCommandWithExtraArgs(command.Command):
345
349
 
346
350
  class NeutronUnsetCommandWithExtraArgs(NeutronCommandWithExtraArgs):
347
351
  def _parse_extra_properties(self, extra_properties):
348
- result = {}
352
+ result: dict[str, ty.Any] = {}
349
353
  if extra_properties:
350
354
  for _property in extra_properties:
351
355
  result[_property['name']] = None
@@ -23,7 +23,7 @@ def transform_compute_security_group_rule(sg_rule):
23
23
  from_port = info.pop('from_port')
24
24
  to_port = info.pop('to_port')
25
25
  if isinstance(from_port, int) and isinstance(to_port, int):
26
- port_range = {'port_range': "%u:%u" % (from_port, to_port)}
26
+ port_range = {'port_range': f"{from_port}:{to_port}"}
27
27
  elif from_port is None and to_port is None:
28
28
  port_range = {'port_range': ""}
29
29
  else:
@@ -58,12 +58,12 @@ def str2list(strlist):
58
58
  return result
59
59
 
60
60
 
61
- def str2dict(strdict):
61
+ def str2dict(strdict: str) -> dict[str, str]:
62
62
  """Convert key1:value1;key2:value2;... string into dictionary.
63
63
 
64
64
  :param strdict: string in the form of key1:value1;key2:value2
65
65
  """
66
- result = {}
66
+ result: dict[str, str] = {}
67
67
  if not strdict:
68
68
  return result
69
69
  i = 0
@@ -28,10 +28,9 @@ LOG = logging.getLogger(__name__)
28
28
 
29
29
 
30
30
  def _get_columns(item):
31
- column_map = {}
32
31
  hidden_columns = ['location', 'tenant_id']
33
32
  return utils.get_osc_show_columns_for_sdk_resource(
34
- item, column_map, hidden_columns
33
+ item, {}, hidden_columns
35
34
  )
36
35
 
37
36
 
@@ -76,8 +75,7 @@ class CreateAddressGroup(command.ShowOne, common.NeutronCommandWithExtraArgs):
76
75
  action='append',
77
76
  default=[],
78
77
  help=_(
79
- "IP address or CIDR "
80
- "(repeat option to set multiple addresses)"
78
+ "IP address or CIDR (repeat option to set multiple addresses)"
81
79
  ),
82
80
  )
83
81
  parser.add_argument(
@@ -139,7 +137,7 @@ class DeleteAddressGroup(command.Command):
139
137
  if result > 0:
140
138
  total = len(parsed_args.address_group)
141
139
  msg = _(
142
- "%(result)s of %(total)s address groups failed " "to delete."
140
+ "%(result)s of %(total)s address groups failed to delete."
143
141
  ) % {'result': result, 'total': total}
144
142
  raise exceptions.CommandError(msg)
145
143
 
@@ -159,8 +157,7 @@ class ListAddressGroup(command.Lister):
159
157
  '--project',
160
158
  metavar="<project>",
161
159
  help=_(
162
- "List address groups according to their project "
163
- "(name or ID)"
160
+ "List address groups according to their project (name or ID)"
164
161
  ),
165
162
  )
166
163
  identity_common.add_project_domain_option_to_parser(parser)
@@ -233,8 +230,7 @@ class SetAddressGroup(common.NeutronCommandWithExtraArgs):
233
230
  action='append',
234
231
  default=[],
235
232
  help=_(
236
- "IP address or CIDR "
237
- "(repeat option to set multiple addresses)"
233
+ "IP address or CIDR (repeat option to set multiple addresses)"
238
234
  ),
239
235
  )
240
236
  return parser
@@ -144,7 +144,7 @@ class DeleteAddressScope(command.Command):
144
144
  if result > 0:
145
145
  total = len(parsed_args.address_scope)
146
146
  msg = _(
147
- "%(result)s of %(total)s address scopes failed " "to delete."
147
+ "%(result)s of %(total)s address scopes failed to delete."
148
148
  ) % {'result': result, 'total': total}
149
149
  raise exceptions.CommandError(msg)
150
150
 
@@ -176,8 +176,7 @@ class ListAddressScope(command.Lister):
176
176
  '--project',
177
177
  metavar="<project>",
178
178
  help=_(
179
- "List address scopes according to their project "
180
- "(name or ID)"
179
+ "List address scopes according to their project (name or ID)"
181
180
  ),
182
181
  )
183
182
  identity_common.add_project_domain_option_to_parser(parser)
@@ -28,10 +28,9 @@ LOG = logging.getLogger(__name__)
28
28
 
29
29
 
30
30
  def _get_columns(item):
31
- column_map = {}
32
31
  hidden_columns = ['location', 'name', 'revision_number']
33
32
  return utils.get_osc_show_columns_for_sdk_resource(
34
- item, column_map, hidden_columns
33
+ item, {}, hidden_columns
35
34
  )
36
35
 
37
36
 
@@ -13,6 +13,7 @@
13
13
  """IP Floating action implementations"""
14
14
 
15
15
  from openstack import exceptions as sdk_exceptions
16
+ from osc_lib.cli import format_columns
16
17
  from osc_lib import utils
17
18
  from osc_lib.utils import tags as _tag
18
19
 
@@ -22,15 +23,14 @@ from openstackclient.identity import common as identity_common
22
23
  from openstackclient.network import common
23
24
 
24
25
  _formatters = {
25
- 'port_details': utils.format_dict,
26
+ 'port_details': format_columns.DictColumn,
26
27
  }
27
28
 
28
29
 
29
30
  def _get_network_columns(item):
30
- column_map = {}
31
31
  hidden_columns = ['location', 'tenant_id']
32
32
  return utils.get_osc_show_columns_for_sdk_resource(
33
- item, column_map, hidden_columns
33
+ item, {}, hidden_columns
34
34
  )
35
35
 
36
36
 
@@ -123,7 +123,7 @@ class CreateFloatingIP(
123
123
  '--port',
124
124
  metavar='<port>',
125
125
  help=self.enhance_help_neutron(
126
- _("Port to be associated with the floating IP " "(name or ID)")
126
+ _("Port to be associated with the floating IP (name or ID)")
127
127
  ),
128
128
  )
129
129
  parser.add_argument(
@@ -268,10 +268,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
268
268
  '--floating-ip-address',
269
269
  metavar='<ip-address>',
270
270
  help=self.enhance_help_neutron(
271
- _(
272
- "List floating IP(s) according to given floating IP "
273
- "address"
274
- )
271
+ _("List floating IP(s) according to given floating IP address")
275
272
  ),
276
273
  )
277
274
  parser.add_argument(
@@ -308,10 +305,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
308
305
  '--router',
309
306
  metavar='<router>',
310
307
  help=self.enhance_help_neutron(
311
- _(
312
- "List floating IP(s) according to given router (name or "
313
- "ID)"
314
- )
308
+ _("List floating IP(s) according to given router (name or ID)")
315
309
  ),
316
310
  )
317
311
  _tag.add_tag_filtering_option_to_parser(
@@ -324,7 +318,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
324
318
  network_client = self.app.client_manager.network
325
319
  identity_client = self.app.client_manager.identity
326
320
 
327
- columns = (
321
+ columns: tuple[str, ...] = (
328
322
  'id',
329
323
  'floating_ip_address',
330
324
  'fixed_ip_address',
@@ -332,7 +326,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
332
326
  'floating_network_id',
333
327
  'project_id',
334
328
  )
335
- headers = (
329
+ headers: tuple[str, ...] = (
336
330
  'ID',
337
331
  'Floating IP Address',
338
332
  'Fixed IP Address',
@@ -341,7 +335,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
341
335
  'Project',
342
336
  )
343
337
  if parsed_args.long:
344
- columns = columns + (
338
+ columns += (
345
339
  'router_id',
346
340
  'status',
347
341
  'description',
@@ -349,7 +343,7 @@ class ListFloatingIP(common.NetworkAndComputeLister):
349
343
  'dns_name',
350
344
  'dns_domain',
351
345
  )
352
- headers = headers + (
346
+ headers += (
353
347
  'Router',
354
348
  'Status',
355
349
  'Description',
@@ -409,14 +403,14 @@ class ListFloatingIP(common.NetworkAndComputeLister):
409
403
  )
410
404
 
411
405
  def take_action_compute(self, client, parsed_args):
412
- columns = (
406
+ columns: tuple[str, ...] = (
413
407
  'ID',
414
408
  'IP',
415
409
  'Fixed IP',
416
410
  'Instance ID',
417
411
  'Pool',
418
412
  )
419
- headers = (
413
+ headers: tuple[str, ...] = (
420
414
  'ID',
421
415
  'Floating IP Address',
422
416
  'Fixed IP Address',
@@ -458,8 +452,7 @@ class SetFloatingIP(common.NeutronCommandWithExtraArgs):
458
452
  metavar='<ip-address>',
459
453
  dest='fixed_ip_address',
460
454
  help=_(
461
- "Fixed IP of the port "
462
- "(required only if port has multiple IPs)"
455
+ "Fixed IP of the port (required only if port has multiple IPs)"
463
456
  ),
464
457
  )
465
458
  parser.add_argument(
@@ -578,7 +571,7 @@ class UnsetFloatingIP(common.NeutronCommandWithExtraArgs):
578
571
  parsed_args.floating_ip,
579
572
  ignore_missing=False,
580
573
  )
581
- attrs = {}
574
+ attrs: dict[str, None] = {}
582
575
  if parsed_args.port:
583
576
  attrs['port_id'] = None
584
577
  if parsed_args.qos_policy:
@@ -14,6 +14,7 @@
14
14
  """Floating IP Port Forwarding action implementations"""
15
15
 
16
16
  import logging
17
+ import typing as ty
17
18
 
18
19
  from osc_lib.command import command
19
20
  from osc_lib import exceptions
@@ -85,10 +86,9 @@ def validate_port(port):
85
86
 
86
87
 
87
88
  def _get_columns(item):
88
- column_map = {}
89
89
  hidden_columns = ['location', 'tenant_id']
90
90
  return utils.get_osc_show_columns_for_sdk_resource(
91
- item, column_map, hidden_columns
91
+ item, {}, hidden_columns
92
92
  )
93
93
 
94
94
 
@@ -149,7 +149,7 @@ class CreateFloatingIPPortForwarding(
149
149
  '--description',
150
150
  metavar='<description>',
151
151
  help=_(
152
- "A text to describe/contextualize the use of the "
152
+ "Text to describe/contextualize the use of the "
153
153
  "port forwarding configuration"
154
154
  ),
155
155
  )
@@ -165,7 +165,7 @@ class CreateFloatingIPPortForwarding(
165
165
  return parser
166
166
 
167
167
  def take_action(self, parsed_args):
168
- attrs = {}
168
+ attrs: dict[str, ty.Any] = {}
169
169
  client = self.app.client_manager.network
170
170
  floating_ip = client.find_ip(
171
171
  parsed_args.floating_ip,
@@ -243,7 +243,7 @@ class DeleteFloatingIPPortForwarding(command.Command):
243
243
  if result > 0:
244
244
  total = len(parsed_args.port_forwarding_id)
245
245
  msg = _(
246
- "%(result)s of %(total)s Port forwarding failed " "to delete."
246
+ "%(result)s of %(total)s Port forwarding failed to delete."
247
247
  ) % {'result': result, 'total': total}
248
248
  raise exceptions.CommandError(msg)
249
249
 
@@ -280,7 +280,7 @@ class ListFloatingIPPortForwarding(command.Lister):
280
280
  )
281
281
  parser.add_argument(
282
282
  '--protocol',
283
- metavar='protocol',
283
+ metavar='<protocol>',
284
284
  help=_("Filter the list result by the port protocol"),
285
285
  )
286
286
 
@@ -409,7 +409,7 @@ class SetFloatingIPPortForwarding(common.NeutronCommandWithExtraArgs):
409
409
  '--description',
410
410
  metavar='<description>',
411
411
  help=_(
412
- "A text to describe/contextualize the use of "
412
+ "Text to describe/contextualize the use of "
413
413
  "the port forwarding configuration"
414
414
  ),
415
415
  )
@@ -26,10 +26,9 @@ _formatters = {
26
26
 
27
27
 
28
28
  def _get_columns(item):
29
- column_map = {}
30
29
  hidden_columns = ['id', 'name', 'location', 'tenant_id']
31
30
  return utils.get_osc_show_columns_for_sdk_resource(
32
- item, column_map, hidden_columns
31
+ item, {}, hidden_columns
33
32
  )
34
33
 
35
34
 
@@ -25,10 +25,9 @@ LOG = logging.getLogger(__name__)
25
25
 
26
26
 
27
27
  def _get_columns(item):
28
- column_map = {}
29
28
  hidden_columns = ['location', 'tenant_id']
30
29
  return utils.get_osc_show_columns_for_sdk_resource(
31
- item, column_map, hidden_columns
30
+ item, {}, hidden_columns
32
31
  )
33
32
 
34
33
 
@@ -66,8 +65,7 @@ class CreateConntrackHelper(command.ShowOne):
66
65
  required=True,
67
66
  metavar='<protocol>',
68
67
  help=_(
69
- 'The network protocol for the netfilter conntrack target '
70
- 'rule'
68
+ 'The network protocol for the netfilter conntrack target rule'
71
69
  ),
72
70
  )
73
71
  parser.add_argument(
@@ -99,7 +97,7 @@ class DeleteConntrackHelper(command.Command):
99
97
  parser.add_argument(
100
98
  'router',
101
99
  metavar='<router>',
102
- help=_('Router that the conntrack helper belong to'),
100
+ help=_('Router that the conntrack helper belongs to'),
103
101
  )
104
102
  parser.add_argument(
105
103
  'conntrack_helper_id',
@@ -147,7 +145,7 @@ class ListConntrackHelper(command.Lister):
147
145
  parser.add_argument(
148
146
  'router',
149
147
  metavar='<router>',
150
- help=_('Router that the conntrack helper belong to'),
148
+ help=_('Router that the conntrack helper belongs to'),
151
149
  )
152
150
  parser.add_argument(
153
151
  '--helper',
@@ -158,8 +156,7 @@ class ListConntrackHelper(command.Lister):
158
156
  '--protocol',
159
157
  metavar='<protocol>',
160
158
  help=_(
161
- 'The network protocol for the netfilter conntrack target '
162
- 'rule'
159
+ 'The network protocol for the netfilter conntrack target rule'
163
160
  ),
164
161
  )
165
162
  parser.add_argument(
@@ -210,7 +207,7 @@ class SetConntrackHelper(command.Command):
210
207
  parser.add_argument(
211
208
  'router',
212
209
  metavar='<router>',
213
- help=_('Router that the conntrack helper belong to'),
210
+ help=_('Router that the conntrack helper belongs to'),
214
211
  )
215
212
  parser.add_argument(
216
213
  'conntrack_helper_id',
@@ -226,8 +223,7 @@ class SetConntrackHelper(command.Command):
226
223
  '--protocol',
227
224
  metavar='<protocol>',
228
225
  help=_(
229
- 'The network protocol for the netfilter conntrack target '
230
- 'rule'
226
+ 'The network protocol for the netfilter conntrack target rule'
231
227
  ),
232
228
  )
233
229
  parser.add_argument(
@@ -257,7 +253,7 @@ class ShowConntrackHelper(command.ShowOne):
257
253
  parser.add_argument(
258
254
  'router',
259
255
  metavar='<router>',
260
- help=_('Router that the conntrack helper belong to'),
256
+ help=_('Router that the conntrack helper belongs to'),
261
257
  )
262
258
  parser.add_argument(
263
259
  'conntrack_helper_id',
@@ -28,10 +28,9 @@ LOG = logging.getLogger(__name__)
28
28
 
29
29
 
30
30
  def _get_columns(item):
31
- column_map = {}
32
31
  hidden_columns = ['location', 'tenant_id']
33
32
  return utils.get_osc_show_columns_for_sdk_resource(
34
- item, column_map, hidden_columns
33
+ item, {}, hidden_columns
35
34
  )
36
35
 
37
36
 
@@ -74,30 +73,32 @@ class CreateLocalIP(command.ShowOne):
74
73
  def get_parser(self, prog_name):
75
74
  parser = super().get_parser(prog_name)
76
75
  parser.add_argument(
77
- '--name', metavar="<name>", help=_("New local IP name")
76
+ '--name', metavar="<name>", help=_("New Local IP name")
78
77
  )
79
78
  parser.add_argument(
80
79
  '--description',
81
80
  metavar="<description>",
82
- help=_("New local IP description"),
81
+ help=_("Description for Local IP"),
83
82
  )
84
83
  parser.add_argument(
85
84
  '--network',
86
85
  metavar='<network>',
87
- help=_("Network to allocate Local IP (name or ID)"),
86
+ help=_("Network to allocate Local IP from (name or ID)"),
88
87
  )
89
88
  parser.add_argument(
90
89
  '--local-port',
91
90
  metavar='<local-port>',
92
- help=_("Port to allocate Local IP (name or ID)"),
91
+ help=_("Port to allocate Local IP from (name or ID)"),
93
92
  )
94
93
  parser.add_argument(
95
94
  "--local-ip-address",
96
95
  metavar="<local-ip-address>",
97
- help=_("IP address or CIDR "),
96
+ help=_("IP address or CIDR for Local IP"),
98
97
  )
99
98
  parser.add_argument(
100
- '--ip-mode', metavar='<ip-mode>', help=_("local IP ip mode")
99
+ '--ip-mode',
100
+ metavar='<ip-mode>',
101
+ help=_("IP mode to use for Local IP"),
101
102
  )
102
103
 
103
104
  identity_common.add_project_domain_option_to_parser(parser)
@@ -116,7 +117,7 @@ class CreateLocalIP(command.ShowOne):
116
117
 
117
118
 
118
119
  class DeleteLocalIP(command.Command):
119
- _description = _("Delete local IP(s)")
120
+ _description = _("Delete Local IP(s)")
120
121
 
121
122
  def get_parser(self, prog_name):
122
123
  parser = super().get_parser(prog_name)
@@ -149,14 +150,15 @@ class DeleteLocalIP(command.Command):
149
150
 
150
151
  if result > 0:
151
152
  total = len(parsed_args.local_ip)
152
- msg = _(
153
- "%(result)s of %(total)s local IPs failed " "to delete."
154
- ) % {'result': result, 'total': total}
153
+ msg = _("%(result)s of %(total)s local IPs failed to delete.") % {
154
+ 'result': result,
155
+ 'total': total,
156
+ }
155
157
  raise exceptions.CommandError(msg)
156
158
 
157
159
 
158
160
  class SetLocalIP(command.Command):
159
- _description = _("Set local ip properties")
161
+ _description = _("Set Local IP properties")
160
162
 
161
163
  def get_parser(self, prog_name):
162
164
  parser = super().get_parser(prog_name)
@@ -171,7 +173,7 @@ class SetLocalIP(command.Command):
171
173
  parser.add_argument(
172
174
  '--description',
173
175
  metavar="<description>",
174
- help=_('Set local IP description'),
176
+ help=_('Set Local IP description'),
175
177
  )
176
178
  return parser
177
179
 
@@ -188,7 +190,7 @@ class SetLocalIP(command.Command):
188
190
 
189
191
 
190
192
  class ListLocalIP(command.Lister):
191
- _description = _("List local IPs")
193
+ _description = _("List Local IPs")
192
194
 
193
195
  def get_parser(self, prog_name):
194
196
  parser = super().get_parser(prog_name)
@@ -196,36 +198,32 @@ class ListLocalIP(command.Lister):
196
198
  parser.add_argument(
197
199
  '--name',
198
200
  metavar='<name>',
199
- help=_("List only local IPs of given name in output"),
201
+ help=_("List only Local IPs of given name in output"),
200
202
  )
201
203
  parser.add_argument(
202
204
  '--project',
203
205
  metavar="<project>",
204
- help=_(
205
- "List Local IPs according to their project " "(name or ID)"
206
- ),
206
+ help=_("List Local IPs according to their project (name or ID)"),
207
207
  )
208
208
  parser.add_argument(
209
209
  '--network',
210
210
  metavar='<network>',
211
- help=_(
212
- "List Local IP(s) according to " "given network (name or ID)"
213
- ),
211
+ help=_("List Local IP(s) according to given network (name or ID)"),
214
212
  )
215
213
  parser.add_argument(
216
214
  '--local-port',
217
215
  metavar='<local-port>',
218
- help=_("List Local IP(s) according to " "given port (name or ID)"),
216
+ help=_("List Local IP(s) according to given port (name or ID)"),
219
217
  )
220
218
  parser.add_argument(
221
219
  '--local-ip-address',
222
220
  metavar='<local-ip-address>',
223
- help=_("List Local IP(s) according to " "given Local IP Address"),
221
+ help=_("List Local IP(s) according to given Local IP Address"),
224
222
  )
225
223
  parser.add_argument(
226
224
  '--ip-mode',
227
225
  metavar='<ip_mode>',
228
- help=_("List Local IP(s) according to " "given IP mode"),
226
+ help=_("List Local IP(s) according to given IP mode"),
229
227
  )
230
228
 
231
229
  identity_common.add_project_domain_option_to_parser(parser)
@@ -295,7 +293,7 @@ class ListLocalIP(command.Lister):
295
293
 
296
294
 
297
295
  class ShowLocalIP(command.ShowOne):
298
- _description = _("Display local IP details")
296
+ _description = _("Display Local IP details")
299
297
 
300
298
  def get_parser(self, prog_name):
301
299
  parser = super().get_parser(prog_name)