python-openstackclient 8.2.0__py3-none-any.whl → 9.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 (233) hide show
  1. openstackclient/api/object_store_v1.py +4 -1
  2. openstackclient/command.py +27 -0
  3. openstackclient/common/availability_zone.py +1 -1
  4. openstackclient/common/clientmanager.py +59 -21
  5. openstackclient/common/configuration.py +1 -1
  6. openstackclient/common/extension.py +1 -1
  7. openstackclient/common/limits.py +1 -1
  8. openstackclient/common/module.py +5 -3
  9. openstackclient/common/project_cleanup.py +10 -8
  10. openstackclient/common/quota.py +54 -23
  11. openstackclient/common/versions.py +1 -2
  12. openstackclient/compute/v2/agent.py +1 -1
  13. openstackclient/compute/v2/aggregate.py +6 -5
  14. openstackclient/compute/v2/console.py +5 -3
  15. openstackclient/compute/v2/console_connection.py +1 -1
  16. openstackclient/compute/v2/flavor.py +1 -1
  17. openstackclient/compute/v2/host.py +1 -1
  18. openstackclient/compute/v2/hypervisor.py +1 -1
  19. openstackclient/compute/v2/hypervisor_stats.py +1 -1
  20. openstackclient/compute/v2/keypair.py +1 -1
  21. openstackclient/compute/v2/server.py +78 -29
  22. openstackclient/compute/v2/server_backup.py +1 -1
  23. openstackclient/compute/v2/server_event.py +1 -1
  24. openstackclient/compute/v2/server_group.py +4 -2
  25. openstackclient/compute/v2/server_image.py +1 -1
  26. openstackclient/compute/v2/server_migration.py +1 -1
  27. openstackclient/compute/v2/server_volume.py +1 -1
  28. openstackclient/compute/v2/service.py +1 -1
  29. openstackclient/compute/v2/usage.py +6 -4
  30. openstackclient/identity/common.py +33 -1
  31. openstackclient/identity/v2_0/catalog.py +3 -2
  32. openstackclient/identity/v2_0/ec2creds.py +1 -1
  33. openstackclient/identity/v2_0/endpoint.py +1 -1
  34. openstackclient/identity/v2_0/project.py +17 -7
  35. openstackclient/identity/v2_0/role.py +1 -1
  36. openstackclient/identity/v2_0/role_assignment.py +3 -3
  37. openstackclient/identity/v2_0/service.py +4 -2
  38. openstackclient/identity/v2_0/token.py +1 -1
  39. openstackclient/identity/v2_0/user.py +2 -2
  40. openstackclient/identity/v3/access_rule.py +16 -4
  41. openstackclient/identity/v3/application_credential.py +30 -10
  42. openstackclient/identity/v3/catalog.py +3 -3
  43. openstackclient/identity/v3/consumer.py +1 -1
  44. openstackclient/identity/v3/credential.py +1 -1
  45. openstackclient/identity/v3/domain.py +10 -4
  46. openstackclient/identity/v3/ec2creds.py +1 -1
  47. openstackclient/identity/v3/endpoint.py +33 -12
  48. openstackclient/identity/v3/endpoint_group.py +1 -1
  49. openstackclient/identity/v3/federation_protocol.py +40 -41
  50. openstackclient/identity/v3/group.py +11 -5
  51. openstackclient/identity/v3/identity_provider.py +12 -10
  52. openstackclient/identity/v3/implied_role.py +1 -1
  53. openstackclient/identity/v3/limit.py +86 -85
  54. openstackclient/identity/v3/mapping.py +1 -1
  55. openstackclient/identity/v3/policy.py +1 -1
  56. openstackclient/identity/v3/project.py +191 -115
  57. openstackclient/identity/v3/region.py +1 -1
  58. openstackclient/identity/v3/registered_limit.py +97 -109
  59. openstackclient/identity/v3/role.py +20 -39
  60. openstackclient/identity/v3/role_assignment.py +12 -23
  61. openstackclient/identity/v3/service.py +1 -1
  62. openstackclient/identity/v3/service_provider.py +1 -1
  63. openstackclient/identity/v3/tag.py +1 -11
  64. openstackclient/identity/v3/token.py +3 -2
  65. openstackclient/identity/v3/trust.py +4 -2
  66. openstackclient/identity/v3/unscoped_saml.py +1 -1
  67. openstackclient/identity/v3/user.py +22 -13
  68. openstackclient/image/v1/image.py +19 -16
  69. openstackclient/image/v2/cache.py +1 -1
  70. openstackclient/image/v2/image.py +16 -12
  71. openstackclient/image/v2/info.py +1 -1
  72. openstackclient/image/v2/metadef_namespaces.py +1 -1
  73. openstackclient/image/v2/metadef_objects.py +1 -1
  74. openstackclient/image/v2/metadef_properties.py +3 -2
  75. openstackclient/image/v2/metadef_resource_type_association.py +1 -1
  76. openstackclient/image/v2/metadef_resource_types.py +1 -1
  77. openstackclient/image/v2/task.py +1 -1
  78. openstackclient/network/common.py +10 -9
  79. openstackclient/network/v2/address_group.py +4 -3
  80. openstackclient/network/v2/address_scope.py +8 -6
  81. openstackclient/network/v2/default_security_group_rule.py +9 -8
  82. openstackclient/network/v2/floating_ip.py +16 -9
  83. openstackclient/network/v2/floating_ip_port_forwarding.py +9 -6
  84. openstackclient/network/v2/ip_availability.py +7 -4
  85. openstackclient/network/v2/l3_conntrack_helper.py +11 -4
  86. openstackclient/network/v2/local_ip.py +13 -7
  87. openstackclient/network/v2/local_ip_association.py +7 -4
  88. openstackclient/network/v2/ndp_proxy.py +13 -6
  89. openstackclient/network/v2/network.py +33 -16
  90. openstackclient/network/v2/network_agent.py +5 -5
  91. openstackclient/network/v2/network_auto_allocated_topology.py +1 -1
  92. openstackclient/network/v2/network_flavor.py +1 -1
  93. openstackclient/network/v2/network_flavor_profile.py +1 -1
  94. openstackclient/network/v2/network_meter.py +1 -1
  95. openstackclient/network/v2/network_meter_rule.py +1 -1
  96. openstackclient/network/v2/network_qos_policy.py +7 -5
  97. openstackclient/network/v2/network_qos_rule.py +1 -1
  98. openstackclient/network/v2/network_qos_rule_type.py +1 -1
  99. openstackclient/network/v2/network_rbac.py +8 -5
  100. openstackclient/network/v2/network_segment.py +2 -2
  101. openstackclient/network/v2/network_segment_range.py +13 -6
  102. openstackclient/network/v2/network_service_provider.py +1 -1
  103. openstackclient/network/v2/network_trunk.py +65 -42
  104. openstackclient/network/v2/port.py +22 -20
  105. openstackclient/network/v2/router.py +19 -8
  106. openstackclient/network/v2/security_group.py +10 -6
  107. openstackclient/network/v2/security_group_rule.py +11 -5
  108. openstackclient/network/v2/subnet.py +17 -18
  109. openstackclient/network/v2/subnet_pool.py +11 -9
  110. openstackclient/network/v2/taas/__init__.py +0 -0
  111. openstackclient/network/v2/taas/tap_flow.py +245 -0
  112. openstackclient/network/v2/taas/tap_mirror.py +237 -0
  113. openstackclient/network/v2/taas/tap_service.py +211 -0
  114. openstackclient/object/v1/account.py +1 -1
  115. openstackclient/object/v1/container.py +1 -1
  116. openstackclient/object/v1/object.py +1 -1
  117. openstackclient/shell.py +18 -8
  118. openstackclient/tests/functional/identity/v3/test_catalog.py +42 -23
  119. openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
  120. openstackclient/tests/functional/identity/v3/test_role_assignment.py +174 -0
  121. openstackclient/tests/functional/image/v2/test_cache.py +54 -0
  122. openstackclient/tests/functional/image/v2/test_metadef_objects.py +69 -0
  123. openstackclient/tests/functional/image/v2/test_metadef_resource_type.py +55 -0
  124. openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +46 -132
  125. openstackclient/tests/unit/common/test_command.py +1 -1
  126. openstackclient/tests/unit/common/test_extension.py +2 -3
  127. openstackclient/tests/unit/common/test_module.py +14 -7
  128. openstackclient/tests/unit/common/test_quota.py +79 -0
  129. openstackclient/tests/unit/compute/v2/test_aggregate.py +5 -3
  130. openstackclient/tests/unit/compute/v2/test_console.py +1 -4
  131. openstackclient/tests/unit/compute/v2/test_flavor.py +1 -3
  132. openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -9
  133. openstackclient/tests/unit/compute/v2/test_server.py +370 -38
  134. openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -3
  135. openstackclient/tests/unit/compute/v2/test_service.py +1 -3
  136. openstackclient/tests/unit/fakes.py +35 -134
  137. openstackclient/tests/unit/identity/test_common.py +100 -0
  138. openstackclient/tests/unit/identity/v2_0/test_project.py +4 -4
  139. openstackclient/tests/unit/identity/v3/fakes.py +10 -2
  140. openstackclient/tests/unit/identity/v3/test_application_credential.py +3 -3
  141. openstackclient/tests/unit/identity/v3/test_domain.py +1 -1
  142. openstackclient/tests/unit/identity/v3/test_endpoint.py +1 -1
  143. openstackclient/tests/unit/identity/v3/test_group.py +4 -2
  144. openstackclient/tests/unit/identity/v3/test_identity_provider.py +10 -10
  145. openstackclient/tests/unit/identity/v3/test_limit.py +197 -145
  146. openstackclient/tests/unit/identity/v3/test_oauth.py +1 -1
  147. openstackclient/tests/unit/identity/v3/test_project.py +832 -513
  148. openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
  149. openstackclient/tests/unit/identity/v3/test_registered_limit.py +356 -221
  150. openstackclient/tests/unit/identity/v3/test_role.py +1 -82
  151. openstackclient/tests/unit/identity/v3/test_user.py +7 -51
  152. openstackclient/tests/unit/image/v2/test_image.py +116 -5
  153. openstackclient/tests/unit/network/test_common.py +9 -13
  154. openstackclient/tests/unit/network/v2/taas/__init__.py +0 -0
  155. openstackclient/tests/unit/network/v2/taas/test_osc_tap_flow.py +276 -0
  156. openstackclient/tests/unit/network/v2/taas/test_osc_tap_mirror.py +288 -0
  157. openstackclient/tests/unit/network/v2/taas/test_osc_tap_service.py +271 -0
  158. openstackclient/tests/unit/network/v2/test_address_group.py +19 -22
  159. openstackclient/tests/unit/network/v2/test_address_scope.py +10 -15
  160. openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +38 -49
  161. openstackclient/tests/unit/network/v2/test_floating_ip_network.py +21 -27
  162. openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +21 -18
  163. openstackclient/tests/unit/network/v2/test_ip_availability.py +6 -8
  164. openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +6 -15
  165. openstackclient/tests/unit/network/v2/test_local_ip.py +12 -23
  166. openstackclient/tests/unit/network/v2/test_local_ip_association.py +13 -18
  167. openstackclient/tests/unit/network/v2/test_ndp_proxy.py +11 -21
  168. openstackclient/tests/unit/network/v2/test_network.py +41 -37
  169. openstackclient/tests/unit/network/v2/test_network_agent.py +13 -20
  170. openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +5 -8
  171. openstackclient/tests/unit/network/v2/test_network_flavor.py +14 -26
  172. openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +14 -17
  173. openstackclient/tests/unit/network/v2/test_network_meter.py +7 -17
  174. openstackclient/tests/unit/network/v2/test_network_meter_rule.py +10 -20
  175. openstackclient/tests/unit/network/v2/test_network_qos_policy.py +7 -13
  176. openstackclient/tests/unit/network/v2/test_network_qos_rule.py +44 -54
  177. openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +2 -7
  178. openstackclient/tests/unit/network/v2/test_network_rbac.py +21 -36
  179. openstackclient/tests/unit/network/v2/test_network_segment.py +13 -29
  180. openstackclient/tests/unit/network/v2/test_network_segment_range.py +20 -19
  181. openstackclient/tests/unit/network/v2/test_network_service_provider.py +1 -4
  182. openstackclient/tests/unit/network/v2/test_network_trunk.py +52 -47
  183. openstackclient/tests/unit/network/v2/test_port.py +75 -86
  184. openstackclient/tests/unit/network/v2/test_router.py +104 -126
  185. openstackclient/tests/unit/network/v2/test_security_group_network.py +19 -26
  186. openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +17 -18
  187. openstackclient/tests/unit/network/v2/test_subnet.py +35 -46
  188. openstackclient/tests/unit/network/v2/test_subnet_pool.py +21 -33
  189. openstackclient/tests/unit/volume/test_find_resource.py +4 -13
  190. openstackclient/tests/unit/volume/v2/test_consistency_group.py +8 -2
  191. openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
  192. openstackclient/tests/unit/volume/v2/test_volume_backup.py +3 -1
  193. openstackclient/tests/unit/volume/v3/test_volume.py +38 -12
  194. openstackclient/tests/unit/volume/v3/test_volume_backup.py +9 -0
  195. openstackclient/volume/client.py +7 -17
  196. openstackclient/volume/v2/backup_record.py +1 -1
  197. openstackclient/volume/v2/consistency_group.py +9 -9
  198. openstackclient/volume/v2/consistency_group_snapshot.py +3 -3
  199. openstackclient/volume/v2/qos_specs.py +3 -3
  200. openstackclient/volume/v2/service.py +1 -1
  201. openstackclient/volume/v2/volume.py +14 -7
  202. openstackclient/volume/v2/volume_backend.py +1 -1
  203. openstackclient/volume/v2/volume_backup.py +7 -5
  204. openstackclient/volume/v2/volume_host.py +1 -2
  205. openstackclient/volume/v2/volume_snapshot.py +4 -4
  206. openstackclient/volume/v2/volume_transfer_request.py +3 -3
  207. openstackclient/volume/v2/volume_type.py +16 -11
  208. openstackclient/volume/v3/block_storage_cleanup.py +1 -1
  209. openstackclient/volume/v3/block_storage_cluster.py +1 -1
  210. openstackclient/volume/v3/block_storage_log_level.py +1 -1
  211. openstackclient/volume/v3/block_storage_manage.py +1 -1
  212. openstackclient/volume/v3/block_storage_resource_filter.py +1 -1
  213. openstackclient/volume/v3/service.py +1 -1
  214. openstackclient/volume/v3/volume.py +16 -9
  215. openstackclient/volume/v3/volume_attachment.py +6 -5
  216. openstackclient/volume/v3/volume_backup.py +20 -5
  217. openstackclient/volume/v3/volume_group.py +1 -1
  218. openstackclient/volume/v3/volume_group_snapshot.py +1 -1
  219. openstackclient/volume/v3/volume_group_type.py +1 -1
  220. openstackclient/volume/v3/volume_message.py +1 -1
  221. openstackclient/volume/v3/volume_snapshot.py +4 -4
  222. openstackclient/volume/v3/volume_transfer_request.py +3 -3
  223. openstackclient/volume/v3/volume_type.py +20 -14
  224. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/METADATA +15 -13
  225. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/RECORD +231 -219
  226. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/WHEEL +1 -1
  227. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/entry_points.txt +15 -0
  228. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info/licenses}/AUTHORS +15 -0
  229. python_openstackclient-9.0.0.dist-info/pbr.json +1 -0
  230. openstackclient/tests/unit/common/test_logs.py +0 -221
  231. python_openstackclient-8.2.0.dist-info/pbr.json +0 -1
  232. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info/licenses}/LICENSE +0 -0
  233. {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/top_level.txt +0 -0
@@ -17,6 +17,7 @@ from openstack.block_storage.v3 import backup as _backup
17
17
  from openstack.block_storage.v3 import snapshot as _snapshot
18
18
  from openstack.block_storage.v3 import volume as _volume
19
19
  from openstack import exceptions as sdk_exceptions
20
+ from openstack.identity.v3 import project as _project
20
21
  from openstack.test import fakes as sdk_fakes
21
22
  from osc_lib import exceptions
22
23
 
@@ -381,6 +382,7 @@ class TestBackupList(volume_fakes.TestVolume):
381
382
  ("marker", None),
382
383
  ("limit", None),
383
384
  ('all_projects', False),
385
+ ("project", None),
384
386
  ]
385
387
 
386
388
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -395,11 +397,14 @@ class TestBackupList(volume_fakes.TestVolume):
395
397
  all_tenants=False,
396
398
  marker=None,
397
399
  limit=None,
400
+ project_id=None,
398
401
  )
399
402
  self.assertEqual(self.columns, columns)
400
403
  self.assertCountEqual(self.data, list(data))
401
404
 
402
405
  def test_backup_list_with_options(self):
406
+ project = sdk_fakes.generate_fake_resource(_project.Project)
407
+ self.identity_sdk_client.find_project.return_value = project
403
408
  arglist = [
404
409
  "--long",
405
410
  "--name",
@@ -413,6 +418,8 @@ class TestBackupList(volume_fakes.TestVolume):
413
418
  "--all-projects",
414
419
  "--limit",
415
420
  "3",
421
+ "--project",
422
+ project.id,
416
423
  ]
417
424
  verifylist = [
418
425
  ("long", True),
@@ -422,6 +429,7 @@ class TestBackupList(volume_fakes.TestVolume):
422
429
  ("marker", self.backups[0].id),
423
430
  ('all_projects', True),
424
431
  ("limit", 3),
432
+ ("project", project.id),
425
433
  ]
426
434
 
427
435
  parsed_args = self.check_parser(self.cmd, arglist, verifylist)
@@ -440,6 +448,7 @@ class TestBackupList(volume_fakes.TestVolume):
440
448
  all_tenants=True,
441
449
  marker=self.backups[0].id,
442
450
  limit=3,
451
+ project_id=project.id,
443
452
  )
444
453
  self.assertEqual(self.columns_long, columns)
445
454
  self.assertCountEqual(self.data_long, list(data))
@@ -20,16 +20,14 @@ from osc_lib import utils
20
20
 
21
21
  from openstackclient.i18n import _
22
22
 
23
-
24
23
  LOG = logging.getLogger(__name__)
25
24
 
26
25
  DEFAULT_API_VERSION = '3'
27
26
  API_VERSION_OPTION = 'os_volume_api_version'
28
- API_NAME = "volume"
27
+ API_NAME = 'volume'
29
28
  API_VERSIONS = {
30
- "1": "cinderclient.v1.client.Client",
31
- "2": "cinderclient.v2.client.Client",
32
- "3": "cinderclient.v3.client.Client",
29
+ '2': 'cinderclient.v2.client.Client',
30
+ '3': 'cinderclient.v3.client.Client',
33
31
  }
34
32
 
35
33
  # Save the microversion if in use
@@ -45,11 +43,6 @@ def make_client(instance):
45
43
  from cinderclient.v3 import volume_snapshots
46
44
  from cinderclient.v3 import volumes
47
45
 
48
- # Check whether the available cinderclient supports v1 or v2
49
- try:
50
- from cinderclient.v1 import services # noqa
51
- except Exception:
52
- del API_VERSIONS['1']
53
46
  try:
54
47
  from cinderclient.v2 import services # noqa
55
48
  except Exception:
@@ -127,21 +120,18 @@ def check_api_version(check_version):
127
120
 
128
121
  global _volume_api_version
129
122
 
130
- # Copy some logic from novaclient 3.3.0 for basic version detection
131
- # NOTE(dtroyer): This is only enough to resume operations using API
132
- # version 3.0 or any valid version supplied by the user.
133
123
  _volume_api_version = api_versions.get_api_version(check_version)
134
124
 
135
125
  # Bypass X.latest format microversion
136
126
  if not _volume_api_version.is_latest():
137
- if _volume_api_version > api_versions.APIVersion("3.0"):
127
+ if _volume_api_version > api_versions.APIVersion('3.0'):
138
128
  if not _volume_api_version.matches(
139
129
  api_versions.MIN_VERSION,
140
130
  api_versions.MAX_VERSION,
141
131
  ):
142
- msg = _("versions supported by client: %(min)s - %(max)s") % {
143
- "min": api_versions.MIN_VERSION,
144
- "max": api_versions.MAX_VERSION,
132
+ msg = _('versions supported by client: %(min)s - %(max)s') % {
133
+ 'min': api_versions.MIN_VERSION,
134
+ 'max': api_versions.MAX_VERSION,
145
135
  }
146
136
  raise exceptions.CommandError(msg)
147
137
 
@@ -16,9 +16,9 @@
16
16
 
17
17
  import logging
18
18
 
19
- from osc_lib.command import command
20
19
  from osc_lib import utils
21
20
 
21
+ from openstackclient import command
22
22
  from openstackclient.i18n import _
23
23
 
24
24
 
@@ -18,10 +18,10 @@ import argparse
18
18
  import logging
19
19
 
20
20
  from osc_lib.cli import format_columns
21
- from osc_lib.command import command
22
21
  from osc_lib import exceptions
23
22
  from osc_lib import utils
24
23
 
24
+ from openstackclient import command
25
25
  from openstackclient.i18n import _
26
26
 
27
27
 
@@ -38,8 +38,8 @@ def _find_volumes(parsed_args_volumes, volume_client):
38
38
  except Exception as e:
39
39
  result += 1
40
40
  LOG.error(
41
- _("Failed to find volume with name or ID '%(volume)s':%(e)s")
42
- % {'volume': volume, 'e': e}
41
+ _("Failed to find volume with name or ID '%(volume)s':%(e)s"),
42
+ {'volume': volume, 'e': e},
43
43
  )
44
44
 
45
45
  return result, uuid
@@ -73,8 +73,8 @@ class AddVolumeToConsistencyGroup(command.Command):
73
73
  if result > 0:
74
74
  total = len(parsed_args.volumes)
75
75
  LOG.error(
76
- _("%(result)s of %(total)s volumes failed to add.")
77
- % {'result': result, 'total': total}
76
+ _("%(result)s of %(total)s volumes failed to add."),
77
+ {'result': result, 'total': total},
78
78
  )
79
79
 
80
80
  if add_uuid:
@@ -226,8 +226,8 @@ class DeleteConsistencyGroup(command.Command):
226
226
  _(
227
227
  "Failed to delete consistency group with "
228
228
  "name or ID '%(consistency_group)s':%(e)s"
229
- )
230
- % {'consistency_group': i, 'e': e}
229
+ ),
230
+ {'consistency_group': i, 'e': e},
231
231
  )
232
232
 
233
233
  if result > 0:
@@ -317,8 +317,8 @@ class RemoveVolumeFromConsistencyGroup(command.Command):
317
317
  if result > 0:
318
318
  total = len(parsed_args.volumes)
319
319
  LOG.error(
320
- _("%(result)s of %(total)s volumes failed to remove.")
321
- % {'result': result, 'total': total}
320
+ _("%(result)s of %(total)s volumes failed to remove."),
321
+ {'result': result, 'total': total},
322
322
  )
323
323
 
324
324
  if remove_uuid:
@@ -16,10 +16,10 @@
16
16
 
17
17
  import logging
18
18
 
19
- from osc_lib.command import command
20
19
  from osc_lib import exceptions
21
20
  from osc_lib import utils
22
21
 
22
+ from openstackclient import command
23
23
  from openstackclient.i18n import _
24
24
 
25
25
 
@@ -101,8 +101,8 @@ class DeleteConsistencyGroupSnapshot(command.Command):
101
101
  _(
102
102
  "Failed to delete consistency group snapshot "
103
103
  "with name or ID '%(snapshot)s': %(e)s"
104
- )
105
- % {'snapshot': snapshot, 'e': e}
104
+ ),
105
+ {'snapshot': snapshot, 'e': e},
106
106
  )
107
107
 
108
108
  if result > 0:
@@ -19,10 +19,10 @@ import logging
19
19
 
20
20
  from osc_lib.cli import format_columns
21
21
  from osc_lib.cli import parseractions
22
- from osc_lib.command import command
23
22
  from osc_lib import exceptions
24
23
  from osc_lib import utils
25
24
 
25
+ from openstackclient import command
26
26
  from openstackclient.i18n import _
27
27
 
28
28
 
@@ -146,8 +146,8 @@ class DeleteQos(command.Command):
146
146
  _(
147
147
  "Failed to delete QoS specification with "
148
148
  "name or ID '%(qos)s': %(e)s"
149
- )
150
- % {'qos': i, 'e': e}
149
+ ),
150
+ {'qos': i, 'e': e},
151
151
  )
152
152
 
153
153
  if result > 0:
@@ -14,10 +14,10 @@
14
14
 
15
15
  """Service action implementations"""
16
16
 
17
- from osc_lib.command import command
18
17
  from osc_lib import exceptions
19
18
  from osc_lib import utils
20
19
 
20
+ from openstackclient import command
21
21
  from openstackclient.i18n import _
22
22
 
23
23
 
@@ -25,11 +25,11 @@ from openstack.block_storage.v2 import volume as _volume
25
25
  from openstack import exceptions as sdk_exceptions
26
26
  from osc_lib.cli import format_columns
27
27
  from osc_lib.cli import parseractions
28
- from osc_lib.command import command
29
28
  from osc_lib import exceptions
30
29
  from osc_lib import utils
31
30
 
32
31
  from openstackclient.api import volume_v2
32
+ from openstackclient import command
33
33
  from openstackclient.common import pagination
34
34
  from openstackclient.i18n import _
35
35
  from openstackclient.identity import common as identity_common
@@ -61,7 +61,7 @@ class KeyValueHintAction(argparse.Action):
61
61
  )
62
62
 
63
63
 
64
- class AttachmentsColumn(cliff_columns.FormattableColumn):
64
+ class AttachmentsColumn(cliff_columns.FormattableColumn[list[ty.Any]]):
65
65
  """Formattable column for attachments column.
66
66
 
67
67
  Unlike the parent FormattableColumn class, the initializer of the
@@ -390,12 +390,19 @@ class DeleteVolume(command.Command):
390
390
  ),
391
391
  )
392
392
  group.add_argument(
393
- "--purge",
393
+ "--cascade",
394
394
  action="store_true",
395
395
  help=_(
396
396
  "Remove any snapshots along with volume(s) (defaults to False)"
397
397
  ),
398
398
  )
399
+ group.add_argument(
400
+ # now called "cascade", accept old arg for compatibility
401
+ "--purge",
402
+ action="store_true",
403
+ help=argparse.SUPPRESS,
404
+ dest='cascade',
405
+ )
399
406
  return parser
400
407
 
401
408
  def take_action(self, parsed_args):
@@ -410,7 +417,7 @@ class DeleteVolume(command.Command):
410
417
  volume_client.delete_volume(
411
418
  volume_obj.id,
412
419
  force=parsed_args.force,
413
- cascade=parsed_args.purge,
420
+ cascade=parsed_args.cascade,
414
421
  )
415
422
  except Exception as e:
416
423
  result += 1
@@ -910,12 +917,12 @@ class SetVolume(command.Command):
910
917
  elif policy:
911
918
  # If the "--migration-policy" is specified without "--type"
912
919
  LOG.warning(
913
- _("'%s' option will not work without '--type' option")
914
- % (
920
+ _("'%s' option will not work without '--type' option"),
921
+ (
915
922
  '--migration-policy'
916
923
  if parsed_args.migration_policy
917
924
  else '--retype-policy'
918
- )
925
+ ),
919
926
  )
920
927
 
921
928
  kwargs = {}
@@ -15,9 +15,9 @@
15
15
  """Storage backend action implementations"""
16
16
 
17
17
  from osc_lib.cli import format_columns
18
- from osc_lib.command import command
19
18
  from osc_lib import utils
20
19
 
20
+ from openstackclient import command
21
21
  from openstackclient.i18n import _
22
22
 
23
23
 
@@ -18,17 +18,17 @@ import functools
18
18
  import logging
19
19
 
20
20
  from cliff import columns as cliff_columns
21
- from osc_lib.command import command
22
21
  from osc_lib import exceptions
23
22
  from osc_lib import utils
24
23
 
24
+ from openstackclient import command
25
25
  from openstackclient.common import pagination
26
26
  from openstackclient.i18n import _
27
27
 
28
28
  LOG = logging.getLogger(__name__)
29
29
 
30
30
 
31
- class VolumeIdColumn(cliff_columns.FormattableColumn):
31
+ class VolumeIdColumn(cliff_columns.FormattableColumn[str]):
32
32
  """Formattable column for volume ID column.
33
33
 
34
34
  Unlike the parent FormattableColumn class, the initializer of the
@@ -175,8 +175,8 @@ class DeleteVolumeBackup(command.Command):
175
175
  _(
176
176
  "Failed to delete backup with "
177
177
  "name or ID '%(backup)s': %(e)s"
178
- )
179
- % {'backup': backup, 'e': e}
178
+ ),
179
+ {'backup': backup, 'e': e},
180
180
  )
181
181
 
182
182
  if result > 0:
@@ -453,7 +453,9 @@ class ShowVolumeBackup(command.ShowOne):
453
453
 
454
454
  def take_action(self, parsed_args):
455
455
  volume_client = self.app.client_manager.sdk_connection.volume
456
- backup = volume_client.find_backup(parsed_args.backup)
456
+ backup = volume_client.find_backup(
457
+ parsed_args.backup, ignore_missing=False
458
+ )
457
459
  columns: tuple[str, ...] = (
458
460
  "availability_zone",
459
461
  "container",
@@ -14,8 +14,7 @@
14
14
 
15
15
  """Volume v2 host action implementations"""
16
16
 
17
- from osc_lib.command import command
18
-
17
+ from openstackclient import command
19
18
  from openstackclient.i18n import _
20
19
 
21
20
 
@@ -22,10 +22,10 @@ from cliff import columns as cliff_columns
22
22
  from openstack.block_storage.v2 import snapshot as _snapshot
23
23
  from osc_lib.cli import format_columns
24
24
  from osc_lib.cli import parseractions
25
- from osc_lib.command import command
26
25
  from osc_lib import exceptions
27
26
  from osc_lib import utils
28
27
 
28
+ from openstackclient import command
29
29
  from openstackclient.common import pagination
30
30
  from openstackclient.i18n import _
31
31
  from openstackclient.identity import common as identity_common
@@ -34,7 +34,7 @@ from openstackclient.identity import common as identity_common
34
34
  LOG = logging.getLogger(__name__)
35
35
 
36
36
 
37
- class VolumeIdColumn(cliff_columns.FormattableColumn):
37
+ class VolumeIdColumn(cliff_columns.FormattableColumn[str]):
38
38
  """Formattable column for volume ID column.
39
39
 
40
40
  Unlike the parent FormattableColumn class, the initializer of the
@@ -228,8 +228,8 @@ class DeleteVolumeSnapshot(command.Command):
228
228
  _(
229
229
  "Failed to delete snapshot with "
230
230
  "name or ID '%(snapshot)s': %(e)s"
231
- )
232
- % {'snapshot': snapshot, 'e': e}
231
+ ),
232
+ {'snapshot': snapshot, 'e': e},
233
233
  )
234
234
 
235
235
  if result > 0:
@@ -16,10 +16,10 @@
16
16
 
17
17
  import logging
18
18
 
19
- from osc_lib.command import command
20
19
  from osc_lib import exceptions
21
20
  from osc_lib import utils
22
21
 
22
+ from openstackclient import command
23
23
  from openstackclient.i18n import _
24
24
 
25
25
 
@@ -128,8 +128,8 @@ class DeleteTransferRequest(command.Command):
128
128
  _(
129
129
  "Failed to delete volume transfer request "
130
130
  "with name or ID '%(transfer)s': %(e)s"
131
- )
132
- % {'transfer': t, 'e': e}
131
+ ),
132
+ {'transfer': t, 'e': e},
133
133
  )
134
134
 
135
135
  if result > 0:
@@ -16,14 +16,15 @@
16
16
 
17
17
  import functools
18
18
  import logging
19
+ import typing as ty
19
20
 
20
21
  from cliff import columns as cliff_columns
21
22
  from osc_lib.cli import format_columns
22
23
  from osc_lib.cli import parseractions
23
- from osc_lib.command import command
24
24
  from osc_lib import exceptions
25
25
  from osc_lib import utils
26
26
 
27
+ from openstackclient import command
27
28
  from openstackclient.i18n import _
28
29
  from openstackclient.identity import common as identity_common
29
30
 
@@ -31,7 +32,7 @@ from openstackclient.identity import common as identity_common
31
32
  LOG = logging.getLogger(__name__)
32
33
 
33
34
 
34
- class EncryptionInfoColumn(cliff_columns.FormattableColumn):
35
+ class EncryptionInfoColumn(cliff_columns.FormattableColumn[ty.Any]):
35
36
  """Formattable column for encryption info column.
36
37
 
37
38
  Unlike the parent FormattableColumn class, the initializer of the
@@ -171,7 +172,8 @@ class CreateVolumeType(command.ShowOne):
171
172
  default=False,
172
173
  help=_(
173
174
  "Enabled replication for this volume type "
174
- "(this is an alias for '--property replication_enabled=<is> True') "
175
+ "(this is an alias for "
176
+ "'--property replication_enabled=<is> True') "
175
177
  "(requires driver support)"
176
178
  ),
177
179
  )
@@ -181,7 +183,8 @@ class CreateVolumeType(command.ShowOne):
181
183
  dest='availability_zones',
182
184
  help=_(
183
185
  "Set an availability zone for this volume type "
184
- "(this is an alias for '--property RESKEY:availability_zones:<az>') "
186
+ "(this is an alias for "
187
+ "'--property RESKEY:availability_zones:<az>') "
185
188
  "(repeat option to set multiple availability zones)"
186
189
  ),
187
190
  )
@@ -274,7 +277,7 @@ class CreateVolumeType(command.ShowOne):
274
277
  msg = _(
275
278
  "Failed to add project %(project)s access to type: %(e)s"
276
279
  )
277
- LOG.error(msg % {'project': parsed_args.project, 'e': e})
280
+ LOG.error(msg, {'project': parsed_args.project, 'e': e})
278
281
 
279
282
  properties = {}
280
283
  if parsed_args.properties:
@@ -355,8 +358,8 @@ class DeleteVolumeType(command.Command):
355
358
  _(
356
359
  "Failed to delete volume type with "
357
360
  "name or ID '%(volume_type)s': %(e)s"
358
- )
359
- % {'volume_type': volume_type, 'e': e}
361
+ ),
362
+ {'volume_type': volume_type, 'e': e},
360
363
  )
361
364
 
362
365
  if result > 0:
@@ -463,7 +466,7 @@ class ListVolumeType(command.Lister):
463
466
  _EncryptionInfoColumn = functools.partial(
464
467
  EncryptionInfoColumn, encryption_data=encryption
465
468
  )
466
- formatters['id'] = _EncryptionInfoColumn
469
+ formatters['id'] = _EncryptionInfoColumn # type: ignore
467
470
 
468
471
  return (
469
472
  column_headers,
@@ -534,7 +537,8 @@ class SetVolumeType(command.Command):
534
537
  default=False,
535
538
  help=_(
536
539
  "Enabled replication for this volume type "
537
- "(this is an alias for '--property replication_enabled=<is> True') "
540
+ "(this is an alias for "
541
+ "'--property replication_enabled=<is> True') "
538
542
  "(requires driver support)"
539
543
  ),
540
544
  )
@@ -544,7 +548,8 @@ class SetVolumeType(command.Command):
544
548
  dest='availability_zones',
545
549
  help=_(
546
550
  "Set an availability zone for this volume type "
547
- "(this is an alias for '--property RESKEY:availability_zones:<az>') "
551
+ "(this is an alias for "
552
+ "'--property RESKEY:availability_zones:<az>') "
548
553
  "(repeat option to set multiple availability zones)"
549
554
  ),
550
555
  )
@@ -758,7 +763,7 @@ class ShowVolumeType(command.ShowOne):
758
763
  'Failed to get access project list for volume type '
759
764
  '%(type)s: %(e)s'
760
765
  )
761
- LOG.error(msg % {'type': volume_type.id, 'e': e})
766
+ LOG.error(msg, {'type': volume_type.id, 'e': e})
762
767
  volume_type._info.update({'access_project_ids': access_project_ids})
763
768
  if parsed_args.encryption_type:
764
769
  # show encryption type information for this volume type
@@ -11,9 +11,9 @@
11
11
  # under the License.
12
12
 
13
13
  from cinderclient import api_versions
14
- from osc_lib.command import command
15
14
  from osc_lib import exceptions
16
15
 
16
+ from openstackclient import command
17
17
  from openstackclient.i18n import _
18
18
 
19
19
 
@@ -11,10 +11,10 @@
11
11
  # under the License.
12
12
 
13
13
  from cinderclient import api_versions
14
- from osc_lib.command import command
15
14
  from osc_lib import exceptions
16
15
  from osc_lib import utils
17
16
 
17
+ from openstackclient import command
18
18
  from openstackclient.i18n import _
19
19
 
20
20
 
@@ -15,9 +15,9 @@
15
15
  """Block Storage Service action implementations"""
16
16
 
17
17
  from openstack import utils as sdk_utils
18
- from osc_lib.command import command
19
18
  from osc_lib import exceptions
20
19
 
20
+ from openstackclient import command
21
21
  from openstackclient.i18n import _
22
22
 
23
23
 
@@ -16,10 +16,10 @@
16
16
  import argparse
17
17
 
18
18
  from cinderclient import api_versions
19
- from osc_lib.command import command
20
19
  from osc_lib import exceptions
21
20
  from osc_lib import utils
22
21
 
22
+ from openstackclient import command
23
23
  from openstackclient.i18n import _
24
24
 
25
25
 
@@ -14,10 +14,10 @@
14
14
 
15
15
  from openstack import utils as sdk_utils
16
16
  from osc_lib.cli import format_columns
17
- from osc_lib.command import command
18
17
  from osc_lib import exceptions
19
18
  from osc_lib import utils
20
19
 
20
+ from openstackclient import command
21
21
  from openstackclient.i18n import _
22
22
 
23
23
 
@@ -15,10 +15,10 @@
15
15
  """Service action implementations"""
16
16
 
17
17
  from openstack import utils as sdk_utils
18
- from osc_lib.command import command
19
18
  from osc_lib import exceptions
20
19
  from osc_lib import utils
21
20
 
21
+ from openstackclient import command
22
22
  from openstackclient.i18n import _
23
23
 
24
24