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.
- openstackclient/api/object_store_v1.py +4 -1
- openstackclient/command.py +27 -0
- openstackclient/common/availability_zone.py +1 -1
- openstackclient/common/clientmanager.py +59 -21
- openstackclient/common/configuration.py +1 -1
- openstackclient/common/extension.py +1 -1
- openstackclient/common/limits.py +1 -1
- openstackclient/common/module.py +5 -3
- openstackclient/common/project_cleanup.py +10 -8
- openstackclient/common/quota.py +54 -23
- openstackclient/common/versions.py +1 -2
- openstackclient/compute/v2/agent.py +1 -1
- openstackclient/compute/v2/aggregate.py +6 -5
- openstackclient/compute/v2/console.py +5 -3
- openstackclient/compute/v2/console_connection.py +1 -1
- openstackclient/compute/v2/flavor.py +1 -1
- openstackclient/compute/v2/host.py +1 -1
- openstackclient/compute/v2/hypervisor.py +1 -1
- openstackclient/compute/v2/hypervisor_stats.py +1 -1
- openstackclient/compute/v2/keypair.py +1 -1
- openstackclient/compute/v2/server.py +78 -29
- openstackclient/compute/v2/server_backup.py +1 -1
- openstackclient/compute/v2/server_event.py +1 -1
- openstackclient/compute/v2/server_group.py +4 -2
- openstackclient/compute/v2/server_image.py +1 -1
- openstackclient/compute/v2/server_migration.py +1 -1
- openstackclient/compute/v2/server_volume.py +1 -1
- openstackclient/compute/v2/service.py +1 -1
- openstackclient/compute/v2/usage.py +6 -4
- openstackclient/identity/common.py +33 -1
- openstackclient/identity/v2_0/catalog.py +3 -2
- openstackclient/identity/v2_0/ec2creds.py +1 -1
- openstackclient/identity/v2_0/endpoint.py +1 -1
- openstackclient/identity/v2_0/project.py +17 -7
- openstackclient/identity/v2_0/role.py +1 -1
- openstackclient/identity/v2_0/role_assignment.py +3 -3
- openstackclient/identity/v2_0/service.py +4 -2
- openstackclient/identity/v2_0/token.py +1 -1
- openstackclient/identity/v2_0/user.py +2 -2
- openstackclient/identity/v3/access_rule.py +16 -4
- openstackclient/identity/v3/application_credential.py +30 -10
- openstackclient/identity/v3/catalog.py +3 -3
- openstackclient/identity/v3/consumer.py +1 -1
- openstackclient/identity/v3/credential.py +1 -1
- openstackclient/identity/v3/domain.py +10 -4
- openstackclient/identity/v3/ec2creds.py +1 -1
- openstackclient/identity/v3/endpoint.py +33 -12
- openstackclient/identity/v3/endpoint_group.py +1 -1
- openstackclient/identity/v3/federation_protocol.py +40 -41
- openstackclient/identity/v3/group.py +11 -5
- openstackclient/identity/v3/identity_provider.py +12 -10
- openstackclient/identity/v3/implied_role.py +1 -1
- openstackclient/identity/v3/limit.py +86 -85
- openstackclient/identity/v3/mapping.py +1 -1
- openstackclient/identity/v3/policy.py +1 -1
- openstackclient/identity/v3/project.py +191 -115
- openstackclient/identity/v3/region.py +1 -1
- openstackclient/identity/v3/registered_limit.py +97 -109
- openstackclient/identity/v3/role.py +20 -39
- openstackclient/identity/v3/role_assignment.py +12 -23
- openstackclient/identity/v3/service.py +1 -1
- openstackclient/identity/v3/service_provider.py +1 -1
- openstackclient/identity/v3/tag.py +1 -11
- openstackclient/identity/v3/token.py +3 -2
- openstackclient/identity/v3/trust.py +4 -2
- openstackclient/identity/v3/unscoped_saml.py +1 -1
- openstackclient/identity/v3/user.py +22 -13
- openstackclient/image/v1/image.py +19 -16
- openstackclient/image/v2/cache.py +1 -1
- openstackclient/image/v2/image.py +16 -12
- openstackclient/image/v2/info.py +1 -1
- openstackclient/image/v2/metadef_namespaces.py +1 -1
- openstackclient/image/v2/metadef_objects.py +1 -1
- openstackclient/image/v2/metadef_properties.py +3 -2
- openstackclient/image/v2/metadef_resource_type_association.py +1 -1
- openstackclient/image/v2/metadef_resource_types.py +1 -1
- openstackclient/image/v2/task.py +1 -1
- openstackclient/network/common.py +10 -9
- openstackclient/network/v2/address_group.py +4 -3
- openstackclient/network/v2/address_scope.py +8 -6
- openstackclient/network/v2/default_security_group_rule.py +9 -8
- openstackclient/network/v2/floating_ip.py +16 -9
- openstackclient/network/v2/floating_ip_port_forwarding.py +9 -6
- openstackclient/network/v2/ip_availability.py +7 -4
- openstackclient/network/v2/l3_conntrack_helper.py +11 -4
- openstackclient/network/v2/local_ip.py +13 -7
- openstackclient/network/v2/local_ip_association.py +7 -4
- openstackclient/network/v2/ndp_proxy.py +13 -6
- openstackclient/network/v2/network.py +33 -16
- openstackclient/network/v2/network_agent.py +5 -5
- openstackclient/network/v2/network_auto_allocated_topology.py +1 -1
- openstackclient/network/v2/network_flavor.py +1 -1
- openstackclient/network/v2/network_flavor_profile.py +1 -1
- openstackclient/network/v2/network_meter.py +1 -1
- openstackclient/network/v2/network_meter_rule.py +1 -1
- openstackclient/network/v2/network_qos_policy.py +7 -5
- openstackclient/network/v2/network_qos_rule.py +1 -1
- openstackclient/network/v2/network_qos_rule_type.py +1 -1
- openstackclient/network/v2/network_rbac.py +8 -5
- openstackclient/network/v2/network_segment.py +2 -2
- openstackclient/network/v2/network_segment_range.py +13 -6
- openstackclient/network/v2/network_service_provider.py +1 -1
- openstackclient/network/v2/network_trunk.py +65 -42
- openstackclient/network/v2/port.py +22 -20
- openstackclient/network/v2/router.py +19 -8
- openstackclient/network/v2/security_group.py +10 -6
- openstackclient/network/v2/security_group_rule.py +11 -5
- openstackclient/network/v2/subnet.py +17 -18
- openstackclient/network/v2/subnet_pool.py +11 -9
- openstackclient/network/v2/taas/__init__.py +0 -0
- openstackclient/network/v2/taas/tap_flow.py +245 -0
- openstackclient/network/v2/taas/tap_mirror.py +237 -0
- openstackclient/network/v2/taas/tap_service.py +211 -0
- openstackclient/object/v1/account.py +1 -1
- openstackclient/object/v1/container.py +1 -1
- openstackclient/object/v1/object.py +1 -1
- openstackclient/shell.py +18 -8
- openstackclient/tests/functional/identity/v3/test_catalog.py +42 -23
- openstackclient/tests/functional/identity/v3/test_limit.py +47 -0
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +174 -0
- openstackclient/tests/functional/image/v2/test_cache.py +54 -0
- openstackclient/tests/functional/image/v2/test_metadef_objects.py +69 -0
- openstackclient/tests/functional/image/v2/test_metadef_resource_type.py +55 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +46 -132
- openstackclient/tests/unit/common/test_command.py +1 -1
- openstackclient/tests/unit/common/test_extension.py +2 -3
- openstackclient/tests/unit/common/test_module.py +14 -7
- openstackclient/tests/unit/common/test_quota.py +79 -0
- openstackclient/tests/unit/compute/v2/test_aggregate.py +5 -3
- openstackclient/tests/unit/compute/v2/test_console.py +1 -4
- openstackclient/tests/unit/compute/v2/test_flavor.py +1 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -9
- openstackclient/tests/unit/compute/v2/test_server.py +370 -38
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -3
- openstackclient/tests/unit/compute/v2/test_service.py +1 -3
- openstackclient/tests/unit/fakes.py +35 -134
- openstackclient/tests/unit/identity/test_common.py +100 -0
- openstackclient/tests/unit/identity/v2_0/test_project.py +4 -4
- openstackclient/tests/unit/identity/v3/fakes.py +10 -2
- openstackclient/tests/unit/identity/v3/test_application_credential.py +3 -3
- openstackclient/tests/unit/identity/v3/test_domain.py +1 -1
- openstackclient/tests/unit/identity/v3/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +4 -2
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +10 -10
- openstackclient/tests/unit/identity/v3/test_limit.py +197 -145
- openstackclient/tests/unit/identity/v3/test_oauth.py +1 -1
- openstackclient/tests/unit/identity/v3/test_project.py +832 -513
- openstackclient/tests/unit/identity/v3/test_protocol.py +97 -88
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +356 -221
- openstackclient/tests/unit/identity/v3/test_role.py +1 -82
- openstackclient/tests/unit/identity/v3/test_user.py +7 -51
- openstackclient/tests/unit/image/v2/test_image.py +116 -5
- openstackclient/tests/unit/network/test_common.py +9 -13
- openstackclient/tests/unit/network/v2/taas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_flow.py +276 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_mirror.py +288 -0
- openstackclient/tests/unit/network/v2/taas/test_osc_tap_service.py +271 -0
- openstackclient/tests/unit/network/v2/test_address_group.py +19 -22
- openstackclient/tests/unit/network/v2/test_address_scope.py +10 -15
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +38 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +21 -27
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +21 -18
- openstackclient/tests/unit/network/v2/test_ip_availability.py +6 -8
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +6 -15
- openstackclient/tests/unit/network/v2/test_local_ip.py +12 -23
- openstackclient/tests/unit/network/v2/test_local_ip_association.py +13 -18
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +11 -21
- openstackclient/tests/unit/network/v2/test_network.py +41 -37
- openstackclient/tests/unit/network/v2/test_network_agent.py +13 -20
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +5 -8
- openstackclient/tests/unit/network/v2/test_network_flavor.py +14 -26
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +14 -17
- openstackclient/tests/unit/network/v2/test_network_meter.py +7 -17
- openstackclient/tests/unit/network/v2/test_network_meter_rule.py +10 -20
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +7 -13
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +44 -54
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +2 -7
- openstackclient/tests/unit/network/v2/test_network_rbac.py +21 -36
- openstackclient/tests/unit/network/v2/test_network_segment.py +13 -29
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +20 -19
- openstackclient/tests/unit/network/v2/test_network_service_provider.py +1 -4
- openstackclient/tests/unit/network/v2/test_network_trunk.py +52 -47
- openstackclient/tests/unit/network/v2/test_port.py +75 -86
- openstackclient/tests/unit/network/v2/test_router.py +104 -126
- openstackclient/tests/unit/network/v2/test_security_group_network.py +19 -26
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +17 -18
- openstackclient/tests/unit/network/v2/test_subnet.py +35 -46
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +21 -33
- openstackclient/tests/unit/volume/test_find_resource.py +4 -13
- openstackclient/tests/unit/volume/v2/test_consistency_group.py +8 -2
- openstackclient/tests/unit/volume/v2/test_volume.py +7 -6
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume.py +38 -12
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +9 -0
- openstackclient/volume/client.py +7 -17
- openstackclient/volume/v2/backup_record.py +1 -1
- openstackclient/volume/v2/consistency_group.py +9 -9
- openstackclient/volume/v2/consistency_group_snapshot.py +3 -3
- openstackclient/volume/v2/qos_specs.py +3 -3
- openstackclient/volume/v2/service.py +1 -1
- openstackclient/volume/v2/volume.py +14 -7
- openstackclient/volume/v2/volume_backend.py +1 -1
- openstackclient/volume/v2/volume_backup.py +7 -5
- openstackclient/volume/v2/volume_host.py +1 -2
- openstackclient/volume/v2/volume_snapshot.py +4 -4
- openstackclient/volume/v2/volume_transfer_request.py +3 -3
- openstackclient/volume/v2/volume_type.py +16 -11
- openstackclient/volume/v3/block_storage_cleanup.py +1 -1
- openstackclient/volume/v3/block_storage_cluster.py +1 -1
- openstackclient/volume/v3/block_storage_log_level.py +1 -1
- openstackclient/volume/v3/block_storage_manage.py +1 -1
- openstackclient/volume/v3/block_storage_resource_filter.py +1 -1
- openstackclient/volume/v3/service.py +1 -1
- openstackclient/volume/v3/volume.py +16 -9
- openstackclient/volume/v3/volume_attachment.py +6 -5
- openstackclient/volume/v3/volume_backup.py +20 -5
- openstackclient/volume/v3/volume_group.py +1 -1
- openstackclient/volume/v3/volume_group_snapshot.py +1 -1
- openstackclient/volume/v3/volume_group_type.py +1 -1
- openstackclient/volume/v3/volume_message.py +1 -1
- openstackclient/volume/v3/volume_snapshot.py +4 -4
- openstackclient/volume/v3/volume_transfer_request.py +3 -3
- openstackclient/volume/v3/volume_type.py +20 -14
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/METADATA +15 -13
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/RECORD +231 -219
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/entry_points.txt +15 -0
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info/licenses}/AUTHORS +15 -0
- python_openstackclient-9.0.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_logs.py +0 -221
- python_openstackclient-8.2.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info/licenses}/LICENSE +0 -0
- {python_openstackclient-8.2.0.dist-info → python_openstackclient-9.0.0.dist-info}/top_level.txt +0 -0
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 Token action implementations"""
|
|
17
17
|
|
|
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
|
from openstackclient.identity import common
|
|
24
24
|
|
|
@@ -37,6 +37,7 @@ class AuthorizeRequestToken(command.ShowOne):
|
|
|
37
37
|
parser.add_argument(
|
|
38
38
|
'--role',
|
|
39
39
|
metavar='<role>',
|
|
40
|
+
dest='roles',
|
|
40
41
|
action='append',
|
|
41
42
|
default=[],
|
|
42
43
|
required=True,
|
|
@@ -52,7 +53,7 @@ class AuthorizeRequestToken(command.ShowOne):
|
|
|
52
53
|
|
|
53
54
|
# NOTE(stevemar): We want a list of role ids
|
|
54
55
|
roles = []
|
|
55
|
-
for role in parsed_args.
|
|
56
|
+
for role in parsed_args.roles:
|
|
56
57
|
role_id = utils.find_resource(
|
|
57
58
|
identity_client.roles,
|
|
58
59
|
role,
|
|
@@ -18,10 +18,10 @@ import itertools
|
|
|
18
18
|
import logging
|
|
19
19
|
|
|
20
20
|
from openstack import exceptions as sdk_exceptions
|
|
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
|
from openstackclient.identity import common
|
|
27
27
|
|
|
@@ -179,7 +179,9 @@ class CreateTrust(command.ShowOne):
|
|
|
179
179
|
roles = []
|
|
180
180
|
for role in parsed_args.roles:
|
|
181
181
|
try:
|
|
182
|
-
role_id = identity_client.find_role(
|
|
182
|
+
role_id = identity_client.find_role(
|
|
183
|
+
role, ignore_missing=False
|
|
184
|
+
).id
|
|
183
185
|
except sdk_exceptions.ForbiddenException:
|
|
184
186
|
role_id = role
|
|
185
187
|
roles.append({"id": role_id})
|
|
@@ -17,9 +17,9 @@ The first step of federated auth is to fetch an unscoped token. From there,
|
|
|
17
17
|
the user can list domains and projects they are allowed to access, and request
|
|
18
18
|
a scoped token."""
|
|
19
19
|
|
|
20
|
-
from osc_lib.command import command
|
|
21
20
|
from osc_lib import utils
|
|
22
21
|
|
|
22
|
+
from openstackclient import command
|
|
23
23
|
from openstackclient.i18n import _
|
|
24
24
|
|
|
25
25
|
|
|
@@ -20,10 +20,10 @@ import logging
|
|
|
20
20
|
import typing as ty
|
|
21
21
|
|
|
22
22
|
from openstack import exceptions as sdk_exc
|
|
23
|
-
from osc_lib.command import command
|
|
24
23
|
from osc_lib import exceptions
|
|
25
24
|
from osc_lib import utils
|
|
26
25
|
|
|
26
|
+
from openstackclient import command
|
|
27
27
|
from openstackclient.i18n import _
|
|
28
28
|
from openstackclient.identity import common
|
|
29
29
|
|
|
@@ -82,9 +82,9 @@ def _get_options_for_user(identity_client, parsed_args):
|
|
|
82
82
|
options['multi_factor_auth_enabled'] = True
|
|
83
83
|
if parsed_args.disable_multi_factor_auth:
|
|
84
84
|
options['multi_factor_auth_enabled'] = False
|
|
85
|
-
if parsed_args.
|
|
85
|
+
if parsed_args.multi_factor_auth_rules:
|
|
86
86
|
auth_rules = [
|
|
87
|
-
rule.split(",") for rule in parsed_args.
|
|
87
|
+
rule.split(",") for rule in parsed_args.multi_factor_auth_rules
|
|
88
88
|
]
|
|
89
89
|
if auth_rules:
|
|
90
90
|
options['multi_factor_auth_rules'] = auth_rules
|
|
@@ -175,7 +175,8 @@ def _add_user_options(parser):
|
|
|
175
175
|
parser.add_argument(
|
|
176
176
|
'--multi-factor-auth-rule',
|
|
177
177
|
metavar='<rule>',
|
|
178
|
-
|
|
178
|
+
dest='multi_factor_auth_rules',
|
|
179
|
+
action='append',
|
|
179
180
|
default=[],
|
|
180
181
|
help=_(
|
|
181
182
|
'Set multi-factor auth rules. For example, to set a rule '
|
|
@@ -298,6 +299,9 @@ class CreateUser(command.ShowOne):
|
|
|
298
299
|
"when a user does not have a password."
|
|
299
300
|
)
|
|
300
301
|
)
|
|
302
|
+
else:
|
|
303
|
+
kwargs['password'] = password
|
|
304
|
+
|
|
301
305
|
options = _get_options_for_user(identity_client, parsed_args)
|
|
302
306
|
if options:
|
|
303
307
|
kwargs['options'] = options
|
|
@@ -306,7 +310,6 @@ class CreateUser(command.ShowOne):
|
|
|
306
310
|
user = identity_client.create_user(
|
|
307
311
|
is_enabled=is_enabled,
|
|
308
312
|
name=parsed_args.name,
|
|
309
|
-
password=password,
|
|
310
313
|
**kwargs,
|
|
311
314
|
)
|
|
312
315
|
except sdk_exc.ConflictException:
|
|
@@ -420,7 +423,8 @@ class ListUser(command.Lister):
|
|
|
420
423
|
dest='is_enabled',
|
|
421
424
|
default=None,
|
|
422
425
|
help=_(
|
|
423
|
-
'List only enabled users, does nothing with
|
|
426
|
+
'List only enabled users, does nothing with '
|
|
427
|
+
'--project and --group'
|
|
424
428
|
),
|
|
425
429
|
)
|
|
426
430
|
parser.add_argument(
|
|
@@ -429,7 +433,8 @@ class ListUser(command.Lister):
|
|
|
429
433
|
dest='is_enabled',
|
|
430
434
|
default=None,
|
|
431
435
|
help=_(
|
|
432
|
-
'List only disabled users, does nothing with
|
|
436
|
+
'List only disabled users, does nothing with '
|
|
437
|
+
'--project and --group'
|
|
433
438
|
),
|
|
434
439
|
)
|
|
435
440
|
return parser
|
|
@@ -441,6 +446,7 @@ class ListUser(command.Lister):
|
|
|
441
446
|
if parsed_args.domain:
|
|
442
447
|
domain = identity_client.find_domain(
|
|
443
448
|
name_or_id=parsed_args.domain,
|
|
449
|
+
ignore_missing=False,
|
|
444
450
|
).id
|
|
445
451
|
|
|
446
452
|
group = None
|
|
@@ -467,15 +473,13 @@ class ListUser(command.Lister):
|
|
|
467
473
|
ignore_missing=False,
|
|
468
474
|
).id
|
|
469
475
|
|
|
470
|
-
assignments = identity_client.role_assignments_filter(
|
|
471
|
-
project=project
|
|
472
|
-
)
|
|
473
|
-
|
|
474
476
|
# NOTE(stevemar): If a user has more than one role on a project
|
|
475
477
|
# then they will have two entries in the returned data. Since we
|
|
476
478
|
# are looking for any role, let's just track unique user IDs.
|
|
477
479
|
user_ids = set()
|
|
478
|
-
for assignment in
|
|
480
|
+
for assignment in identity_client.role_assignments(
|
|
481
|
+
scope_project_id=project
|
|
482
|
+
):
|
|
479
483
|
if assignment.user:
|
|
480
484
|
user_ids.add(assignment.user['id'])
|
|
481
485
|
|
|
@@ -689,7 +693,12 @@ class SetPasswordUser(command.Command):
|
|
|
689
693
|
def take_action(self, parsed_args):
|
|
690
694
|
identity_client = self.app.client_manager.sdk_connection.identity
|
|
691
695
|
conn = self.app.client_manager.sdk_connection
|
|
692
|
-
|
|
696
|
+
auth = conn.config.get_auth()
|
|
697
|
+
if auth is None:
|
|
698
|
+
# this will never happen
|
|
699
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
700
|
+
|
|
701
|
+
user_id = auth.get_user_id(conn.identity)
|
|
693
702
|
|
|
694
703
|
# FIXME(gyee): there are two scenarios:
|
|
695
704
|
#
|
|
@@ -19,15 +19,16 @@ import argparse
|
|
|
19
19
|
import logging
|
|
20
20
|
import os
|
|
21
21
|
import sys
|
|
22
|
+
import typing as ty
|
|
22
23
|
|
|
23
24
|
from cliff import columns as cliff_columns
|
|
24
25
|
from osc_lib.api import utils as api_utils
|
|
25
26
|
from osc_lib.cli import format_columns
|
|
26
27
|
from osc_lib.cli import parseractions
|
|
27
|
-
from osc_lib.command import command
|
|
28
28
|
from osc_lib import exceptions
|
|
29
29
|
from osc_lib import utils
|
|
30
30
|
|
|
31
|
+
from openstackclient import command
|
|
31
32
|
from openstackclient.i18n import _
|
|
32
33
|
|
|
33
34
|
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
|
|
@@ -67,10 +68,7 @@ def _get_columns(item):
|
|
|
67
68
|
)
|
|
68
69
|
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
class HumanReadableSizeColumn(cliff_columns.FormattableColumn):
|
|
71
|
+
class HumanReadableSizeColumn(cliff_columns.FormattableColumn[int]):
|
|
74
72
|
def human_readable(self):
|
|
75
73
|
"""Return a formatted visibility string
|
|
76
74
|
|
|
@@ -84,7 +82,7 @@ class HumanReadableSizeColumn(cliff_columns.FormattableColumn):
|
|
|
84
82
|
return ''
|
|
85
83
|
|
|
86
84
|
|
|
87
|
-
class VisibilityColumn(cliff_columns.FormattableColumn):
|
|
85
|
+
class VisibilityColumn(cliff_columns.FormattableColumn[bool]):
|
|
88
86
|
def human_readable(self):
|
|
89
87
|
"""Return a formatted visibility string
|
|
90
88
|
|
|
@@ -340,9 +338,12 @@ class CreateImage(command.ShowOne):
|
|
|
340
338
|
|
|
341
339
|
if image:
|
|
342
340
|
display_columns, columns = _get_columns(image)
|
|
343
|
-
_formatters['properties'] = format_columns.DictColumn
|
|
344
341
|
data = utils.get_item_properties(
|
|
345
|
-
image,
|
|
342
|
+
image,
|
|
343
|
+
columns,
|
|
344
|
+
formatters={
|
|
345
|
+
'properties': format_columns.DictColumn,
|
|
346
|
+
},
|
|
346
347
|
)
|
|
347
348
|
return (display_columns, data)
|
|
348
349
|
elif info:
|
|
@@ -493,19 +494,19 @@ class ListImage(command.Lister):
|
|
|
493
494
|
column_headers = columns
|
|
494
495
|
|
|
495
496
|
# List of image data received
|
|
496
|
-
|
|
497
|
+
images = list(image_client.images(**kwargs))
|
|
497
498
|
|
|
498
499
|
if parsed_args.property:
|
|
499
500
|
# NOTE(dtroyer): coerce to a list to subscript it in py3
|
|
500
501
|
attr, value = list(parsed_args.property.items())[0]
|
|
501
502
|
api_utils.simple_filter(
|
|
502
|
-
|
|
503
|
+
images,
|
|
503
504
|
attr=attr,
|
|
504
505
|
value=value,
|
|
505
506
|
property_field='properties',
|
|
506
507
|
)
|
|
507
508
|
|
|
508
|
-
data = utils.sort_items(
|
|
509
|
+
data = utils.sort_items(images, parsed_args.sort)
|
|
509
510
|
|
|
510
511
|
return (
|
|
511
512
|
column_headers,
|
|
@@ -839,11 +840,13 @@ class ShowImage(command.ShowOne):
|
|
|
839
840
|
parsed_args.image, ignore_missing=False
|
|
840
841
|
)
|
|
841
842
|
|
|
843
|
+
formatters: dict[
|
|
844
|
+
str, type[cliff_columns.FormattableColumn[ty.Any]]
|
|
845
|
+
] = {
|
|
846
|
+
'properties': format_columns.DictColumn,
|
|
847
|
+
}
|
|
842
848
|
if parsed_args.human_readable:
|
|
843
|
-
|
|
849
|
+
formatters['size'] = HumanReadableSizeColumn
|
|
844
850
|
display_columns, columns = _get_columns(image)
|
|
845
|
-
|
|
846
|
-
data = utils.get_item_properties(
|
|
847
|
-
image, columns, formatters=_formatters
|
|
848
|
-
)
|
|
851
|
+
data = utils.get_item_properties(image, columns, formatters=formatters)
|
|
849
852
|
return (display_columns, data)
|
|
@@ -30,10 +30,10 @@ from openstack import utils as sdk_utils
|
|
|
30
30
|
from osc_lib.api import utils as api_utils
|
|
31
31
|
from osc_lib.cli import format_columns
|
|
32
32
|
from osc_lib.cli import parseractions
|
|
33
|
-
from osc_lib.command import command
|
|
34
33
|
from osc_lib import exceptions
|
|
35
34
|
from osc_lib import utils
|
|
36
35
|
|
|
36
|
+
from openstackclient import command
|
|
37
37
|
from openstackclient.common import pagination
|
|
38
38
|
from openstackclient.common import progressbar
|
|
39
39
|
from openstackclient.i18n import _
|
|
@@ -551,7 +551,7 @@ class CreateImage(command.ShowOne):
|
|
|
551
551
|
sign_cert_id = parsed_args.sign_cert_id
|
|
552
552
|
signer = image_signer.ImageSigner()
|
|
553
553
|
try:
|
|
554
|
-
pw = utils.get_password(
|
|
554
|
+
pw: str | None = utils.get_password(
|
|
555
555
|
self.app.stdin,
|
|
556
556
|
prompt=(
|
|
557
557
|
"Please enter private key password, leave "
|
|
@@ -562,12 +562,11 @@ class CreateImage(command.ShowOne):
|
|
|
562
562
|
|
|
563
563
|
if not pw or len(pw) < 1:
|
|
564
564
|
pw = None
|
|
565
|
-
else:
|
|
566
|
-
# load_private_key() requires the password to be
|
|
567
|
-
# passed as bytes
|
|
568
|
-
pw = pw.encode()
|
|
569
565
|
|
|
570
|
-
signer.load_private_key(
|
|
566
|
+
signer.load_private_key(
|
|
567
|
+
sign_key_path,
|
|
568
|
+
password=pw.encode() if pw else None,
|
|
569
|
+
)
|
|
571
570
|
except Exception:
|
|
572
571
|
msg = _(
|
|
573
572
|
"Error during sign operation: private key "
|
|
@@ -623,7 +622,7 @@ class CreateImage(command.ShowOne):
|
|
|
623
622
|
)
|
|
624
623
|
# TODO(stephenfin): These should be an error in a future
|
|
625
624
|
# version
|
|
626
|
-
LOG.warning(msg
|
|
625
|
+
LOG.warning(msg, opt_name)
|
|
627
626
|
|
|
628
627
|
source_volume = volume_client.find_volume(
|
|
629
628
|
parsed_args.volume, ignore_missing=False
|
|
@@ -933,18 +932,19 @@ class ListImage(command.Lister):
|
|
|
933
932
|
if 'limit' in kwargs:
|
|
934
933
|
# Disable automatic pagination in SDK
|
|
935
934
|
kwargs['paginated'] = False
|
|
936
|
-
|
|
935
|
+
|
|
936
|
+
images = list(image_client.images(**kwargs))
|
|
937
937
|
|
|
938
938
|
if parsed_args.property:
|
|
939
939
|
for attr, value in parsed_args.property.items():
|
|
940
940
|
api_utils.simple_filter(
|
|
941
|
-
|
|
941
|
+
images,
|
|
942
942
|
attr=attr,
|
|
943
943
|
value=value,
|
|
944
944
|
property_field='properties',
|
|
945
945
|
)
|
|
946
946
|
|
|
947
|
-
data = utils.sort_items(
|
|
947
|
+
data = utils.sort_items(images, parsed_args.sort, str)
|
|
948
948
|
|
|
949
949
|
return (
|
|
950
950
|
column_headers,
|
|
@@ -1393,7 +1393,10 @@ class SetImage(command.Command):
|
|
|
1393
1393
|
if parsed_args.visibility is not None:
|
|
1394
1394
|
kwargs['visibility'] = parsed_args.visibility
|
|
1395
1395
|
|
|
1396
|
-
if
|
|
1396
|
+
# Only set owner_id if --project is used WITHOUT membership flags
|
|
1397
|
+
# When --project is used with --accept/--reject/--pending, it should
|
|
1398
|
+
# only identify which member's status to update, not change ownership
|
|
1399
|
+
if parsed_args.project and not parsed_args.membership:
|
|
1397
1400
|
# We already did the project lookup above
|
|
1398
1401
|
kwargs['owner_id'] = project_id
|
|
1399
1402
|
|
|
@@ -1716,6 +1719,7 @@ class ImportImage(command.ShowOne):
|
|
|
1716
1719
|
)
|
|
1717
1720
|
stores_group.add_argument(
|
|
1718
1721
|
'--all-stores',
|
|
1722
|
+
action='store_true',
|
|
1719
1723
|
help=_(
|
|
1720
1724
|
"Make image available to all stores "
|
|
1721
1725
|
"(either '--store' or '--all-stores' required with the "
|
openstackclient/image/v2/info.py
CHANGED
|
@@ -18,10 +18,10 @@
|
|
|
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
|
_formatters = {
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
import json
|
|
16
16
|
import logging
|
|
17
17
|
|
|
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
|
|
|
@@ -127,7 +127,8 @@ class DeleteMetadefProperty(command.Command):
|
|
|
127
127
|
nargs="*",
|
|
128
128
|
help=_(
|
|
129
129
|
"Metadef properties to delete (name) "
|
|
130
|
-
"(omit this argument to delete all properties
|
|
130
|
+
"(omit this argument to delete all properties "
|
|
131
|
+
"in the namespace)"
|
|
131
132
|
),
|
|
132
133
|
)
|
|
133
134
|
return parser
|
openstackclient/image/v2/task.py
CHANGED
|
@@ -12,17 +12,16 @@
|
|
|
12
12
|
#
|
|
13
13
|
|
|
14
14
|
import abc
|
|
15
|
-
import argparse
|
|
16
15
|
import contextlib
|
|
17
16
|
import logging
|
|
18
17
|
import typing as ty
|
|
19
18
|
|
|
20
|
-
import
|
|
19
|
+
from cliff import _argparse
|
|
21
20
|
import openstack.exceptions
|
|
22
21
|
from osc_lib.cli import parseractions
|
|
23
|
-
from osc_lib.command import command
|
|
24
22
|
from osc_lib import exceptions
|
|
25
23
|
|
|
24
|
+
from openstackclient import command
|
|
26
25
|
from openstackclient.i18n import _
|
|
27
26
|
from openstackclient.network import utils
|
|
28
27
|
|
|
@@ -68,8 +67,6 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
|
|
|
68
67
|
present the options for both network types, often qualified accordingly.
|
|
69
68
|
"""
|
|
70
69
|
|
|
71
|
-
app: cliff.app.App
|
|
72
|
-
|
|
73
70
|
@property
|
|
74
71
|
def _network_type(self):
|
|
75
72
|
"""Discover whether the running cloud is using neutron or nova-network.
|
|
@@ -84,7 +81,7 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
|
|
|
84
81
|
# Have we set it up yet for this command?
|
|
85
82
|
if not hasattr(self, '_net_type'):
|
|
86
83
|
try:
|
|
87
|
-
if self.app.client_manager.is_network_endpoint_enabled():
|
|
84
|
+
if self.app.client_manager.is_network_endpoint_enabled(): # type: ignore
|
|
88
85
|
net_type = _NET_TYPE_NEUTRON
|
|
89
86
|
else:
|
|
90
87
|
net_type = _NET_TYPE_COMPUTE
|
|
@@ -136,7 +133,7 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
|
|
|
136
133
|
)
|
|
137
134
|
)
|
|
138
135
|
|
|
139
|
-
def get_parser(self, prog_name: str) ->
|
|
136
|
+
def get_parser(self, prog_name: str) -> _argparse.ArgumentParser:
|
|
140
137
|
LOG.debug('get_parser(%s)', prog_name)
|
|
141
138
|
parser = super().get_parser(prog_name) # type: ignore
|
|
142
139
|
parser = self.update_parser_common(parser)
|
|
@@ -163,11 +160,13 @@ class NetDetectionMixin(metaclass=abc.ABCMeta):
|
|
|
163
160
|
def take_action(self, parsed_args):
|
|
164
161
|
if self.is_neutron:
|
|
165
162
|
return self.take_action_network(
|
|
166
|
-
self.app.client_manager.network,
|
|
163
|
+
self.app.client_manager.network, # type: ignore
|
|
164
|
+
parsed_args,
|
|
167
165
|
)
|
|
168
166
|
elif self.is_nova_network:
|
|
169
167
|
return self.take_action_compute(
|
|
170
|
-
self.app.client_manager.compute,
|
|
168
|
+
self.app.client_manager.compute, # type: ignore
|
|
169
|
+
parsed_args,
|
|
171
170
|
)
|
|
172
171
|
|
|
173
172
|
def take_action_network(self, client, parsed_args):
|
|
@@ -203,6 +202,8 @@ class NetworkAndComputeDelete(NetworkAndComputeCommand, metaclass=abc.ABCMeta):
|
|
|
203
202
|
following the rules in doc/source/command-errors.rst.
|
|
204
203
|
"""
|
|
205
204
|
|
|
205
|
+
resource: str
|
|
206
|
+
|
|
206
207
|
def take_action(self, parsed_args):
|
|
207
208
|
ret = 0
|
|
208
209
|
resources = getattr(parsed_args, self.resource, [])
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
import logging
|
|
17
17
|
|
|
18
18
|
import netaddr
|
|
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
|
from openstackclient.identity import common as identity_common
|
|
25
25
|
from openstackclient.network import common
|
|
@@ -151,13 +151,14 @@ class ListAddressGroup(command.Lister):
|
|
|
151
151
|
parser.add_argument(
|
|
152
152
|
'--name',
|
|
153
153
|
metavar='<name>',
|
|
154
|
-
help=_("List only address groups
|
|
154
|
+
help=_("List only address groups with the specified name"),
|
|
155
155
|
)
|
|
156
156
|
parser.add_argument(
|
|
157
157
|
'--project',
|
|
158
158
|
metavar="<project>",
|
|
159
159
|
help=_(
|
|
160
|
-
"List address groups
|
|
160
|
+
"List only address groups with the specified project "
|
|
161
|
+
"(name or ID)"
|
|
161
162
|
),
|
|
162
163
|
)
|
|
163
164
|
identity_common.add_project_domain_option_to_parser(parser)
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
17
|
|
|
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
|
from openstackclient.identity import common as identity_common
|
|
24
24
|
from openstackclient.network import common
|
|
@@ -160,7 +160,7 @@ class ListAddressScope(command.Lister):
|
|
|
160
160
|
parser.add_argument(
|
|
161
161
|
'--name',
|
|
162
162
|
metavar='<name>',
|
|
163
|
-
help=_("List only address scopes
|
|
163
|
+
help=_("List only address scopes with the specified name"),
|
|
164
164
|
)
|
|
165
165
|
parser.add_argument(
|
|
166
166
|
'--ip-version',
|
|
@@ -169,14 +169,16 @@ class ListAddressScope(command.Lister):
|
|
|
169
169
|
metavar='<ip-version>',
|
|
170
170
|
dest='ip_version',
|
|
171
171
|
help=_(
|
|
172
|
-
"List address scopes
|
|
172
|
+
"List only address scopes with the specified IP version "
|
|
173
|
+
"networks (4 or 6)"
|
|
173
174
|
),
|
|
174
175
|
)
|
|
175
176
|
parser.add_argument(
|
|
176
177
|
'--project',
|
|
177
178
|
metavar="<project>",
|
|
178
179
|
help=_(
|
|
179
|
-
"List address scopes
|
|
180
|
+
"List only address scopes with the specified project "
|
|
181
|
+
"(name or ID)"
|
|
180
182
|
),
|
|
181
183
|
)
|
|
182
184
|
identity_common.add_project_domain_option_to_parser(parser)
|
|
@@ -185,12 +187,12 @@ class ListAddressScope(command.Lister):
|
|
|
185
187
|
shared_group.add_argument(
|
|
186
188
|
'--share',
|
|
187
189
|
action='store_true',
|
|
188
|
-
help=_("List address scopes shared between projects"),
|
|
190
|
+
help=_("List only address scopes shared between projects"),
|
|
189
191
|
)
|
|
190
192
|
shared_group.add_argument(
|
|
191
193
|
'--no-share',
|
|
192
194
|
action='store_true',
|
|
193
|
-
help=_("List address scopes not shared between projects"),
|
|
195
|
+
help=_("List only address scopes not shared between projects"),
|
|
194
196
|
)
|
|
195
197
|
return parser
|
|
196
198
|
|