python-openstackclient 7.4.0__py3-none-any.whl → 8.1.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/common/availability_zone.py +3 -6
- openstackclient/common/clientmanager.py +2 -1
- openstackclient/common/envvars.py +57 -0
- openstackclient/common/extension.py +3 -11
- openstackclient/common/limits.py +1 -1
- openstackclient/common/project_cleanup.py +3 -2
- openstackclient/common/quota.py +54 -28
- openstackclient/compute/client.py +7 -5
- openstackclient/compute/v2/agent.py +5 -5
- openstackclient/compute/v2/aggregate.py +17 -15
- openstackclient/compute/v2/console.py +10 -4
- openstackclient/compute/v2/console_connection.py +48 -0
- openstackclient/compute/v2/flavor.py +14 -18
- openstackclient/compute/v2/host.py +3 -3
- openstackclient/compute/v2/hypervisor.py +10 -4
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +18 -13
- openstackclient/compute/v2/server.py +144 -121
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +8 -17
- openstackclient/compute/v2/server_group.py +6 -6
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +6 -6
- openstackclient/compute/v2/server_volume.py +4 -4
- openstackclient/compute/v2/service.py +9 -13
- openstackclient/compute/v2/usage.py +4 -6
- openstackclient/identity/client.py +2 -4
- openstackclient/identity/common.py +95 -17
- openstackclient/identity/v2_0/ec2creds.py +4 -3
- openstackclient/identity/v2_0/endpoint.py +12 -10
- openstackclient/identity/v2_0/project.py +6 -6
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/service.py +7 -7
- openstackclient/identity/v2_0/user.py +6 -21
- openstackclient/identity/v3/access_rule.py +2 -5
- openstackclient/identity/v3/application_credential.py +2 -2
- openstackclient/identity/v3/consumer.py +4 -3
- openstackclient/identity/v3/credential.py +6 -7
- openstackclient/identity/v3/domain.py +63 -44
- openstackclient/identity/v3/ec2creds.py +4 -3
- openstackclient/identity/v3/endpoint.py +104 -88
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/group.py +116 -72
- openstackclient/identity/v3/identity_provider.py +1 -2
- openstackclient/identity/v3/limit.py +4 -9
- openstackclient/identity/v3/mapping.py +4 -3
- openstackclient/identity/v3/policy.py +5 -8
- openstackclient/identity/v3/project.py +23 -6
- openstackclient/identity/v3/region.py +2 -5
- openstackclient/identity/v3/registered_limit.py +4 -8
- openstackclient/identity/v3/role.py +15 -16
- openstackclient/identity/v3/service.py +8 -8
- openstackclient/identity/v3/service_provider.py +3 -6
- openstackclient/identity/v3/tag.py +2 -2
- openstackclient/identity/v3/token.py +1 -2
- openstackclient/identity/v3/trust.py +74 -25
- openstackclient/identity/v3/user.py +47 -11
- openstackclient/image/client.py +7 -5
- openstackclient/image/v1/image.py +11 -15
- openstackclient/image/v2/cache.py +2 -4
- openstackclient/image/v2/image.py +41 -48
- openstackclient/image/v2/metadef_namespaces.py +4 -3
- openstackclient/image/v2/metadef_resource_type_association.py +1 -2
- openstackclient/image/v2/metadef_resource_types.py +1 -2
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +9 -1370
- openstackclient/network/client.py +4 -16
- openstackclient/network/common.py +16 -12
- openstackclient/network/utils.py +3 -3
- openstackclient/network/v2/address_group.py +5 -9
- openstackclient/network/v2/address_scope.py +2 -3
- openstackclient/network/v2/default_security_group_rule.py +1 -2
- openstackclient/network/v2/floating_ip.py +69 -47
- openstackclient/network/v2/floating_ip_port_forwarding.py +7 -7
- openstackclient/network/v2/ip_availability.py +1 -2
- openstackclient/network/v2/l3_conntrack_helper.py +8 -12
- openstackclient/network/v2/local_ip.py +24 -26
- openstackclient/network/v2/local_ip_association.py +4 -5
- openstackclient/network/v2/ndp_proxy.py +9 -10
- openstackclient/network/v2/network.py +12 -16
- openstackclient/network/v2/network_agent.py +29 -37
- openstackclient/network/v2/network_auto_allocated_topology.py +4 -5
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +5 -5
- openstackclient/network/v2/network_meter.py +3 -3
- openstackclient/network/v2/network_meter_rule.py +5 -8
- openstackclient/network/v2/network_qos_policy.py +4 -4
- openstackclient/network/v2/network_qos_rule.py +7 -16
- openstackclient/network/v2/network_rbac.py +4 -4
- openstackclient/network/v2/network_segment.py +6 -7
- openstackclient/network/v2/network_segment_range.py +16 -20
- openstackclient/network/v2/network_trunk.py +24 -16
- openstackclient/network/v2/port.py +28 -29
- openstackclient/network/v2/router.py +53 -42
- openstackclient/network/v2/security_group.py +13 -19
- openstackclient/network/v2/security_group_rule.py +10 -11
- openstackclient/network/v2/subnet.py +31 -30
- openstackclient/network/v2/subnet_pool.py +4 -4
- openstackclient/object/client.py +2 -3
- openstackclient/object/v1/container.py +2 -3
- openstackclient/object/v1/object.py +2 -9
- openstackclient/shell.py +22 -5
- openstackclient/tests/functional/base.py +7 -3
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +12 -6
- openstackclient/tests/functional/compute/v2/test_keypair.py +41 -5
- openstackclient/tests/functional/compute/v2/test_server.py +2 -3
- openstackclient/tests/functional/compute/v2/test_server_event.py +1 -1
- openstackclient/tests/functional/identity/v2/test_user.py +1 -1
- openstackclient/tests/functional/identity/v3/common.py +3 -8
- openstackclient/tests/functional/identity/v3/test_application_credential.py +10 -10
- openstackclient/tests/functional/identity/v3/test_endpoint.py +3 -3
- openstackclient/tests/functional/identity/v3/test_group.py +3 -3
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -7
- openstackclient/tests/functional/identity/v3/test_limit.py +4 -4
- openstackclient/tests/functional/identity/v3/test_project.py +5 -14
- openstackclient/tests/functional/identity/v3/test_region.py +1 -3
- openstackclient/tests/functional/identity/v3/test_registered_limit.py +3 -3
- openstackclient/tests/functional/identity/v3/test_role.py +1 -1
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +13 -31
- openstackclient/tests/functional/identity/v3/test_service_provider.py +3 -7
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/network/v2/common.py +7 -3
- openstackclient/tests/functional/network/v2/test_address_group.py +4 -0
- openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +15 -11
- openstackclient/tests/functional/network/v2/test_local_ip.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +2 -2
- openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +2 -3
- openstackclient/tests/functional/network/v2/test_network_rbac.py +2 -2
- openstackclient/tests/functional/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/functional/network/v2/test_port.py +17 -7
- openstackclient/tests/functional/network/v2/test_router.py +42 -0
- openstackclient/tests/functional/network/v2/test_subnet_pool.py +4 -0
- openstackclient/tests/unit/api/test_compute_v2.py +67 -87
- openstackclient/tests/unit/common/test_availability_zone.py +6 -14
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +5 -7
- openstackclient/tests/unit/common/test_limits.py +1 -1
- openstackclient/tests/unit/common/test_project_cleanup.py +5 -6
- openstackclient/tests/unit/common/test_quota.py +51 -28
- openstackclient/tests/unit/compute/v2/fakes.py +85 -315
- openstackclient/tests/unit/compute/v2/test_agent.py +16 -16
- openstackclient/tests/unit/compute/v2/test_aggregate.py +56 -60
- openstackclient/tests/unit/compute/v2/test_console.py +34 -17
- openstackclient/tests/unit/compute/v2/test_console_connection.py +72 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +72 -72
- openstackclient/tests/unit/compute/v2/test_host.py +8 -8
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +22 -30
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +36 -29
- openstackclient/tests/unit/compute/v2/test_server.py +693 -606
- openstackclient/tests/unit/compute/v2/test_server_backup.py +36 -77
- openstackclient/tests/unit/compute/v2/test_server_event.py +18 -20
- openstackclient/tests/unit/compute/v2/test_server_group.py +25 -31
- openstackclient/tests/unit/compute/v2/test_server_image.py +37 -78
- openstackclient/tests/unit/compute/v2/test_server_migration.py +41 -41
- openstackclient/tests/unit/compute/v2/test_server_volume.py +12 -12
- openstackclient/tests/unit/compute/v2/test_service.py +39 -45
- openstackclient/tests/unit/compute/v2/test_usage.py +5 -5
- openstackclient/tests/unit/identity/v2_0/fakes.py +1 -1
- openstackclient/tests/unit/identity/v3/test_access_rule.py +1 -3
- openstackclient/tests/unit/identity/v3/test_application_credential.py +48 -26
- openstackclient/tests/unit/identity/v3/test_domain.py +115 -105
- openstackclient/tests/unit/identity/v3/test_endpoint.py +167 -172
- openstackclient/tests/unit/identity/v3/test_group.py +353 -202
- openstackclient/tests/unit/identity/v3/test_mappings.py +2 -2
- openstackclient/tests/unit/identity/v3/test_project.py +16 -0
- openstackclient/tests/unit/identity/v3/test_trust.py +5 -2
- openstackclient/tests/unit/identity/v3/test_user.py +102 -6
- openstackclient/tests/unit/image/v1/fakes.py +2 -2
- openstackclient/tests/unit/image/v1/test_image.py +8 -9
- openstackclient/tests/unit/image/v2/test_image.py +84 -46
- openstackclient/tests/unit/integ/cli/test_shell.py +1 -2
- openstackclient/tests/unit/network/test_common.py +2 -2
- openstackclient/tests/unit/network/v2/fakes.py +405 -485
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +8 -14
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +62 -54
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -1
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +2 -2
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +1 -3
- openstackclient/tests/unit/network/v2/test_network.py +4 -4
- openstackclient/tests/unit/network/v2/test_network_agent.py +15 -29
- openstackclient/tests/unit/network/v2/test_network_compute.py +11 -11
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +16 -19
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +79 -152
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +4 -6
- openstackclient/tests/unit/network/v2/test_network_rbac.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_trunk.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +21 -22
- openstackclient/tests/unit/network/v2/test_router.py +130 -51
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +11 -19
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -27
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +15 -17
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +33 -39
- openstackclient/tests/unit/object/v1/test_object_all.py +4 -3
- openstackclient/tests/unit/test_shell.py +16 -13
- openstackclient/tests/unit/volume/v2/fakes.py +1 -2
- openstackclient/tests/unit/volume/v2/test_service.py +57 -91
- openstackclient/tests/unit/volume/v2/test_volume.py +109 -106
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +141 -148
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +293 -283
- openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +1 -1
- openstackclient/tests/unit/volume/v3/fakes.py +2 -8
- openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +61 -71
- openstackclient/tests/unit/volume/v3/test_service.py +221 -141
- openstackclient/tests/unit/volume/v3/test_volume.py +131 -120
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +4 -4
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +198 -203
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +683 -49
- openstackclient/tests/unit/volume/v3/test_volume_transfer_request.py +1 -1
- openstackclient/volume/client.py +1 -3
- openstackclient/volume/v2/consistency_group.py +4 -8
- openstackclient/volume/v2/consistency_group_snapshot.py +1 -2
- openstackclient/volume/v2/qos_specs.py +1 -2
- openstackclient/volume/v2/service.py +41 -38
- openstackclient/volume/v2/volume.py +71 -53
- openstackclient/volume/v2/volume_backup.py +15 -10
- openstackclient/volume/v2/volume_snapshot.py +129 -93
- openstackclient/volume/v2/volume_transfer_request.py +0 -3
- openstackclient/volume/v2/volume_type.py +10 -21
- openstackclient/volume/v3/block_storage_cluster.py +3 -3
- openstackclient/volume/v3/block_storage_log_level.py +22 -28
- openstackclient/volume/v3/block_storage_manage.py +1 -3
- openstackclient/volume/v3/service.py +105 -14
- openstackclient/volume/v3/volume.py +218 -58
- openstackclient/volume/v3/volume_attachment.py +3 -2
- openstackclient/volume/v3/volume_backup.py +31 -27
- openstackclient/volume/v3/volume_group.py +2 -1
- openstackclient/volume/v3/volume_group_snapshot.py +2 -1
- openstackclient/volume/v3/volume_snapshot.py +489 -13
- openstackclient/volume/v3/volume_type.py +10 -21
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/AUTHORS +11 -0
- python_openstackclient-8.1.0.dist-info/METADATA +264 -0
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/RECORD +238 -259
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/entry_points.txt +7 -47
- python_openstackclient-8.1.0.dist-info/pbr.json +1 -0
- openstackclient/tests/functional/volume/v1/__init__.py +0 -0
- openstackclient/tests/functional/volume/v1/common.py +0 -35
- openstackclient/tests/functional/volume/v1/test_qos.py +0 -100
- openstackclient/tests/functional/volume/v1/test_service.py +0 -76
- openstackclient/tests/functional/volume/v1/test_snapshot.py +0 -232
- openstackclient/tests/functional/volume/v1/test_transfer_request.py +0 -111
- openstackclient/tests/functional/volume/v1/test_volume.py +0 -228
- openstackclient/tests/functional/volume/v1/test_volume_type.py +0 -213
- openstackclient/tests/unit/volume/v1/__init__.py +0 -0
- openstackclient/tests/unit/volume/v1/fakes.py +0 -615
- openstackclient/tests/unit/volume/v1/test_qos_specs.py +0 -471
- openstackclient/tests/unit/volume/v1/test_service.py +0 -295
- openstackclient/tests/unit/volume/v1/test_transfer_request.py +0 -380
- openstackclient/tests/unit/volume/v1/test_type.py +0 -633
- openstackclient/tests/unit/volume/v1/test_volume.py +0 -1447
- openstackclient/tests/unit/volume/v1/test_volume_backup.py +0 -435
- openstackclient/volume/v1/__init__.py +0 -0
- openstackclient/volume/v1/qos_specs.py +0 -377
- openstackclient/volume/v1/service.py +0 -136
- openstackclient/volume/v1/volume.py +0 -734
- openstackclient/volume/v1/volume_backup.py +0 -302
- openstackclient/volume/v1/volume_snapshot.py +0 -433
- openstackclient/volume/v1/volume_transfer_request.py +0 -200
- openstackclient/volume/v1/volume_type.py +0 -520
- python_openstackclient-7.4.0.dist-info/METADATA +0 -172
- python_openstackclient-7.4.0.dist-info/pbr.json +0 -1
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-7.4.0.dist-info → python_openstackclient-8.1.0.dist-info}/top_level.txt +0 -0
|
@@ -117,7 +117,7 @@ class ListAvailabilityZone(command.Lister):
|
|
|
117
117
|
return parser
|
|
118
118
|
|
|
119
119
|
def _get_compute_availability_zones(self, parsed_args):
|
|
120
|
-
compute_client = self.app.client_manager.
|
|
120
|
+
compute_client = self.app.client_manager.compute
|
|
121
121
|
try:
|
|
122
122
|
data = list(compute_client.availability_zones(details=True))
|
|
123
123
|
except sdk_exceptions.ForbiddenException: # policy doesn't allow
|
|
@@ -172,17 +172,14 @@ class ListAvailabilityZone(command.Lister):
|
|
|
172
172
|
return result
|
|
173
173
|
|
|
174
174
|
def take_action(self, parsed_args):
|
|
175
|
+
columns: tuple[str, ...] = ('Zone Name', 'Zone Status')
|
|
175
176
|
if parsed_args.long:
|
|
176
|
-
columns
|
|
177
|
-
'Zone Name',
|
|
178
|
-
'Zone Status',
|
|
177
|
+
columns += (
|
|
179
178
|
'Zone Resource',
|
|
180
179
|
'Host Name',
|
|
181
180
|
'Service Name',
|
|
182
181
|
'Service Status',
|
|
183
182
|
)
|
|
184
|
-
else:
|
|
185
|
-
columns = ('Zone Name', 'Zone Status')
|
|
186
183
|
|
|
187
184
|
# Show everything by default.
|
|
188
185
|
show_all = (
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
import importlib
|
|
19
19
|
import logging
|
|
20
20
|
import sys
|
|
21
|
+
import typing as ty
|
|
21
22
|
|
|
22
23
|
from osc_lib import clientmanager
|
|
23
24
|
from osc_lib import shell
|
|
@@ -26,7 +27,7 @@ import stevedore
|
|
|
26
27
|
|
|
27
28
|
LOG = logging.getLogger(__name__)
|
|
28
29
|
|
|
29
|
-
PLUGIN_MODULES = []
|
|
30
|
+
PLUGIN_MODULES: list[ty.Any] = []
|
|
30
31
|
|
|
31
32
|
USER_AGENT = 'python-openstackclient'
|
|
32
33
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
2
|
+
# not use this file except in compliance with the License. You may obtain
|
|
3
|
+
# a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
|
+
# License for the specific language governing permissions and limitations
|
|
11
|
+
# under the License.
|
|
12
|
+
|
|
13
|
+
import os
|
|
14
|
+
|
|
15
|
+
from openstackclient.i18n import _
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def bool_from_str(value, strict=False):
|
|
19
|
+
true_strings = ('1', 't', 'true', 'on', 'y', 'yes')
|
|
20
|
+
false_strings = ('0', 'f', 'false', 'off', 'n', 'no')
|
|
21
|
+
|
|
22
|
+
if isinstance(value, bool):
|
|
23
|
+
return value
|
|
24
|
+
|
|
25
|
+
lowered = value.strip().lower()
|
|
26
|
+
if lowered in true_strings:
|
|
27
|
+
return True
|
|
28
|
+
elif lowered in false_strings or not strict:
|
|
29
|
+
return False
|
|
30
|
+
|
|
31
|
+
msg = _(
|
|
32
|
+
"Unrecognized value '%(value)s'; acceptable values are: %(valid)s"
|
|
33
|
+
) % {
|
|
34
|
+
'value': value,
|
|
35
|
+
'valid': ', '.join(
|
|
36
|
+
f"'{s}'" for s in sorted(true_strings + false_strings)
|
|
37
|
+
),
|
|
38
|
+
}
|
|
39
|
+
raise ValueError(msg)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def boolenv(*vars, default=False):
|
|
43
|
+
"""Search for the first defined of possibly many bool-like env vars.
|
|
44
|
+
|
|
45
|
+
Returns the first environment variable defined in vars, or returns the
|
|
46
|
+
default.
|
|
47
|
+
|
|
48
|
+
:param vars: Arbitrary strings to search for. Case sensitive.
|
|
49
|
+
:param default: The default to return if no value found.
|
|
50
|
+
:returns: A boolean corresponding to the value found, else the default if
|
|
51
|
+
no value found.
|
|
52
|
+
"""
|
|
53
|
+
for v in vars:
|
|
54
|
+
value = os.environ.get(v, None)
|
|
55
|
+
if value:
|
|
56
|
+
return bool_from_str(value)
|
|
57
|
+
return default
|
|
@@ -73,17 +73,9 @@ class ListExtension(command.Lister):
|
|
|
73
73
|
return parser
|
|
74
74
|
|
|
75
75
|
def take_action(self, parsed_args):
|
|
76
|
+
columns: tuple[str, ...] = ('Name', 'Alias', 'Description')
|
|
76
77
|
if parsed_args.long:
|
|
77
|
-
columns
|
|
78
|
-
'Name',
|
|
79
|
-
'Alias',
|
|
80
|
-
'Description',
|
|
81
|
-
'Namespace',
|
|
82
|
-
'Updated At',
|
|
83
|
-
'Links',
|
|
84
|
-
)
|
|
85
|
-
else:
|
|
86
|
-
columns = ('Name', 'Alias', 'Description')
|
|
78
|
+
columns += ('Namespace', 'Updated At', 'Links')
|
|
87
79
|
|
|
88
80
|
data = []
|
|
89
81
|
|
|
@@ -106,7 +98,7 @@ class ListExtension(command.Lister):
|
|
|
106
98
|
LOG.warning(message)
|
|
107
99
|
|
|
108
100
|
if parsed_args.compute or show_all:
|
|
109
|
-
compute_client = self.app.client_manager.
|
|
101
|
+
compute_client = self.app.client_manager.compute
|
|
110
102
|
try:
|
|
111
103
|
data += compute_client.extensions()
|
|
112
104
|
except Exception:
|
openstackclient/common/limits.py
CHANGED
|
@@ -122,7 +122,7 @@ class ShowLimits(command.Lister):
|
|
|
122
122
|
volume_limits = None
|
|
123
123
|
|
|
124
124
|
if self.app.client_manager.is_compute_endpoint_enabled():
|
|
125
|
-
compute_client = self.app.client_manager.
|
|
125
|
+
compute_client = self.app.client_manager.compute
|
|
126
126
|
compute_limits = compute_client.get_limits(
|
|
127
127
|
reserved=parsed_args.is_reserved, tenant_id=project_id
|
|
128
128
|
)
|
|
@@ -17,6 +17,7 @@ import getpass
|
|
|
17
17
|
import logging
|
|
18
18
|
import os
|
|
19
19
|
import queue
|
|
20
|
+
import typing as ty
|
|
20
21
|
|
|
21
22
|
from cliff.formatters import table
|
|
22
23
|
from osc_lib.command import command
|
|
@@ -35,7 +36,7 @@ def ask_user_yesno(msg):
|
|
|
35
36
|
:return bool: User choice
|
|
36
37
|
"""
|
|
37
38
|
while True:
|
|
38
|
-
answer = getpass.
|
|
39
|
+
answer = getpass.getpass('{} [{}]: '.format(msg, 'y/n'))
|
|
39
40
|
if answer in ('y', 'Y', 'yes'):
|
|
40
41
|
return True
|
|
41
42
|
elif answer in ('n', 'N', 'no'):
|
|
@@ -100,7 +101,7 @@ class ProjectCleanup(command.Command):
|
|
|
100
101
|
project_connect = sdk.connect_as_project(project)
|
|
101
102
|
|
|
102
103
|
if project_connect:
|
|
103
|
-
status_queue = queue.Queue()
|
|
104
|
+
status_queue: queue.Queue[ty.Any] = queue.Queue()
|
|
104
105
|
parsed_args.max_width = int(
|
|
105
106
|
os.environ.get('CLIFF_MAX_TERM_WIDTH', 0)
|
|
106
107
|
)
|
openstackclient/common/quota.py
CHANGED
|
@@ -18,6 +18,7 @@ import argparse
|
|
|
18
18
|
import itertools
|
|
19
19
|
import logging
|
|
20
20
|
import sys
|
|
21
|
+
import typing as ty
|
|
21
22
|
|
|
22
23
|
from openstack import exceptions as sdk_exceptions
|
|
23
24
|
from osc_lib.command import command
|
|
@@ -132,7 +133,7 @@ def get_compute_quotas(
|
|
|
132
133
|
default=False,
|
|
133
134
|
):
|
|
134
135
|
try:
|
|
135
|
-
client = app.client_manager.
|
|
136
|
+
client = app.client_manager.compute
|
|
136
137
|
if default:
|
|
137
138
|
quota = client.get_quota_set_defaults(project_id)
|
|
138
139
|
else:
|
|
@@ -176,25 +177,37 @@ def get_network_quotas(
|
|
|
176
177
|
default=False,
|
|
177
178
|
):
|
|
178
179
|
def _network_quota_to_dict(network_quota, detail=False):
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
dict_quota
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
180
|
+
dict_quota = network_quota.to_dict(computed=False)
|
|
181
|
+
|
|
182
|
+
if not detail:
|
|
183
|
+
return dict_quota
|
|
184
|
+
|
|
185
|
+
# Neutron returns quota details in dict which is in format like:
|
|
186
|
+
# {'resource_name': {'in_use': X, 'limit': Y, 'reserved': Z},
|
|
187
|
+
# 'resource_name_2': {'in_use': X2, 'limit': Y2, 'reserved': Z2}}
|
|
188
|
+
#
|
|
189
|
+
# but Nova and Cinder returns quota in different format, like:
|
|
190
|
+
# {'resource_name': X,
|
|
191
|
+
# 'resource_name_2': X2,
|
|
192
|
+
# 'usage': {
|
|
193
|
+
# 'resource_name': Y,
|
|
194
|
+
# 'resource_name_2': Y2
|
|
195
|
+
# },
|
|
196
|
+
# 'reserved': {
|
|
197
|
+
# 'resource_name': Z,
|
|
198
|
+
# 'resource_name_2': Z2
|
|
199
|
+
# }}
|
|
200
|
+
#
|
|
201
|
+
# so we need to make conversion to have data in same format from
|
|
202
|
+
# all of the services
|
|
203
|
+
result: dict[str, ty.Any] = {"usage": {}, "reservation": {}}
|
|
186
204
|
for key, values in dict_quota.items():
|
|
187
205
|
if values is None:
|
|
188
206
|
continue
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
# from Nova to make result more consistent
|
|
194
|
-
if isinstance(values, dict) and 'used' in values:
|
|
195
|
-
values['in_use'] = values.pop("used")
|
|
196
|
-
|
|
197
|
-
result[key] = values
|
|
207
|
+
if isinstance(values, dict):
|
|
208
|
+
result[key] = values['limit']
|
|
209
|
+
result["reservation"][key] = values['reserved']
|
|
210
|
+
result["usage"][key] = values['used']
|
|
198
211
|
|
|
199
212
|
return result
|
|
200
213
|
|
|
@@ -243,7 +256,7 @@ class ListQuota(command.Lister):
|
|
|
243
256
|
return parser
|
|
244
257
|
|
|
245
258
|
def _list_quota_compute(self, parsed_args, project_ids):
|
|
246
|
-
compute_client = self.app.client_manager.
|
|
259
|
+
compute_client = self.app.client_manager.compute
|
|
247
260
|
result = []
|
|
248
261
|
|
|
249
262
|
for project_id in project_ids:
|
|
@@ -278,7 +291,7 @@ class ListQuota(command.Lister):
|
|
|
278
291
|
if default_result != project_result:
|
|
279
292
|
result += project_result
|
|
280
293
|
|
|
281
|
-
columns = (
|
|
294
|
+
columns: tuple[str, ...] = (
|
|
282
295
|
'id',
|
|
283
296
|
'cores',
|
|
284
297
|
'injected_files',
|
|
@@ -291,7 +304,7 @@ class ListQuota(command.Lister):
|
|
|
291
304
|
'server_groups',
|
|
292
305
|
'server_group_members',
|
|
293
306
|
)
|
|
294
|
-
column_headers = (
|
|
307
|
+
column_headers: tuple[str, ...] = (
|
|
295
308
|
'Project ID',
|
|
296
309
|
'Cores',
|
|
297
310
|
'Injected Files',
|
|
@@ -340,7 +353,7 @@ class ListQuota(command.Lister):
|
|
|
340
353
|
if default_result != project_result:
|
|
341
354
|
result += project_result
|
|
342
355
|
|
|
343
|
-
columns = (
|
|
356
|
+
columns: tuple[str, ...] = (
|
|
344
357
|
'id',
|
|
345
358
|
'backups',
|
|
346
359
|
'backup_gigabytes',
|
|
@@ -349,7 +362,7 @@ class ListQuota(command.Lister):
|
|
|
349
362
|
'snapshots',
|
|
350
363
|
'volumes',
|
|
351
364
|
)
|
|
352
|
-
column_headers = (
|
|
365
|
+
column_headers: tuple[str, ...] = (
|
|
353
366
|
'Project ID',
|
|
354
367
|
'Backups',
|
|
355
368
|
'Backup Gigabytes',
|
|
@@ -395,7 +408,7 @@ class ListQuota(command.Lister):
|
|
|
395
408
|
if default_result != project_result:
|
|
396
409
|
result += project_result
|
|
397
410
|
|
|
398
|
-
columns = (
|
|
411
|
+
columns: tuple[str, ...] = (
|
|
399
412
|
'id',
|
|
400
413
|
'floating_ips',
|
|
401
414
|
'networks',
|
|
@@ -407,7 +420,7 @@ class ListQuota(command.Lister):
|
|
|
407
420
|
'subnets',
|
|
408
421
|
'subnet_pools',
|
|
409
422
|
)
|
|
410
|
-
column_headers = (
|
|
423
|
+
column_headers: tuple[str, ...] = (
|
|
411
424
|
'Project ID',
|
|
412
425
|
'Floating IPs',
|
|
413
426
|
'Networks',
|
|
@@ -575,7 +588,7 @@ class SetQuota(common.NetDetectionMixin, command.Command):
|
|
|
575
588
|
network_kwargs = {}
|
|
576
589
|
|
|
577
590
|
if self.app.client_manager.is_compute_endpoint_enabled():
|
|
578
|
-
compute_client = self.app.client_manager.
|
|
591
|
+
compute_client = self.app.client_manager.compute
|
|
579
592
|
|
|
580
593
|
for k, v in COMPUTE_QUOTAS.items():
|
|
581
594
|
value = getattr(parsed_args, k, None)
|
|
@@ -756,6 +769,19 @@ and ``server-group-members`` output for a given quota class."""
|
|
|
756
769
|
)
|
|
757
770
|
|
|
758
771
|
info = {}
|
|
772
|
+
if parsed_args.usage:
|
|
773
|
+
info["reservation"] = compute_quota_info.pop("reservation", {})
|
|
774
|
+
info["reservation"].update(
|
|
775
|
+
volume_quota_info.pop("reservation", {})
|
|
776
|
+
)
|
|
777
|
+
info["reservation"].update(
|
|
778
|
+
network_quota_info.pop("reservation", {})
|
|
779
|
+
)
|
|
780
|
+
|
|
781
|
+
info["usage"] = compute_quota_info.pop("usage", {})
|
|
782
|
+
info["usage"].update(volume_quota_info.pop("usage", {}))
|
|
783
|
+
info["usage"].update(network_quota_info.pop("usage", {}))
|
|
784
|
+
|
|
759
785
|
info.update(compute_quota_info)
|
|
760
786
|
info.update(volume_quota_info)
|
|
761
787
|
info.update(network_quota_info)
|
|
@@ -798,11 +824,11 @@ and ``server-group-members`` output for a given quota class."""
|
|
|
798
824
|
if k not in ('usage', 'reservation')
|
|
799
825
|
]
|
|
800
826
|
|
|
801
|
-
columns = (
|
|
827
|
+
columns: tuple[str, ...] = (
|
|
802
828
|
'resource',
|
|
803
829
|
'limit',
|
|
804
830
|
)
|
|
805
|
-
column_headers = (
|
|
831
|
+
column_headers: tuple[str, ...] = (
|
|
806
832
|
'Resource',
|
|
807
833
|
'Limit',
|
|
808
834
|
)
|
|
@@ -881,7 +907,7 @@ class DeleteQuota(command.Command):
|
|
|
881
907
|
|
|
882
908
|
# compute quotas
|
|
883
909
|
if parsed_args.service in {'all', 'compute'}:
|
|
884
|
-
compute_client = self.app.client_manager.
|
|
910
|
+
compute_client = self.app.client_manager.compute
|
|
885
911
|
compute_client.revert_quota_set(project.id)
|
|
886
912
|
|
|
887
913
|
# volume quotas
|
|
@@ -11,7 +11,6 @@
|
|
|
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
|
import logging
|
|
17
16
|
|
|
@@ -21,13 +20,11 @@ from openstackclient.i18n import _
|
|
|
21
20
|
|
|
22
21
|
LOG = logging.getLogger(__name__)
|
|
23
22
|
|
|
23
|
+
# global variables used when building the shell
|
|
24
24
|
DEFAULT_API_VERSION = '2.1'
|
|
25
25
|
API_VERSION_OPTION = 'os_compute_api_version'
|
|
26
26
|
API_NAME = 'compute'
|
|
27
|
-
API_VERSIONS =
|
|
28
|
-
'2': 'openstack.connection.Connection',
|
|
29
|
-
'2.1': 'openstack.connection.Connection',
|
|
30
|
-
}
|
|
27
|
+
API_VERSIONS = ('2', '2.1')
|
|
31
28
|
|
|
32
29
|
|
|
33
30
|
def make_client(instance):
|
|
@@ -49,3 +46,8 @@ def build_option_parser(parser):
|
|
|
49
46
|
% DEFAULT_API_VERSION,
|
|
50
47
|
)
|
|
51
48
|
return parser
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def check_api_version(check_version):
|
|
52
|
+
# SDK supports auto-negotiation for us: always return True
|
|
53
|
+
return True
|
|
@@ -56,7 +56,7 @@ class CreateAgent(command.ShowOne):
|
|
|
56
56
|
return parser
|
|
57
57
|
|
|
58
58
|
def take_action(self, parsed_args):
|
|
59
|
-
compute_client = self.app.client_manager.
|
|
59
|
+
compute_client = self.app.client_manager.compute
|
|
60
60
|
|
|
61
61
|
# doing this since openstacksdk has decided not to support this
|
|
62
62
|
# deprecated command
|
|
@@ -95,7 +95,7 @@ class DeleteAgent(command.Command):
|
|
|
95
95
|
return parser
|
|
96
96
|
|
|
97
97
|
def take_action(self, parsed_args):
|
|
98
|
-
compute_client = self.app.client_manager.
|
|
98
|
+
compute_client = self.app.client_manager.compute
|
|
99
99
|
result = 0
|
|
100
100
|
for id in parsed_args.id:
|
|
101
101
|
try:
|
|
@@ -114,7 +114,7 @@ class DeleteAgent(command.Command):
|
|
|
114
114
|
|
|
115
115
|
if result > 0:
|
|
116
116
|
total = len(parsed_args.id)
|
|
117
|
-
msg = _("%(result)s of %(total)s agents failed
|
|
117
|
+
msg = _("%(result)s of %(total)s agents failed to delete.") % {
|
|
118
118
|
'result': result,
|
|
119
119
|
'total': total,
|
|
120
120
|
}
|
|
@@ -139,7 +139,7 @@ class ListAgent(command.Lister):
|
|
|
139
139
|
return parser
|
|
140
140
|
|
|
141
141
|
def take_action(self, parsed_args):
|
|
142
|
-
compute_client = self.app.client_manager.
|
|
142
|
+
compute_client = self.app.client_manager.compute
|
|
143
143
|
columns = (
|
|
144
144
|
"Agent ID",
|
|
145
145
|
"Hypervisor",
|
|
@@ -194,7 +194,7 @@ class SetAgent(command.Command):
|
|
|
194
194
|
return parser
|
|
195
195
|
|
|
196
196
|
def take_action(self, parsed_args):
|
|
197
|
-
compute_client = self.app.client_manager.
|
|
197
|
+
compute_client = self.app.client_manager.compute
|
|
198
198
|
|
|
199
199
|
response = compute_client.get('/os-agents', microversion='2.1')
|
|
200
200
|
sdk_exceptions.raise_from_response(response)
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
"""Compute v2 Aggregate action implementations"""
|
|
18
18
|
|
|
19
19
|
import logging
|
|
20
|
+
import typing as ty
|
|
20
21
|
|
|
21
22
|
from openstack import utils as sdk_utils
|
|
22
23
|
from osc_lib.cli import format_columns
|
|
@@ -67,7 +68,7 @@ class AddAggregateHost(command.ShowOne):
|
|
|
67
68
|
return parser
|
|
68
69
|
|
|
69
70
|
def take_action(self, parsed_args):
|
|
70
|
-
compute_client = self.app.client_manager.
|
|
71
|
+
compute_client = self.app.client_manager.compute
|
|
71
72
|
|
|
72
73
|
aggregate = compute_client.find_aggregate(
|
|
73
74
|
parsed_args.aggregate, ignore_missing=False
|
|
@@ -110,7 +111,7 @@ class CreateAggregate(command.ShowOne):
|
|
|
110
111
|
return parser
|
|
111
112
|
|
|
112
113
|
def take_action(self, parsed_args):
|
|
113
|
-
compute_client = self.app.client_manager.
|
|
114
|
+
compute_client = self.app.client_manager.compute
|
|
114
115
|
|
|
115
116
|
attrs = {'name': parsed_args.name}
|
|
116
117
|
|
|
@@ -146,7 +147,7 @@ class DeleteAggregate(command.Command):
|
|
|
146
147
|
return parser
|
|
147
148
|
|
|
148
149
|
def take_action(self, parsed_args):
|
|
149
|
-
compute_client = self.app.client_manager.
|
|
150
|
+
compute_client = self.app.client_manager.compute
|
|
150
151
|
result = 0
|
|
151
152
|
for a in parsed_args.aggregate:
|
|
152
153
|
try:
|
|
@@ -168,9 +169,10 @@ class DeleteAggregate(command.Command):
|
|
|
168
169
|
|
|
169
170
|
if result > 0:
|
|
170
171
|
total = len(parsed_args.aggregate)
|
|
171
|
-
msg = _(
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
msg = _("%(result)s of %(total)s aggregates failed to delete.") % {
|
|
173
|
+
'result': result,
|
|
174
|
+
'total': total,
|
|
175
|
+
}
|
|
174
176
|
raise exceptions.CommandError(msg)
|
|
175
177
|
|
|
176
178
|
|
|
@@ -188,13 +190,13 @@ class ListAggregate(command.Lister):
|
|
|
188
190
|
return parser
|
|
189
191
|
|
|
190
192
|
def take_action(self, parsed_args):
|
|
191
|
-
compute_client = self.app.client_manager.
|
|
193
|
+
compute_client = self.app.client_manager.compute
|
|
192
194
|
|
|
193
195
|
aggregates = list(compute_client.aggregates())
|
|
194
196
|
|
|
195
197
|
if sdk_utils.supports_microversion(compute_client, '2.41'):
|
|
196
|
-
column_headers = ("ID", "UUID")
|
|
197
|
-
columns = ("id", "uuid")
|
|
198
|
+
column_headers: tuple[str, ...] = ("ID", "UUID")
|
|
199
|
+
columns: tuple[str, ...] = ("id", "uuid")
|
|
198
200
|
else:
|
|
199
201
|
column_headers = ("ID",)
|
|
200
202
|
columns = ("id",)
|
|
@@ -250,7 +252,7 @@ class RemoveAggregateHost(command.ShowOne):
|
|
|
250
252
|
return parser
|
|
251
253
|
|
|
252
254
|
def take_action(self, parsed_args):
|
|
253
|
-
compute_client = self.app.client_manager.
|
|
255
|
+
compute_client = self.app.client_manager.compute
|
|
254
256
|
|
|
255
257
|
aggregate = compute_client.find_aggregate(
|
|
256
258
|
parsed_args.aggregate, ignore_missing=False
|
|
@@ -307,7 +309,7 @@ class SetAggregate(command.Command):
|
|
|
307
309
|
return parser
|
|
308
310
|
|
|
309
311
|
def take_action(self, parsed_args):
|
|
310
|
-
compute_client = self.app.client_manager.
|
|
312
|
+
compute_client = self.app.client_manager.compute
|
|
311
313
|
aggregate = compute_client.find_aggregate(
|
|
312
314
|
parsed_args.aggregate, ignore_missing=False
|
|
313
315
|
)
|
|
@@ -320,7 +322,7 @@ class SetAggregate(command.Command):
|
|
|
320
322
|
if kwargs:
|
|
321
323
|
compute_client.update_aggregate(aggregate.id, **kwargs)
|
|
322
324
|
|
|
323
|
-
properties = {}
|
|
325
|
+
properties: dict[str, ty.Any] = {}
|
|
324
326
|
if parsed_args.no_property:
|
|
325
327
|
# NOTE(RuiChen): "availability_zone" can not be unset from
|
|
326
328
|
# properties. It is already excluded from show and create output.
|
|
@@ -352,7 +354,7 @@ class ShowAggregate(command.ShowOne):
|
|
|
352
354
|
return parser
|
|
353
355
|
|
|
354
356
|
def take_action(self, parsed_args):
|
|
355
|
-
compute_client = self.app.client_manager.
|
|
357
|
+
compute_client = self.app.client_manager.compute
|
|
356
358
|
aggregate = compute_client.find_aggregate(
|
|
357
359
|
parsed_args.aggregate, ignore_missing=False
|
|
358
360
|
)
|
|
@@ -392,7 +394,7 @@ class UnsetAggregate(command.Command):
|
|
|
392
394
|
return parser
|
|
393
395
|
|
|
394
396
|
def take_action(self, parsed_args):
|
|
395
|
-
compute_client = self.app.client_manager.
|
|
397
|
+
compute_client = self.app.client_manager.compute
|
|
396
398
|
aggregate = compute_client.find_aggregate(
|
|
397
399
|
parsed_args.aggregate, ignore_missing=False
|
|
398
400
|
)
|
|
@@ -427,7 +429,7 @@ class CacheImageForAggregate(command.Command):
|
|
|
427
429
|
return parser
|
|
428
430
|
|
|
429
431
|
def take_action(self, parsed_args):
|
|
430
|
-
compute_client = self.app.client_manager.
|
|
432
|
+
compute_client = self.app.client_manager.compute
|
|
431
433
|
|
|
432
434
|
if not sdk_utils.supports_microversion(compute_client, '2.81'):
|
|
433
435
|
msg = _(
|
|
@@ -25,10 +25,9 @@ from openstackclient.i18n import _
|
|
|
25
25
|
def _get_console_columns(item):
|
|
26
26
|
# To maintain backwards compatibility we need to rename sdk props to
|
|
27
27
|
# whatever OSC was using before
|
|
28
|
-
column_map = {}
|
|
29
28
|
hidden_columns = ['id', 'links', 'location', 'name']
|
|
30
29
|
return utils.get_osc_show_columns_for_sdk_resource(
|
|
31
|
-
item,
|
|
30
|
+
item, {}, hidden_columns
|
|
32
31
|
)
|
|
33
32
|
|
|
34
33
|
|
|
@@ -56,7 +55,7 @@ class ShowConsoleLog(command.Command):
|
|
|
56
55
|
return parser
|
|
57
56
|
|
|
58
57
|
def take_action(self, parsed_args):
|
|
59
|
-
compute_client = self.app.client_manager.
|
|
58
|
+
compute_client = self.app.client_manager.compute
|
|
60
59
|
|
|
61
60
|
server = compute_client.find_server(
|
|
62
61
|
name_or_id=parsed_args.server, ignore_missing=False
|
|
@@ -107,6 +106,13 @@ class ShowConsoleURL(command.ShowOne):
|
|
|
107
106
|
const='spice-html5',
|
|
108
107
|
help=_("Show SPICE console URL"),
|
|
109
108
|
)
|
|
109
|
+
type_group.add_argument(
|
|
110
|
+
'--spice-direct',
|
|
111
|
+
dest='url_type',
|
|
112
|
+
action='store_const',
|
|
113
|
+
const='spice-direct',
|
|
114
|
+
help=_("Show SPICE direct protocol native console URL"),
|
|
115
|
+
)
|
|
110
116
|
type_group.add_argument(
|
|
111
117
|
'--rdp',
|
|
112
118
|
dest='url_type',
|
|
@@ -131,7 +137,7 @@ class ShowConsoleURL(command.ShowOne):
|
|
|
131
137
|
return parser
|
|
132
138
|
|
|
133
139
|
def take_action(self, parsed_args):
|
|
134
|
-
compute_client = self.app.client_manager.
|
|
140
|
+
compute_client = self.app.client_manager.compute
|
|
135
141
|
server = compute_client.find_server(
|
|
136
142
|
parsed_args.server, ignore_missing=False
|
|
137
143
|
)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
2
|
+
# not use this file except in compliance with the License. You may obtain
|
|
3
|
+
# a copy of the License at
|
|
4
|
+
#
|
|
5
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
#
|
|
7
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
8
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
9
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
|
+
# License for the specific language governing permissions and limitations
|
|
11
|
+
# under the License.
|
|
12
|
+
#
|
|
13
|
+
|
|
14
|
+
"""Compute v2 Console auth token implementations."""
|
|
15
|
+
|
|
16
|
+
from osc_lib.command import command
|
|
17
|
+
from osc_lib import utils
|
|
18
|
+
|
|
19
|
+
from openstackclient.i18n import _
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _get_console_connection_columns(item):
|
|
23
|
+
column_map: dict[str, str] = {}
|
|
24
|
+
hidden_columns = ['id', 'location', 'name']
|
|
25
|
+
return utils.get_osc_show_columns_for_sdk_resource(
|
|
26
|
+
item, column_map, hidden_columns
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
class ShowConsoleConnectionInformation(command.ShowOne):
|
|
31
|
+
_description = _("Show server's remote console connection information")
|
|
32
|
+
|
|
33
|
+
def get_parser(self, prog_name):
|
|
34
|
+
parser = super().get_parser(prog_name)
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
'token',
|
|
37
|
+
metavar='<token>',
|
|
38
|
+
help=_("Nova console token to lookup"),
|
|
39
|
+
)
|
|
40
|
+
return parser
|
|
41
|
+
|
|
42
|
+
def take_action(self, parsed_args):
|
|
43
|
+
compute_client = self.app.client_manager.compute
|
|
44
|
+
data = compute_client.validate_console_auth_token(parsed_args.token)
|
|
45
|
+
display_columns, columns = _get_console_connection_columns(data)
|
|
46
|
+
data = utils.get_dict_properties(data, columns)
|
|
47
|
+
|
|
48
|
+
return (display_columns, data)
|