python-openstackclient 9.0.0__py3-none-any.whl → 10.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.
- openstackclient/__init__.py +2 -6
- openstackclient/api/api.py +41 -23
- openstackclient/api/compute_v2.py +44 -25
- openstackclient/api/object_store_v1.py +75 -97
- openstackclient/api/volume_v2.py +2 -1
- openstackclient/api/volume_v3.py +2 -1
- openstackclient/common/availability_zone.py +58 -42
- openstackclient/common/clientmanager.py +56 -29
- openstackclient/common/configuration.py +10 -3
- openstackclient/common/envvars.py +2 -2
- openstackclient/common/extension.py +14 -5
- openstackclient/common/limits.py +10 -5
- openstackclient/common/module.py +14 -6
- openstackclient/common/pagination.py +8 -2
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +13 -7
- openstackclient/common/quota.py +97 -99
- openstackclient/common/versions.py +8 -2
- openstackclient/compute/client.py +7 -3
- openstackclient/compute/v2/agent.py +17 -10
- openstackclient/compute/v2/aggregate.py +36 -22
- openstackclient/compute/v2/console.py +14 -8
- openstackclient/compute/v2/console_connection.py +11 -3
- openstackclient/compute/v2/flavor.py +39 -21
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +14 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +29 -14
- openstackclient/compute/v2/server.py +249 -169
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +21 -12
- openstackclient/compute/v2/server_group.py +21 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +24 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +10 -4
- openstackclient/compute/v2/service.py +14 -7
- openstackclient/compute/v2/usage.py +26 -21
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +78 -47
- openstackclient/identity/v2_0/catalog.py +14 -7
- openstackclient/identity/v2_0/ec2creds.py +21 -10
- openstackclient/identity/v2_0/endpoint.py +23 -11
- openstackclient/identity/v2_0/project.py +25 -14
- openstackclient/identity/v2_0/role.py +28 -14
- openstackclient/identity/v2_0/role_assignment.py +9 -3
- openstackclient/identity/v2_0/service.py +23 -11
- openstackclient/identity/v2_0/token.py +12 -5
- openstackclient/identity/v2_0/user.py +26 -15
- openstackclient/identity/v3/access_rule.py +26 -12
- openstackclient/identity/v3/application_credential.py +59 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +36 -16
- openstackclient/identity/v3/domain.py +37 -18
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +42 -20
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +38 -16
- openstackclient/identity/v3/group.py +55 -32
- openstackclient/identity/v3/identity_provider.py +92 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +38 -16
- openstackclient/identity/v3/mapping.py +26 -13
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +43 -23
- openstackclient/identity/v3/region.py +36 -16
- openstackclient/identity/v3/registered_limit.py +40 -16
- openstackclient/identity/v3/role.py +61 -31
- openstackclient/identity/v3/role_assignment.py +23 -6
- openstackclient/identity/v3/service.py +36 -16
- openstackclient/identity/v3/service_provider.py +37 -15
- openstackclient/identity/v3/tag.py +23 -6
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +32 -14
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +49 -26
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +14 -9
- openstackclient/image/v2/image.py +74 -48
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +109 -13
- openstackclient/image/v2/metadef_objects.py +28 -15
- openstackclient/image/v2/metadef_properties.py +24 -13
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +15 -6
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
- openstackclient/network/client.py +7 -2
- openstackclient/network/common.py +16 -241
- openstackclient/network/utils.py +36 -22
- openstackclient/network/v2/address_group.py +27 -16
- openstackclient/network/v2/address_scope.py +24 -13
- openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +214 -0
- openstackclient/network/v2/bgpvpn/port_association.py +490 -0
- openstackclient/network/v2/bgpvpn/router_association.py +288 -0
- openstackclient/network/v2/default_security_group_rule.py +19 -10
- openstackclient/network/v2/floating_ip.py +110 -159
- openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +466 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +574 -0
- openstackclient/network/v2/ip_availability.py +13 -5
- openstackclient/network/v2/l3_conntrack_helper.py +22 -13
- openstackclient/network/v2/local_ip.py +24 -13
- openstackclient/network/v2/local_ip_association.py +14 -7
- openstackclient/network/v2/ndp_proxy.py +20 -11
- openstackclient/network/v2/network.py +129 -196
- openstackclient/network/v2/network_agent.py +46 -25
- openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
- openstackclient/network/v2/network_flavor.py +27 -16
- openstackclient/network/v2/network_flavor_profile.py +23 -12
- openstackclient/network/v2/network_meter.py +21 -10
- openstackclient/network/v2/network_meter_rule.py +21 -11
- openstackclient/network/v2/network_qos_policy.py +25 -15
- openstackclient/network/v2/network_qos_rule.py +32 -17
- openstackclient/network/v2/network_qos_rule_type.py +13 -5
- openstackclient/network/v2/network_rbac.py +23 -12
- openstackclient/network/v2/network_segment.py +20 -11
- openstackclient/network/v2/network_segment_range.py +56 -29
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +38 -22
- openstackclient/network/v2/port.py +54 -29
- openstackclient/network/v2/router.py +75 -52
- openstackclient/network/v2/security_group.py +87 -157
- openstackclient/network/v2/security_group_rule.py +100 -280
- openstackclient/network/v2/subnet.py +49 -28
- openstackclient/network/v2/subnet_pool.py +30 -17
- openstackclient/network/v2/taas/tap_flow.py +22 -11
- openstackclient/network/v2/taas/tap_mirror.py +22 -11
- openstackclient/network/v2/taas/tap_service.py +23 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +25 -15
- openstackclient/object/v1/object.py +25 -15
- openstackclient/py.typed +0 -0
- openstackclient/shell.py +46 -10
- openstackclient/tests/functional/base.py +55 -20
- openstackclient/tests/functional/common/test_extension.py +4 -0
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +14 -13
- openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
- openstackclient/tests/functional/compute/v2/test_server.py +3 -0
- openstackclient/tests/functional/identity/v2/common.py +10 -6
- openstackclient/tests/functional/identity/v2/test_role.py +4 -4
- openstackclient/tests/functional/identity/v3/common.py +25 -19
- openstackclient/tests/functional/identity/v3/test_group.py +20 -20
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
- openstackclient/tests/functional/identity/v3/test_project.py +10 -10
- openstackclient/tests/functional/identity/v3/test_role.py +18 -18
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/image/base.py +1 -6
- openstackclient/tests/functional/network/v2/common.py +5 -2
- openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
- openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
- openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
- openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
- openstackclient/tests/functional/object/v1/common.py +4 -0
- openstackclient/tests/functional/volume/v2/common.py +4 -0
- openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
- openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
- openstackclient/tests/functional/volume/v3/common.py +4 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +11 -7
- openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
- openstackclient/tests/unit/common/test_availability_zone.py +35 -49
- openstackclient/tests/unit/common/test_extension.py +2 -2
- openstackclient/tests/unit/common/test_module.py +12 -7
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +6 -26
- openstackclient/tests/unit/compute/v2/fakes.py +25 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
- openstackclient/tests/unit/compute/v2/test_server.py +11 -96
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/identity/v3/fakes.py +3 -0
- openstackclient/tests/unit/identity/v3/test_group.py +4 -14
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_user.py +4 -4
- openstackclient/tests/unit/image/v2/test_image.py +11 -11
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
- openstackclient/tests/unit/network/test_common.py +0 -155
- openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
- openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
- openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_router.py +8 -9
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
- openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
- openstackclient/tests/unit/object/v1/fakes.py +8 -7
- openstackclient/tests/unit/object/v1/test_container.py +65 -101
- openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
- openstackclient/tests/unit/object/v1/test_object.py +44 -84
- openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
- openstackclient/tests/unit/test_hacking.py +108 -0
- openstackclient/tests/unit/volume/v2/fakes.py +1 -0
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +1 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +60 -3
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
- openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
- openstackclient/volume/client.py +7 -3
- openstackclient/volume/v2/backup_record.py +15 -6
- openstackclient/volume/v2/consistency_group.py +29 -17
- openstackclient/volume/v2/consistency_group_snapshot.py +25 -10
- openstackclient/volume/v2/qos_specs.py +28 -17
- openstackclient/volume/v2/service.py +17 -6
- openstackclient/volume/v2/volume.py +57 -29
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +46 -20
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +50 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- openstackclient/volume/v3/block_storage_cleanup.py +11 -3
- openstackclient/volume/v3/block_storage_cluster.py +19 -7
- openstackclient/volume/v3/block_storage_log_level.py +15 -6
- openstackclient/volume/v3/block_storage_manage.py +10 -4
- openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +89 -39
- openstackclient/volume/v3/volume_attachment.py +43 -21
- openstackclient/volume/v3/volume_backup.py +53 -24
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +32 -13
- openstackclient/volume/v3/volume_group_type.py +26 -13
- openstackclient/volume/v3/volume_message.py +15 -7
- openstackclient/volume/v3/volume_snapshot.py +69 -32
- openstackclient/volume/v3/volume_transfer_request.py +31 -13
- openstackclient/volume/v3/volume_type.py +42 -24
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +271 -260
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +4 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
- openstackclient/api/image_v1.py +0 -69
- openstackclient/api/image_v2.py +0 -79
- openstackclient/network/v2/floating_ip_pool.py +0 -38
- openstackclient/tests/functional/image/v1/test_image.py +0 -97
- openstackclient/tests/unit/api/test_image_v1.py +0 -96
- openstackclient/tests/unit/api/test_image_v2.py +0 -96
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
- openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
- python_openstackclient-9.0.0.dist-info/pbr.json +0 -1
- /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
openstackclient/common/quota.py
CHANGED
|
@@ -18,15 +18,16 @@ import argparse
|
|
|
18
18
|
import itertools
|
|
19
19
|
import logging
|
|
20
20
|
import sys
|
|
21
|
-
import
|
|
21
|
+
from collections.abc import Iterable, Sequence
|
|
22
|
+
from typing import Any
|
|
22
23
|
|
|
23
24
|
from openstack import exceptions as sdk_exceptions
|
|
25
|
+
from openstack import utils as sdk_utils
|
|
24
26
|
from osc_lib import exceptions
|
|
25
27
|
from osc_lib import utils
|
|
26
28
|
|
|
27
29
|
from openstackclient import command
|
|
28
30
|
from openstackclient.i18n import _
|
|
29
|
-
from openstackclient.network import common
|
|
30
31
|
|
|
31
32
|
LOG = logging.getLogger(__name__)
|
|
32
33
|
|
|
@@ -61,13 +62,6 @@ IMPACT_VOLUME_TYPE_QUOTAS = [
|
|
|
61
62
|
'volumes',
|
|
62
63
|
]
|
|
63
64
|
|
|
64
|
-
NOVA_NETWORK_QUOTAS = {
|
|
65
|
-
'fixed_ips': 'fixed-ips',
|
|
66
|
-
'floating_ips': 'floating-ips',
|
|
67
|
-
'security_group_rules': 'secgroup-rules',
|
|
68
|
-
'security_groups': 'secgroups',
|
|
69
|
-
}
|
|
70
|
-
|
|
71
65
|
NETWORK_QUOTAS = {
|
|
72
66
|
'floatingip': 'floating-ips',
|
|
73
67
|
'security_group_rule': 'secgroup-rules',
|
|
@@ -93,9 +87,13 @@ NETWORK_KEYS = [
|
|
|
93
87
|
]
|
|
94
88
|
|
|
95
89
|
|
|
96
|
-
def _xform_get_quota(
|
|
97
|
-
|
|
98
|
-
|
|
90
|
+
def _xform_get_quota(
|
|
91
|
+
data: Any,
|
|
92
|
+
value: str,
|
|
93
|
+
keys: Any,
|
|
94
|
+
) -> list[dict[str, Any]]:
|
|
95
|
+
res: list[dict[str, Any]] = []
|
|
96
|
+
res_info: dict[str, Any] = {}
|
|
99
97
|
for key in keys:
|
|
100
98
|
res_info[key] = getattr(data, key, '')
|
|
101
99
|
|
|
@@ -104,17 +102,21 @@ def _xform_get_quota(data, value, keys):
|
|
|
104
102
|
return res
|
|
105
103
|
|
|
106
104
|
|
|
107
|
-
def get_project(app, project):
|
|
105
|
+
def get_project(app: Any, project: str | None) -> dict[str, str | None]:
|
|
108
106
|
if project is not None:
|
|
109
|
-
identity_client =
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
107
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
108
|
+
app.client_manager.sdk_connection.identity, '3'
|
|
109
|
+
)
|
|
110
|
+
found_project = identity_client.find_project(
|
|
111
|
+
project, ignore_missing=False
|
|
112
|
+
)
|
|
113
|
+
project_id = found_project.id
|
|
114
|
+
project_name = found_project.name
|
|
113
115
|
elif app.client_manager.auth_ref:
|
|
114
116
|
# Get the project from the current auth
|
|
115
|
-
|
|
116
|
-
project_id =
|
|
117
|
-
project_name =
|
|
117
|
+
auth_ref = app.client_manager.auth_ref
|
|
118
|
+
project_id = auth_ref.project_id
|
|
119
|
+
project_name = auth_ref.project_name
|
|
118
120
|
else:
|
|
119
121
|
project_id = None
|
|
120
122
|
project_name = None
|
|
@@ -126,12 +128,12 @@ def get_project(app, project):
|
|
|
126
128
|
|
|
127
129
|
|
|
128
130
|
def get_compute_quotas(
|
|
129
|
-
app,
|
|
130
|
-
project_id,
|
|
131
|
+
app: Any,
|
|
132
|
+
project_id: str | None,
|
|
131
133
|
*,
|
|
132
|
-
detail=False,
|
|
133
|
-
default=False,
|
|
134
|
-
):
|
|
134
|
+
detail: bool = False,
|
|
135
|
+
default: bool = False,
|
|
136
|
+
) -> dict[str, Any]:
|
|
135
137
|
try:
|
|
136
138
|
client = app.client_manager.compute
|
|
137
139
|
if default:
|
|
@@ -140,7 +142,7 @@ def get_compute_quotas(
|
|
|
140
142
|
quota = client.get_quota_set(project_id, usage=detail)
|
|
141
143
|
except sdk_exceptions.EndpointNotFound:
|
|
142
144
|
return {}
|
|
143
|
-
data = quota.to_dict()
|
|
145
|
+
data: dict[str, Any] = quota.to_dict()
|
|
144
146
|
if not detail:
|
|
145
147
|
del data['usage']
|
|
146
148
|
del data['reservation']
|
|
@@ -148,12 +150,12 @@ def get_compute_quotas(
|
|
|
148
150
|
|
|
149
151
|
|
|
150
152
|
def get_volume_quotas(
|
|
151
|
-
app,
|
|
152
|
-
project_id,
|
|
153
|
+
app: Any,
|
|
154
|
+
project_id: str | None,
|
|
153
155
|
*,
|
|
154
|
-
detail=False,
|
|
155
|
-
default=False,
|
|
156
|
-
):
|
|
156
|
+
detail: bool = False,
|
|
157
|
+
default: bool = False,
|
|
158
|
+
) -> dict[str, Any]:
|
|
157
159
|
try:
|
|
158
160
|
client = app.client_manager.sdk_connection.volume
|
|
159
161
|
if default:
|
|
@@ -162,7 +164,7 @@ def get_volume_quotas(
|
|
|
162
164
|
quota = client.get_quota_set(project_id, usage=detail)
|
|
163
165
|
except sdk_exceptions.EndpointNotFound:
|
|
164
166
|
return {}
|
|
165
|
-
data = quota.to_dict()
|
|
167
|
+
data: dict[str, Any] = quota.to_dict()
|
|
166
168
|
if not detail:
|
|
167
169
|
del data['usage']
|
|
168
170
|
del data['reservation']
|
|
@@ -170,17 +172,19 @@ def get_volume_quotas(
|
|
|
170
172
|
|
|
171
173
|
|
|
172
174
|
def get_network_quotas(
|
|
173
|
-
app,
|
|
174
|
-
project_id,
|
|
175
|
+
app: Any,
|
|
176
|
+
project_id: str | None,
|
|
175
177
|
*,
|
|
176
|
-
detail=False,
|
|
177
|
-
default=False,
|
|
178
|
-
):
|
|
179
|
-
def _network_quota_to_dict(
|
|
180
|
-
|
|
178
|
+
detail: bool = False,
|
|
179
|
+
default: bool = False,
|
|
180
|
+
) -> dict[str, Any]:
|
|
181
|
+
def _network_quota_to_dict(
|
|
182
|
+
network_quota: Any, detail: bool = False
|
|
183
|
+
) -> dict[str, Any]:
|
|
184
|
+
data: dict[str, Any] = network_quota.to_dict(computed=False)
|
|
181
185
|
|
|
182
186
|
if not detail:
|
|
183
|
-
return
|
|
187
|
+
return data
|
|
184
188
|
|
|
185
189
|
# Neutron returns quota details in dict which is in format like:
|
|
186
190
|
# {'resource_name': {'in_use': X, 'limit': Y, 'reserved': Z},
|
|
@@ -200,8 +204,8 @@ def get_network_quotas(
|
|
|
200
204
|
#
|
|
201
205
|
# so we need to make conversion to have data in same format from
|
|
202
206
|
# all of the services
|
|
203
|
-
result: dict[str,
|
|
204
|
-
for key, values in
|
|
207
|
+
result: dict[str, Any] = {"usage": {}, "reservation": {}}
|
|
208
|
+
for key, values in data.items():
|
|
205
209
|
if values is None:
|
|
206
210
|
continue
|
|
207
211
|
if isinstance(values, dict):
|
|
@@ -232,7 +236,7 @@ class ListQuota(command.Lister):
|
|
|
232
236
|
inspected with 'openstack quota show --default'.
|
|
233
237
|
"""
|
|
234
238
|
|
|
235
|
-
def get_parser(self, prog_name):
|
|
239
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
236
240
|
parser = super().get_parser(prog_name)
|
|
237
241
|
option = parser.add_mutually_exclusive_group(required=True)
|
|
238
242
|
option.add_argument(
|
|
@@ -255,7 +259,11 @@ class ListQuota(command.Lister):
|
|
|
255
259
|
)
|
|
256
260
|
return parser
|
|
257
261
|
|
|
258
|
-
def _list_quota_compute(
|
|
262
|
+
def _list_quota_compute(
|
|
263
|
+
self,
|
|
264
|
+
parsed_args: argparse.Namespace,
|
|
265
|
+
project_ids: list[str],
|
|
266
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
259
267
|
compute_client = self.app.client_manager.compute
|
|
260
268
|
result = []
|
|
261
269
|
|
|
@@ -325,7 +333,11 @@ class ListQuota(command.Lister):
|
|
|
325
333
|
(utils.get_dict_properties(s, columns) for s in result),
|
|
326
334
|
)
|
|
327
335
|
|
|
328
|
-
def _list_quota_volume(
|
|
336
|
+
def _list_quota_volume(
|
|
337
|
+
self,
|
|
338
|
+
parsed_args: argparse.Namespace,
|
|
339
|
+
project_ids: list[str],
|
|
340
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
329
341
|
volume_client = self.app.client_manager.sdk_connection.volume
|
|
330
342
|
result = []
|
|
331
343
|
|
|
@@ -383,7 +395,11 @@ class ListQuota(command.Lister):
|
|
|
383
395
|
(utils.get_dict_properties(s, columns) for s in result),
|
|
384
396
|
)
|
|
385
397
|
|
|
386
|
-
def _list_quota_network(
|
|
398
|
+
def _list_quota_network(
|
|
399
|
+
self,
|
|
400
|
+
parsed_args: argparse.Namespace,
|
|
401
|
+
project_ids: list[str],
|
|
402
|
+
) -> tuple[tuple[str, ...], Any]:
|
|
387
403
|
network_client = self.app.client_manager.network
|
|
388
404
|
result = []
|
|
389
405
|
|
|
@@ -447,11 +463,14 @@ class ListQuota(command.Lister):
|
|
|
447
463
|
(utils.get_dict_properties(s, columns) for s in result),
|
|
448
464
|
)
|
|
449
465
|
|
|
450
|
-
def take_action(
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
466
|
+
def take_action(
|
|
467
|
+
self, parsed_args: argparse.Namespace
|
|
468
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
469
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
470
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
project_ids = [p.id for p in identity_client.projects()]
|
|
455
474
|
if parsed_args.compute:
|
|
456
475
|
return self._list_quota_compute(parsed_args, project_ids)
|
|
457
476
|
elif parsed_args.volume:
|
|
@@ -463,44 +482,23 @@ class ListQuota(command.Lister):
|
|
|
463
482
|
return ((), ())
|
|
464
483
|
|
|
465
484
|
|
|
466
|
-
class SetQuota(
|
|
485
|
+
class SetQuota(command.Command):
|
|
467
486
|
_description = _("Set quotas for project or class")
|
|
468
487
|
|
|
469
|
-
def _build_options_list(self):
|
|
488
|
+
def _build_options_list(self) -> list[tuple[str, str, str]]:
|
|
470
489
|
help_fmt = _('New value for the %s quota')
|
|
471
|
-
# Compute and
|
|
490
|
+
# Compute volume and network quota options are always the same
|
|
472
491
|
rets = [
|
|
473
492
|
(k, v, help_fmt % v)
|
|
474
493
|
for k, v in itertools.chain(
|
|
475
494
|
COMPUTE_QUOTAS.items(),
|
|
476
495
|
VOLUME_QUOTAS.items(),
|
|
496
|
+
NETWORK_QUOTAS.items(),
|
|
477
497
|
)
|
|
478
498
|
]
|
|
479
|
-
# For docs build, we want to produce helps for both neutron and
|
|
480
|
-
# nova-network options. They overlap, so we have to figure out which
|
|
481
|
-
# need to be tagged as specific to one network type or the other.
|
|
482
|
-
if self.is_docs_build:
|
|
483
|
-
# NOTE(efried): This takes advantage of the fact that we know the
|
|
484
|
-
# nova-net options are a subset of the neutron options. If that
|
|
485
|
-
# ever changes, this algorithm will need to be adjusted accordingly
|
|
486
|
-
inv_compute = set(NOVA_NETWORK_QUOTAS.values())
|
|
487
|
-
for k, v in NETWORK_QUOTAS.items():
|
|
488
|
-
_help = help_fmt % v
|
|
489
|
-
if v not in inv_compute:
|
|
490
|
-
# This one is unique to neutron
|
|
491
|
-
_help = self.enhance_help_neutron(_help)
|
|
492
|
-
rets.append((k, v, _help))
|
|
493
|
-
elif self.is_neutron:
|
|
494
|
-
rets.extend(
|
|
495
|
-
[(k, v, help_fmt % v) for k, v in NETWORK_QUOTAS.items()]
|
|
496
|
-
)
|
|
497
|
-
elif self.is_nova_network:
|
|
498
|
-
rets.extend(
|
|
499
|
-
[(k, v, help_fmt % v) for k, v in NOVA_NETWORK_QUOTAS.items()]
|
|
500
|
-
)
|
|
501
499
|
return rets
|
|
502
500
|
|
|
503
|
-
def get_parser(self, prog_name):
|
|
501
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
504
502
|
parser = super().get_parser(prog_name)
|
|
505
503
|
parser.add_argument(
|
|
506
504
|
'project',
|
|
@@ -575,7 +573,7 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
|
|
575
573
|
)
|
|
576
574
|
return parser
|
|
577
575
|
|
|
578
|
-
def take_action(self, parsed_args):
|
|
576
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
579
577
|
if parsed_args.quota_class:
|
|
580
578
|
msg = _(
|
|
581
579
|
"The '--class' option has been deprecated. Quota classes were "
|
|
@@ -595,6 +593,9 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
|
|
595
593
|
compute_kwargs = {}
|
|
596
594
|
volume_kwargs = {}
|
|
597
595
|
network_kwargs = {}
|
|
596
|
+
compute_client = None
|
|
597
|
+
volume_client = None
|
|
598
|
+
network_client = None
|
|
598
599
|
|
|
599
600
|
if self.app.client_manager.is_compute_endpoint_enabled():
|
|
600
601
|
compute_client = self.app.client_manager.compute
|
|
@@ -627,11 +628,6 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
|
|
627
628
|
value = getattr(parsed_args, k, None)
|
|
628
629
|
if value is not None:
|
|
629
630
|
network_kwargs[k] = value
|
|
630
|
-
elif self.app.client_manager.is_compute_endpoint_enabled():
|
|
631
|
-
for k, v in NOVA_NETWORK_QUOTAS.items():
|
|
632
|
-
value = getattr(parsed_args, k, None)
|
|
633
|
-
if value is not None:
|
|
634
|
-
compute_kwargs[k] = value
|
|
635
631
|
|
|
636
632
|
if network_kwargs:
|
|
637
633
|
if parsed_args.force is True:
|
|
@@ -643,12 +639,12 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
|
|
643
639
|
network_kwargs['check_limit'] = True
|
|
644
640
|
|
|
645
641
|
if parsed_args.quota_class or parsed_args.default:
|
|
646
|
-
if compute_kwargs:
|
|
642
|
+
if compute_kwargs and compute_client:
|
|
647
643
|
compute_client.update_quota_class_set(
|
|
648
644
|
parsed_args.project or 'default',
|
|
649
645
|
**compute_kwargs,
|
|
650
646
|
)
|
|
651
|
-
if volume_kwargs:
|
|
647
|
+
if volume_kwargs and volume_client:
|
|
652
648
|
volume_client.update_quota_class_set(
|
|
653
649
|
parsed_args.project or 'default',
|
|
654
650
|
**volume_kwargs,
|
|
@@ -664,11 +660,11 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
|
|
664
660
|
project_info = get_project(self.app, parsed_args.project)
|
|
665
661
|
project = project_info['id']
|
|
666
662
|
|
|
667
|
-
if compute_kwargs:
|
|
663
|
+
if compute_kwargs and compute_client:
|
|
668
664
|
compute_client.update_quota_set(project, **compute_kwargs)
|
|
669
|
-
if volume_kwargs:
|
|
665
|
+
if volume_kwargs and volume_client:
|
|
670
666
|
volume_client.update_quota_set(project, **volume_kwargs)
|
|
671
|
-
if network_kwargs:
|
|
667
|
+
if network_kwargs and network_client:
|
|
672
668
|
network_client.update_quota(project, **network_kwargs)
|
|
673
669
|
|
|
674
670
|
|
|
@@ -680,7 +676,7 @@ Specify ``--os-compute-api-version 2.50`` or higher to see ``server-groups``
|
|
|
680
676
|
and ``server-group-members`` output for a given quota class."""
|
|
681
677
|
)
|
|
682
678
|
|
|
683
|
-
def get_parser(self, prog_name):
|
|
679
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
684
680
|
parser = super().get_parser(prog_name)
|
|
685
681
|
parser.add_argument(
|
|
686
682
|
'project',
|
|
@@ -742,7 +738,9 @@ and ``server-group-members`` output for a given quota class."""
|
|
|
742
738
|
|
|
743
739
|
return parser
|
|
744
740
|
|
|
745
|
-
def take_action(
|
|
741
|
+
def take_action(
|
|
742
|
+
self, parsed_args: argparse.Namespace
|
|
743
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
746
744
|
project_info = get_project(self.app, parsed_args.project)
|
|
747
745
|
project = project_info['id']
|
|
748
746
|
|
|
@@ -806,7 +804,7 @@ and ``server-group-members`` output for a given quota class."""
|
|
|
806
804
|
info.update(volume_quota_info)
|
|
807
805
|
info.update(network_quota_info)
|
|
808
806
|
|
|
809
|
-
def _normalize_names(section: dict) -> None:
|
|
807
|
+
def _normalize_names(section: dict[str, Any]) -> None:
|
|
810
808
|
# Map the internal quota names to the external ones
|
|
811
809
|
# COMPUTE_QUOTAS and NETWORK_QUOTAS share floating-ips,
|
|
812
810
|
# secgroup-rules and secgroups as dict value, so when
|
|
@@ -814,7 +812,6 @@ and ``server-group-members`` output for a given quota class."""
|
|
|
814
812
|
# in nova will be replaced by neutron's.
|
|
815
813
|
for k, v in itertools.chain(
|
|
816
814
|
COMPUTE_QUOTAS.items(),
|
|
817
|
-
NOVA_NETWORK_QUOTAS.items(),
|
|
818
815
|
VOLUME_QUOTAS.items(),
|
|
819
816
|
NETWORK_QUOTAS.items(),
|
|
820
817
|
):
|
|
@@ -827,13 +824,11 @@ and ``server-group-members`` output for a given quota class."""
|
|
|
827
824
|
_normalize_names(info["usage"])
|
|
828
825
|
|
|
829
826
|
# Remove the 'id' field since it's not very useful
|
|
830
|
-
|
|
831
|
-
del info['id']
|
|
827
|
+
info.pop('id', None)
|
|
832
828
|
|
|
833
829
|
# Remove the sdk-derived fields
|
|
834
830
|
for field in ('location', 'name', 'force'):
|
|
835
|
-
|
|
836
|
-
del info[field]
|
|
831
|
+
info.pop(field, None)
|
|
837
832
|
|
|
838
833
|
if not parsed_args.usage:
|
|
839
834
|
result = [{'resource': k, 'limit': v} for k, v in info.items()]
|
|
@@ -879,7 +874,7 @@ class DeleteQuota(command.Command):
|
|
|
879
874
|
"Delete configured quota for a project and revert to defaults."
|
|
880
875
|
)
|
|
881
876
|
|
|
882
|
-
def get_parser(self, prog_name):
|
|
877
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
883
878
|
parser = super().get_parser(prog_name)
|
|
884
879
|
parser.add_argument(
|
|
885
880
|
'project',
|
|
@@ -924,8 +919,11 @@ class DeleteQuota(command.Command):
|
|
|
924
919
|
)
|
|
925
920
|
return parser
|
|
926
921
|
|
|
927
|
-
def take_action(self, parsed_args):
|
|
928
|
-
identity_client =
|
|
922
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
923
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
924
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
925
|
+
)
|
|
926
|
+
|
|
929
927
|
project = identity_client.find_project(
|
|
930
928
|
parsed_args.project, ignore_missing=False
|
|
931
929
|
)
|
|
@@ -14,6 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
"""Versions Action Implementation"""
|
|
16
16
|
|
|
17
|
+
import argparse
|
|
18
|
+
from collections.abc import Iterable, Sequence
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
17
21
|
from openstackclient import command
|
|
18
22
|
from openstackclient.i18n import _
|
|
19
23
|
|
|
@@ -21,7 +25,7 @@ from openstackclient.i18n import _
|
|
|
21
25
|
class ShowVersions(command.Lister):
|
|
22
26
|
_description = _("Show available versions of services")
|
|
23
27
|
|
|
24
|
-
def get_parser(self, prog_name):
|
|
28
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
25
29
|
parser = super().get_parser(prog_name)
|
|
26
30
|
interface_group = parser.add_mutually_exclusive_group()
|
|
27
31
|
interface_group.add_argument(
|
|
@@ -67,7 +71,9 @@ class ShowVersions(command.Lister):
|
|
|
67
71
|
)
|
|
68
72
|
return parser
|
|
69
73
|
|
|
70
|
-
def take_action(
|
|
74
|
+
def take_action(
|
|
75
|
+
self, parsed_args: argparse.Namespace
|
|
76
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
71
77
|
interface = parsed_args.interface
|
|
72
78
|
if parsed_args.is_all_interfaces:
|
|
73
79
|
interface = None
|
|
@@ -12,7 +12,9 @@
|
|
|
12
12
|
# License for the specific language governing permissions and limitations
|
|
13
13
|
# under the License.
|
|
14
14
|
|
|
15
|
+
import argparse
|
|
15
16
|
import logging
|
|
17
|
+
from typing import Any
|
|
16
18
|
|
|
17
19
|
from osc_lib import utils
|
|
18
20
|
|
|
@@ -27,7 +29,7 @@ API_NAME = 'compute'
|
|
|
27
29
|
API_VERSIONS = ('2', '2.1')
|
|
28
30
|
|
|
29
31
|
|
|
30
|
-
def make_client(instance):
|
|
32
|
+
def make_client(instance: Any) -> Any:
|
|
31
33
|
"""Returns a compute service client."""
|
|
32
34
|
LOG.debug(
|
|
33
35
|
'Compute client initialized using OpenStack SDK: %s',
|
|
@@ -36,7 +38,9 @@ def make_client(instance):
|
|
|
36
38
|
return instance.sdk_connection.compute
|
|
37
39
|
|
|
38
40
|
|
|
39
|
-
def build_option_parser(
|
|
41
|
+
def build_option_parser(
|
|
42
|
+
parser: argparse.ArgumentParser,
|
|
43
|
+
) -> argparse.ArgumentParser:
|
|
40
44
|
"""Hook to add global options"""
|
|
41
45
|
parser.add_argument(
|
|
42
46
|
'--os-compute-api-version',
|
|
@@ -48,6 +52,6 @@ def build_option_parser(parser):
|
|
|
48
52
|
return parser
|
|
49
53
|
|
|
50
54
|
|
|
51
|
-
def check_api_version(check_version):
|
|
55
|
+
def check_api_version(check_version: str) -> bool:
|
|
52
56
|
# SDK supports auto-negotiation for us: always return True
|
|
53
57
|
return True
|
|
@@ -11,11 +11,13 @@
|
|
|
11
11
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
12
12
|
# License for the specific language governing permissions and limitations
|
|
13
13
|
# under the License.
|
|
14
|
-
#
|
|
15
14
|
|
|
16
15
|
"""Agent action implementations"""
|
|
17
16
|
|
|
17
|
+
import argparse
|
|
18
|
+
from collections.abc import Iterable, Sequence
|
|
18
19
|
import logging
|
|
20
|
+
from typing import Any
|
|
19
21
|
|
|
20
22
|
from openstack import exceptions as sdk_exceptions
|
|
21
23
|
from osc_lib import exceptions
|
|
@@ -36,7 +38,7 @@ class CreateAgent(command.ShowOne):
|
|
|
36
38
|
23.0.0 (Wallaby) release.
|
|
37
39
|
"""
|
|
38
40
|
|
|
39
|
-
def get_parser(self, prog_name):
|
|
41
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
40
42
|
parser = super().get_parser(prog_name)
|
|
41
43
|
parser.add_argument("os", metavar="<os>", help=_("Type of OS"))
|
|
42
44
|
parser.add_argument(
|
|
@@ -55,7 +57,9 @@ class CreateAgent(command.ShowOne):
|
|
|
55
57
|
)
|
|
56
58
|
return parser
|
|
57
59
|
|
|
58
|
-
def take_action(
|
|
60
|
+
def take_action(
|
|
61
|
+
self, parsed_args: argparse.Namespace
|
|
62
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
59
63
|
compute_client = self.app.client_manager.compute
|
|
60
64
|
|
|
61
65
|
# doing this since openstacksdk has decided not to support this
|
|
@@ -76,7 +80,8 @@ class CreateAgent(command.ShowOne):
|
|
|
76
80
|
sdk_exceptions.raise_from_response(response)
|
|
77
81
|
agent = response.json().get('agent')
|
|
78
82
|
|
|
79
|
-
|
|
83
|
+
col_headers, col_data = zip(*sorted(agent.items()))
|
|
84
|
+
return col_headers, col_data
|
|
80
85
|
|
|
81
86
|
|
|
82
87
|
class DeleteAgent(command.Command):
|
|
@@ -87,14 +92,14 @@ class DeleteAgent(command.Command):
|
|
|
87
92
|
23.0.0 (Wallaby) release.
|
|
88
93
|
"""
|
|
89
94
|
|
|
90
|
-
def get_parser(self, prog_name):
|
|
95
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
91
96
|
parser = super().get_parser(prog_name)
|
|
92
97
|
parser.add_argument(
|
|
93
98
|
"id", metavar="<id>", nargs='+', help=_("ID of agent(s) to delete")
|
|
94
99
|
)
|
|
95
100
|
return parser
|
|
96
101
|
|
|
97
|
-
def take_action(self, parsed_args):
|
|
102
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
98
103
|
compute_client = self.app.client_manager.compute
|
|
99
104
|
result = 0
|
|
100
105
|
for id in parsed_args.id:
|
|
@@ -129,7 +134,7 @@ class ListAgent(command.Lister):
|
|
|
129
134
|
23.0.0 (Wallaby) release.
|
|
130
135
|
"""
|
|
131
136
|
|
|
132
|
-
def get_parser(self, prog_name):
|
|
137
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
133
138
|
parser = super().get_parser(prog_name)
|
|
134
139
|
parser.add_argument(
|
|
135
140
|
"--hypervisor",
|
|
@@ -138,7 +143,9 @@ class ListAgent(command.Lister):
|
|
|
138
143
|
)
|
|
139
144
|
return parser
|
|
140
145
|
|
|
141
|
-
def take_action(
|
|
146
|
+
def take_action(
|
|
147
|
+
self, parsed_args: argparse.Namespace
|
|
148
|
+
) -> tuple[tuple[str, ...], Iterable[tuple[Any, ...]]]:
|
|
142
149
|
compute_client = self.app.client_manager.compute
|
|
143
150
|
columns = (
|
|
144
151
|
"Agent ID",
|
|
@@ -171,7 +178,7 @@ class SetAgent(command.Command):
|
|
|
171
178
|
23.0.0 (Wallaby) release.
|
|
172
179
|
"""
|
|
173
180
|
|
|
174
|
-
def get_parser(self, prog_name):
|
|
181
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
175
182
|
parser = super().get_parser(prog_name)
|
|
176
183
|
parser.add_argument(
|
|
177
184
|
"id",
|
|
@@ -193,7 +200,7 @@ class SetAgent(command.Command):
|
|
|
193
200
|
)
|
|
194
201
|
return parser
|
|
195
202
|
|
|
196
|
-
def take_action(self, parsed_args):
|
|
203
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
197
204
|
compute_client = self.app.client_manager.compute
|
|
198
205
|
|
|
199
206
|
response = compute_client.get('/os-agents', microversion='2.1')
|