python-openstackclient 9.0.0__py3-none-any.whl → 10.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/__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 +59 -43
- 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 +36 -34
- openstackclient/common/pagination.py +50 -6
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +11 -6
- openstackclient/common/quota.py +105 -103
- 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 +42 -22
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +16 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +35 -16
- openstackclient/compute/v2/server.py +268 -179
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +28 -12
- openstackclient/compute/v2/server_group.py +23 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +27 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +13 -5
- openstackclient/compute/v2/service.py +17 -8
- openstackclient/compute/v2/usage.py +28 -23
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +82 -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 +32 -12
- openstackclient/identity/v3/application_credential.py +66 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +39 -17
- openstackclient/identity/v3/domain.py +40 -19
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +98 -64
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +44 -20
- openstackclient/identity/v3/group.py +64 -40
- openstackclient/identity/v3/identity_provider.py +95 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +42 -17
- openstackclient/identity/v3/mapping.py +58 -28
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +59 -26
- openstackclient/identity/v3/region.py +39 -17
- openstackclient/identity/v3/registered_limit.py +41 -16
- openstackclient/identity/v3/role.py +62 -31
- openstackclient/identity/v3/role_assignment.py +25 -7
- openstackclient/identity/v3/service.py +39 -17
- openstackclient/identity/v3/service_provider.py +40 -16
- openstackclient/identity/v3/tag.py +23 -6
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +39 -18
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +86 -36
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +16 -11
- openstackclient/image/v2/image.py +88 -56
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +117 -20
- openstackclient/image/v2/metadef_objects.py +32 -19
- openstackclient/image/v2/metadef_properties.py +30 -16
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +25 -27
- 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 +27 -54
- openstackclient/network/v2/address_group.py +39 -16
- openstackclient/network/v2/address_scope.py +36 -20
- openstackclient/network/v2/bgpvpn/bgpvpn.py +477 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +226 -0
- openstackclient/network/v2/bgpvpn/port_association.py +504 -0
- openstackclient/network/v2/bgpvpn/router_association.py +301 -0
- openstackclient/network/v2/default_security_group_rule.py +31 -14
- openstackclient/network/v2/floating_ip.py +121 -162
- openstackclient/network/v2/floating_ip_port_forwarding.py +41 -19
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +499 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +610 -0
- openstackclient/network/v2/ip_availability.py +25 -8
- openstackclient/network/v2/l3_conntrack_helper.py +35 -13
- openstackclient/network/v2/local_ip.py +27 -13
- openstackclient/network/v2/local_ip_association.py +17 -7
- openstackclient/network/v2/ndp_proxy.py +23 -11
- openstackclient/network/v2/network.py +213 -213
- openstackclient/network/v2/network_agent.py +77 -34
- openstackclient/network/v2/network_auto_allocated_topology.py +27 -15
- openstackclient/network/v2/network_flavor.py +45 -21
- openstackclient/network/v2/network_flavor_profile.py +42 -17
- openstackclient/network/v2/network_meter.py +39 -15
- openstackclient/network/v2/network_meter_rule.py +40 -12
- openstackclient/network/v2/network_qos_policy.py +39 -21
- openstackclient/network/v2/network_qos_rule.py +48 -18
- openstackclient/network/v2/network_qos_rule_type.py +28 -9
- openstackclient/network/v2/network_rbac.py +34 -16
- openstackclient/network/v2/network_segment.py +32 -11
- openstackclient/network/v2/network_segment_range.py +70 -31
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +41 -22
- openstackclient/network/v2/port.py +141 -40
- openstackclient/network/v2/router.py +101 -67
- openstackclient/network/v2/security_group.py +97 -198
- openstackclient/network/v2/security_group_rule.py +115 -282
- openstackclient/network/v2/subnet.py +63 -34
- openstackclient/network/v2/subnet_pool.py +42 -24
- openstackclient/network/v2/taas/tap_flow.py +35 -14
- openstackclient/network/v2/taas/tap_mirror.py +28 -14
- openstackclient/network/v2/taas/tap_service.py +26 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +28 -16
- openstackclient/object/v1/object.py +28 -16
- 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 +59 -19
- openstackclient/tests/functional/identity/v3/test_application_credential.py +1 -1
- 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_mapping.py +81 -0
- 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_group.py +163 -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_limits.py +1 -1
- openstackclient/tests/unit/common/test_module.py +82 -44
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +15 -26
- openstackclient/tests/unit/compute/v2/fakes.py +26 -57
- openstackclient/tests/unit/compute/v2/test_agent.py +4 -4
- openstackclient/tests/unit/compute/v2/test_aggregate.py +1 -1
- openstackclient/tests/unit/compute/v2/test_console.py +2 -2
- openstackclient/tests/unit/compute/v2/test_console_connection.py +1 -1
- openstackclient/tests/unit/compute/v2/test_flavor.py +29 -3
- openstackclient/tests/unit/compute/v2/test_host.py +3 -3
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +2 -2
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +1 -1
- openstackclient/tests/unit/compute/v2/test_keypair.py +7 -7
- openstackclient/tests/unit/compute/v2/test_server.py +26 -111
- openstackclient/tests/unit/compute/v2/test_server_backup.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_event.py +2 -2
- openstackclient/tests/unit/compute/v2/test_server_group.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_image.py +1 -1
- openstackclient/tests/unit/compute/v2/test_server_migration.py +4 -4
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/compute/v2/test_server_volume.py +2 -2
- openstackclient/tests/unit/compute/v2/test_service.py +3 -3
- openstackclient/tests/unit/compute/v2/test_usage.py +1 -1
- openstackclient/tests/unit/identity/v2_0/fakes.py +3 -7
- openstackclient/tests/unit/identity/v2_0/test_endpoint.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_project.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_role.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_role_assignment.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_service.py +1 -1
- openstackclient/tests/unit/identity/v2_0/test_token.py +2 -2
- openstackclient/tests/unit/identity/v2_0/test_user.py +1 -1
- openstackclient/tests/unit/identity/v3/fakes.py +8 -38
- openstackclient/tests/unit/identity/v3/test_access_rule.py +3 -3
- openstackclient/tests/unit/identity/v3/test_application_credential.py +4 -4
- openstackclient/tests/unit/identity/v3/test_credential.py +5 -5
- openstackclient/tests/unit/identity/v3/test_domain.py +5 -5
- openstackclient/tests/unit/identity/v3/test_endpoint.py +6 -6
- openstackclient/tests/unit/identity/v3/test_endpoint_group.py +1 -1
- openstackclient/tests/unit/identity/v3/test_group.py +12 -22
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_implied_role.py +1 -1
- openstackclient/tests/unit/identity/v3/test_limit.py +5 -5
- openstackclient/tests/unit/identity/v3/test_mappings.py +163 -79
- openstackclient/tests/unit/identity/v3/test_project.py +28 -5
- openstackclient/tests/unit/identity/v3/test_protocol.py +3 -3
- openstackclient/tests/unit/identity/v3/test_region.py +5 -5
- openstackclient/tests/unit/identity/v3/test_registered_limit.py +5 -5
- openstackclient/tests/unit/identity/v3/test_role.py +8 -8
- openstackclient/tests/unit/identity/v3/test_role_assignment.py +1 -1
- openstackclient/tests/unit/identity/v3/test_service.py +5 -5
- openstackclient/tests/unit/identity/v3/test_token.py +2 -2
- openstackclient/tests/unit/identity/v3/test_trust.py +4 -4
- openstackclient/tests/unit/identity/v3/test_user.py +77 -10
- 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/fakes.py +5 -77
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +923 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +1005 -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 +26 -2
- openstackclient/tests/unit/network/v2/test_address_scope.py +24 -0
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +27 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +37 -13
- openstackclient/tests/unit/network/v2/test_ip_availability.py +25 -0
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +29 -3
- openstackclient/tests/unit/network/v2/test_network.py +74 -12
- openstackclient/tests/unit/network/v2/test_network_agent.py +58 -5
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +26 -2
- openstackclient/tests/unit/network/v2/test_network_flavor_profile.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_meter.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +24 -0
- openstackclient/tests/unit/network/v2/test_network_rbac.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +25 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +31 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_port.py +166 -0
- openstackclient/tests/unit/network/v2/test_router.py +36 -16
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +11 -8
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +28 -37
- openstackclient/tests/unit/network/v2/test_subnet.py +30 -5
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +26 -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 +21 -140
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +6 -14
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +8 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +205 -100
- openstackclient/tests/unit/volume/v3/test_backup_record.py +114 -0
- openstackclient/tests/unit/volume/v3/test_consistency_group.py +720 -0
- openstackclient/tests/unit/volume/v3/test_consistency_group_snapshot.py +354 -0
- openstackclient/tests/unit/volume/v3/test_qos_specs.py +455 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +60 -3
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +3 -1
- openstackclient/tests/unit/volume/v3/test_volume_backend.py +158 -0
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +6 -14
- openstackclient/tests/unit/volume/v3/test_volume_group_type.py +65 -0
- openstackclient/tests/unit/volume/v3/test_volume_host.py +115 -0
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +61 -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 +60 -30
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +48 -23
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +49 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- openstackclient/volume/v3/backup_record.py +94 -0
- 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/consistency_group.py +400 -0
- openstackclient/volume/v3/consistency_group_snapshot.py +225 -0
- openstackclient/volume/v3/qos_specs.py +389 -0
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +92 -40
- openstackclient/volume/v3/volume_attachment.py +47 -21
- openstackclient/volume/v3/volume_backend.py +130 -0
- openstackclient/volume/v3/volume_backup.py +55 -27
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +34 -17
- openstackclient/volume/v3/volume_group_type.py +27 -14
- openstackclient/volume/v3/volume_host.py +74 -0
- openstackclient/volume/v3/volume_message.py +18 -8
- openstackclient/volume/v3/volume_snapshot.py +70 -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.1.0.dist-info}/METADATA +7 -8
- python_openstackclient-10.1.0.dist-info/RECORD +524 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/entry_points.txt +77 -25
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/licenses/AUTHORS +9 -0
- python_openstackclient-10.1.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/RECORD +0 -499
- 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.1.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.1.0.dist-info}/top_level.txt +0 -0
|
@@ -15,23 +15,27 @@
|
|
|
15
15
|
|
|
16
16
|
"""Identity v3 User action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
18
20
|
import copy
|
|
19
21
|
import logging
|
|
20
|
-
|
|
22
|
+
from typing import Any
|
|
21
23
|
|
|
22
24
|
from openstack import exceptions as sdk_exc
|
|
25
|
+
from openstack.identity.v3 import user as _user
|
|
26
|
+
from openstack import utils as sdk_utils
|
|
23
27
|
from osc_lib import exceptions
|
|
24
28
|
from osc_lib import utils
|
|
25
29
|
|
|
26
30
|
from openstackclient import command
|
|
31
|
+
from openstackclient.common import pagination
|
|
27
32
|
from openstackclient.i18n import _
|
|
28
33
|
from openstackclient.identity import common
|
|
29
34
|
|
|
30
|
-
|
|
31
35
|
LOG = logging.getLogger(__name__)
|
|
32
36
|
|
|
33
37
|
|
|
34
|
-
def _format_user(user):
|
|
38
|
+
def _format_user(user: _user.User) -> tuple[tuple[str, ...], tuple[Any, ...]]:
|
|
35
39
|
columns = (
|
|
36
40
|
'default_project_id',
|
|
37
41
|
'domain_id',
|
|
@@ -60,8 +64,10 @@ def _format_user(user):
|
|
|
60
64
|
)
|
|
61
65
|
|
|
62
66
|
|
|
63
|
-
def _get_options_for_user(
|
|
64
|
-
|
|
67
|
+
def _get_options_for_user(
|
|
68
|
+
identity_client: Any, parsed_args: argparse.Namespace
|
|
69
|
+
) -> dict[str, Any]:
|
|
70
|
+
options: dict[str, Any] = {}
|
|
65
71
|
if parsed_args.ignore_lockout_failure_attempts:
|
|
66
72
|
options['ignore_lockout_failure_attempts'] = True
|
|
67
73
|
if parsed_args.no_ignore_lockout_failure_attempts:
|
|
@@ -91,7 +97,7 @@ def _get_options_for_user(identity_client, parsed_args):
|
|
|
91
97
|
return options
|
|
92
98
|
|
|
93
99
|
|
|
94
|
-
def _add_user_options(parser):
|
|
100
|
+
def _add_user_options(parser: argparse.ArgumentParser) -> None:
|
|
95
101
|
# Add additional user options
|
|
96
102
|
|
|
97
103
|
parser.add_argument(
|
|
@@ -191,7 +197,7 @@ def _add_user_options(parser):
|
|
|
191
197
|
class CreateUser(command.ShowOne):
|
|
192
198
|
_description = _("Create new user")
|
|
193
199
|
|
|
194
|
-
def get_parser(self, prog_name):
|
|
200
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
195
201
|
parser = super().get_parser(prog_name)
|
|
196
202
|
parser.add_argument(
|
|
197
203
|
'name',
|
|
@@ -250,10 +256,14 @@ class CreateUser(command.ShowOne):
|
|
|
250
256
|
)
|
|
251
257
|
return parser
|
|
252
258
|
|
|
253
|
-
def take_action(
|
|
254
|
-
|
|
259
|
+
def take_action(
|
|
260
|
+
self, parsed_args: argparse.Namespace
|
|
261
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
262
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
263
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
264
|
+
)
|
|
255
265
|
|
|
256
|
-
kwargs = {}
|
|
266
|
+
kwargs: dict[str, Any] = {}
|
|
257
267
|
|
|
258
268
|
domain_id = None
|
|
259
269
|
if parsed_args.domain:
|
|
@@ -333,7 +343,7 @@ class CreateUser(command.ShowOne):
|
|
|
333
343
|
class DeleteUser(command.Command):
|
|
334
344
|
_description = _("Delete user(s)")
|
|
335
345
|
|
|
336
|
-
def get_parser(self, prog_name):
|
|
346
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
337
347
|
parser = super().get_parser(prog_name)
|
|
338
348
|
parser.add_argument(
|
|
339
349
|
'users',
|
|
@@ -348,8 +358,10 @@ class DeleteUser(command.Command):
|
|
|
348
358
|
)
|
|
349
359
|
return parser
|
|
350
360
|
|
|
351
|
-
def take_action(self, parsed_args):
|
|
352
|
-
identity_client =
|
|
361
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
362
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
363
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
364
|
+
)
|
|
353
365
|
|
|
354
366
|
domain = None
|
|
355
367
|
if parsed_args.domain:
|
|
@@ -393,7 +405,7 @@ class DeleteUser(command.Command):
|
|
|
393
405
|
class ListUser(command.Lister):
|
|
394
406
|
_description = _("List users")
|
|
395
407
|
|
|
396
|
-
def get_parser(self, prog_name):
|
|
408
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
397
409
|
parser = super().get_parser(prog_name)
|
|
398
410
|
parser.add_argument(
|
|
399
411
|
'--domain',
|
|
@@ -437,10 +449,21 @@ class ListUser(command.Lister):
|
|
|
437
449
|
'--project and --group'
|
|
438
450
|
),
|
|
439
451
|
)
|
|
452
|
+
pagination.add_marker_pagination_option_to_parser(parser)
|
|
440
453
|
return parser
|
|
441
454
|
|
|
442
|
-
def take_action(
|
|
443
|
-
|
|
455
|
+
def take_action(
|
|
456
|
+
self, parsed_args: argparse.Namespace
|
|
457
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
458
|
+
if parsed_args.project and (
|
|
459
|
+
parsed_args.limit is not None or parsed_args.marker is not None
|
|
460
|
+
):
|
|
461
|
+
msg = _('--limit and --marker are not supported with --project')
|
|
462
|
+
raise exceptions.CommandError(msg)
|
|
463
|
+
|
|
464
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
465
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
466
|
+
)
|
|
444
467
|
|
|
445
468
|
domain = None
|
|
446
469
|
if parsed_args.domain:
|
|
@@ -460,6 +483,15 @@ class ListUser(command.Lister):
|
|
|
460
483
|
if parsed_args.is_enabled is not None:
|
|
461
484
|
enabled = parsed_args.is_enabled
|
|
462
485
|
|
|
486
|
+
pagination_kwargs: dict[str, Any] = {}
|
|
487
|
+
if parsed_args.limit is not None:
|
|
488
|
+
pagination_kwargs['limit'] = parsed_args.limit
|
|
489
|
+
if parsed_args.max_items is not None:
|
|
490
|
+
pagination_kwargs['max_items'] = parsed_args.max_items
|
|
491
|
+
if parsed_args.marker is not None:
|
|
492
|
+
pagination_kwargs['marker'] = parsed_args.marker
|
|
493
|
+
|
|
494
|
+
data: list[_user.User]
|
|
463
495
|
if parsed_args.project:
|
|
464
496
|
if domain is not None:
|
|
465
497
|
project = identity_client.find_project(
|
|
@@ -489,21 +521,28 @@ class ListUser(command.Lister):
|
|
|
489
521
|
for user_id in user_ids:
|
|
490
522
|
user = identity_client.find_user(user_id, ignore_missing=False)
|
|
491
523
|
data.append(user)
|
|
492
|
-
|
|
493
524
|
elif parsed_args.group:
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
525
|
+
assert group is not None
|
|
526
|
+
data = list(
|
|
527
|
+
identity_client.group_users(
|
|
528
|
+
domain_id=domain, group=group, **pagination_kwargs
|
|
529
|
+
)
|
|
497
530
|
)
|
|
498
531
|
else:
|
|
499
532
|
if parsed_args.is_enabled is not None:
|
|
500
|
-
data =
|
|
501
|
-
|
|
502
|
-
|
|
533
|
+
data = list(
|
|
534
|
+
identity_client.users(
|
|
535
|
+
domain_id=domain,
|
|
536
|
+
is_enabled=enabled,
|
|
537
|
+
**pagination_kwargs,
|
|
538
|
+
)
|
|
503
539
|
)
|
|
504
540
|
else:
|
|
505
|
-
data =
|
|
506
|
-
|
|
541
|
+
data = list(
|
|
542
|
+
identity_client.users(
|
|
543
|
+
domain_id=domain,
|
|
544
|
+
**pagination_kwargs,
|
|
545
|
+
)
|
|
507
546
|
)
|
|
508
547
|
|
|
509
548
|
# Column handling
|
|
@@ -541,7 +580,7 @@ class ListUser(command.Lister):
|
|
|
541
580
|
class SetUser(command.Command):
|
|
542
581
|
_description = _("Set user properties")
|
|
543
582
|
|
|
544
|
-
def get_parser(self, prog_name):
|
|
583
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
545
584
|
parser = super().get_parser(prog_name)
|
|
546
585
|
parser.add_argument(
|
|
547
586
|
'user',
|
|
@@ -603,8 +642,10 @@ class SetUser(command.Command):
|
|
|
603
642
|
)
|
|
604
643
|
return parser
|
|
605
644
|
|
|
606
|
-
def take_action(self, parsed_args):
|
|
607
|
-
identity_client =
|
|
645
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
646
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
647
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
648
|
+
)
|
|
608
649
|
|
|
609
650
|
if parsed_args.password_prompt:
|
|
610
651
|
parsed_args.password = utils.get_password(self.app.stdin)
|
|
@@ -676,7 +717,7 @@ class SetPasswordUser(command.Command):
|
|
|
676
717
|
|
|
677
718
|
required_scope = False
|
|
678
719
|
|
|
679
|
-
def get_parser(self, prog_name):
|
|
720
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
680
721
|
parser = super().get_parser(prog_name)
|
|
681
722
|
parser.add_argument(
|
|
682
723
|
'--password',
|
|
@@ -690,15 +731,20 @@ class SetPasswordUser(command.Command):
|
|
|
690
731
|
)
|
|
691
732
|
return parser
|
|
692
733
|
|
|
693
|
-
def take_action(self, parsed_args):
|
|
694
|
-
identity_client =
|
|
734
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
735
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
736
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
737
|
+
)
|
|
695
738
|
conn = self.app.client_manager.sdk_connection
|
|
696
739
|
auth = conn.config.get_auth()
|
|
697
740
|
if auth is None:
|
|
698
741
|
# this will never happen
|
|
699
742
|
raise exceptions.CommandError('invalid authentication info')
|
|
700
743
|
|
|
701
|
-
user_id = auth.get_user_id(conn.
|
|
744
|
+
user_id = auth.get_user_id(conn.session)
|
|
745
|
+
if user_id is None:
|
|
746
|
+
# this will never happen
|
|
747
|
+
raise exceptions.CommandError('invalid authentication info')
|
|
702
748
|
|
|
703
749
|
# FIXME(gyee): there are two scenarios:
|
|
704
750
|
#
|
|
@@ -740,7 +786,7 @@ class SetPasswordUser(command.Command):
|
|
|
740
786
|
)
|
|
741
787
|
)
|
|
742
788
|
|
|
743
|
-
identity_client.
|
|
789
|
+
identity_client.update_password(
|
|
744
790
|
user=user_id,
|
|
745
791
|
current_password=current_password,
|
|
746
792
|
password=password,
|
|
@@ -750,7 +796,7 @@ class SetPasswordUser(command.Command):
|
|
|
750
796
|
class ShowUser(command.ShowOne):
|
|
751
797
|
_description = _("Display user details")
|
|
752
798
|
|
|
753
|
-
def get_parser(self, prog_name):
|
|
799
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
754
800
|
parser = super().get_parser(prog_name)
|
|
755
801
|
parser.add_argument(
|
|
756
802
|
'user',
|
|
@@ -764,8 +810,12 @@ class ShowUser(command.ShowOne):
|
|
|
764
810
|
)
|
|
765
811
|
return parser
|
|
766
812
|
|
|
767
|
-
def take_action(
|
|
768
|
-
|
|
813
|
+
def take_action(
|
|
814
|
+
self, parsed_args: argparse.Namespace
|
|
815
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
816
|
+
identity_client = sdk_utils.ensure_service_version(
|
|
817
|
+
self.app.client_manager.sdk_connection.identity, '3'
|
|
818
|
+
)
|
|
769
819
|
|
|
770
820
|
user_str = common._get_token_resource(
|
|
771
821
|
identity_client, 'user', parsed_args.user, parsed_args.domain
|
openstackclient/image/client.py
CHANGED
|
@@ -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 = 'image'
|
|
|
27
29
|
API_VERSIONS = ('1', '2')
|
|
28
30
|
|
|
29
31
|
|
|
30
|
-
def make_client(instance):
|
|
32
|
+
def make_client(instance: Any) -> Any:
|
|
31
33
|
"""Returns an image service client."""
|
|
32
34
|
LOG.debug(
|
|
33
35
|
'Image client initialized using OpenStack SDK: %s',
|
|
@@ -36,7 +38,9 @@ def make_client(instance):
|
|
|
36
38
|
return instance.sdk_connection.image
|
|
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-image-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
|
|
@@ -19,7 +19,8 @@ import argparse
|
|
|
19
19
|
import logging
|
|
20
20
|
import os
|
|
21
21
|
import sys
|
|
22
|
-
import
|
|
22
|
+
from collections.abc import Iterable, Sequence
|
|
23
|
+
from typing import Any
|
|
23
24
|
|
|
24
25
|
from cliff import columns as cliff_columns
|
|
25
26
|
from osc_lib.api import utils as api_utils
|
|
@@ -51,7 +52,7 @@ DISK_CHOICES = [
|
|
|
51
52
|
LOG = logging.getLogger(__name__)
|
|
52
53
|
|
|
53
54
|
|
|
54
|
-
def _get_columns(item):
|
|
55
|
+
def _get_columns(item: Any) -> tuple[tuple[str, ...], tuple[str, ...]]:
|
|
55
56
|
column_map = {'is_protected': 'protected', 'owner_id': 'owner'}
|
|
56
57
|
hidden_columns = [
|
|
57
58
|
'location',
|
|
@@ -69,7 +70,7 @@ def _get_columns(item):
|
|
|
69
70
|
|
|
70
71
|
|
|
71
72
|
class HumanReadableSizeColumn(cliff_columns.FormattableColumn[int]):
|
|
72
|
-
def human_readable(self):
|
|
73
|
+
def human_readable(self) -> str:
|
|
73
74
|
"""Return a formatted visibility string
|
|
74
75
|
|
|
75
76
|
:rtype:
|
|
@@ -83,7 +84,7 @@ class HumanReadableSizeColumn(cliff_columns.FormattableColumn[int]):
|
|
|
83
84
|
|
|
84
85
|
|
|
85
86
|
class VisibilityColumn(cliff_columns.FormattableColumn[bool]):
|
|
86
|
-
def human_readable(self):
|
|
87
|
+
def human_readable(self) -> str:
|
|
87
88
|
"""Return a formatted visibility string
|
|
88
89
|
|
|
89
90
|
:rtype:
|
|
@@ -99,7 +100,7 @@ class VisibilityColumn(cliff_columns.FormattableColumn[bool]):
|
|
|
99
100
|
class CreateImage(command.ShowOne):
|
|
100
101
|
_description = _("Create/upload an image")
|
|
101
102
|
|
|
102
|
-
def get_parser(self, prog_name):
|
|
103
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
103
104
|
parser = super().get_parser(prog_name)
|
|
104
105
|
parser.add_argument(
|
|
105
106
|
"name",
|
|
@@ -239,7 +240,9 @@ class CreateImage(command.ShowOne):
|
|
|
239
240
|
)
|
|
240
241
|
return parser
|
|
241
242
|
|
|
242
|
-
def take_action(
|
|
243
|
+
def take_action(
|
|
244
|
+
self, parsed_args: argparse.Namespace
|
|
245
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
243
246
|
image_client = self.app.client_manager.image
|
|
244
247
|
|
|
245
248
|
# Build an attribute dict from the parsed args, only include
|
|
@@ -299,7 +302,7 @@ class CreateImage(command.ShowOne):
|
|
|
299
302
|
volume_client.volumes,
|
|
300
303
|
parsed_args.volume,
|
|
301
304
|
)
|
|
302
|
-
|
|
305
|
+
_response, body = volume_client.volumes.upload_to_image(
|
|
303
306
|
source_volume.id,
|
|
304
307
|
parsed_args.force,
|
|
305
308
|
parsed_args.name,
|
|
@@ -314,10 +317,10 @@ class CreateImage(command.ShowOne):
|
|
|
314
317
|
else:
|
|
315
318
|
# Read file from stdin
|
|
316
319
|
if not sys.stdin.isatty():
|
|
317
|
-
if
|
|
320
|
+
if sys.platform == "win32":
|
|
318
321
|
import msvcrt
|
|
319
322
|
|
|
320
|
-
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
|
|
323
|
+
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
|
|
321
324
|
if hasattr(sys.stdin, 'buffer'):
|
|
322
325
|
kwargs['data'] = sys.stdin.buffer
|
|
323
326
|
else:
|
|
@@ -351,13 +354,15 @@ class CreateImage(command.ShowOne):
|
|
|
351
354
|
info['properties'] = format_columns.DictColumn(
|
|
352
355
|
info.get('properties', {})
|
|
353
356
|
)
|
|
354
|
-
|
|
357
|
+
col_headers, col_data = zip(*sorted(info.items()))
|
|
358
|
+
return col_headers, col_data
|
|
359
|
+
return ((), ())
|
|
355
360
|
|
|
356
361
|
|
|
357
362
|
class DeleteImage(command.Command):
|
|
358
363
|
_description = _("Delete image(s)")
|
|
359
364
|
|
|
360
|
-
def get_parser(self, prog_name):
|
|
365
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
361
366
|
parser = super().get_parser(prog_name)
|
|
362
367
|
parser.add_argument(
|
|
363
368
|
"images",
|
|
@@ -367,7 +372,7 @@ class DeleteImage(command.Command):
|
|
|
367
372
|
)
|
|
368
373
|
return parser
|
|
369
374
|
|
|
370
|
-
def take_action(self, parsed_args):
|
|
375
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
371
376
|
result = 0
|
|
372
377
|
image_client = self.app.client_manager.image
|
|
373
378
|
for image in parsed_args.images:
|
|
@@ -396,7 +401,7 @@ class DeleteImage(command.Command):
|
|
|
396
401
|
class ListImage(command.Lister):
|
|
397
402
|
_description = _("List available images")
|
|
398
403
|
|
|
399
|
-
def get_parser(self, prog_name):
|
|
404
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
400
405
|
parser = super().get_parser(prog_name)
|
|
401
406
|
public_group = parser.add_mutually_exclusive_group()
|
|
402
407
|
public_group.add_argument(
|
|
@@ -453,7 +458,9 @@ class ListImage(command.Lister):
|
|
|
453
458
|
)
|
|
454
459
|
return parser
|
|
455
460
|
|
|
456
|
-
def take_action(
|
|
461
|
+
def take_action(
|
|
462
|
+
self, parsed_args: argparse.Namespace
|
|
463
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
457
464
|
image_client = self.app.client_manager.image
|
|
458
465
|
|
|
459
466
|
kwargs = {}
|
|
@@ -498,7 +505,7 @@ class ListImage(command.Lister):
|
|
|
498
505
|
|
|
499
506
|
if parsed_args.property:
|
|
500
507
|
# NOTE(dtroyer): coerce to a list to subscript it in py3
|
|
501
|
-
attr, value =
|
|
508
|
+
attr, value = next(iter(parsed_args.property.items()))
|
|
502
509
|
api_utils.simple_filter(
|
|
503
510
|
images,
|
|
504
511
|
attr=attr,
|
|
@@ -527,7 +534,7 @@ class ListImage(command.Lister):
|
|
|
527
534
|
class SaveImage(command.Command):
|
|
528
535
|
_description = _("Save an image locally")
|
|
529
536
|
|
|
530
|
-
def get_parser(self, prog_name):
|
|
537
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
531
538
|
parser = super().get_parser(prog_name)
|
|
532
539
|
parser.add_argument(
|
|
533
540
|
"--chunk-size",
|
|
@@ -551,7 +558,7 @@ class SaveImage(command.Command):
|
|
|
551
558
|
)
|
|
552
559
|
return parser
|
|
553
560
|
|
|
554
|
-
def take_action(self, parsed_args):
|
|
561
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
555
562
|
image_client = self.app.client_manager.image
|
|
556
563
|
image = image_client.find_image(
|
|
557
564
|
parsed_args.image, ignore_missing=False
|
|
@@ -572,7 +579,7 @@ class SaveImage(command.Command):
|
|
|
572
579
|
class SetImage(command.Command):
|
|
573
580
|
_description = _("Set image properties")
|
|
574
581
|
|
|
575
|
-
def get_parser(self, prog_name):
|
|
582
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
576
583
|
parser = super().get_parser(prog_name)
|
|
577
584
|
parser.add_argument(
|
|
578
585
|
"image",
|
|
@@ -702,7 +709,7 @@ class SetImage(command.Command):
|
|
|
702
709
|
)
|
|
703
710
|
return parser
|
|
704
711
|
|
|
705
|
-
def take_action(self, parsed_args):
|
|
712
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
706
713
|
image_client = self.app.client_manager.image
|
|
707
714
|
|
|
708
715
|
kwargs = {}
|
|
@@ -785,10 +792,10 @@ class SetImage(command.Command):
|
|
|
785
792
|
# Read file from stdin
|
|
786
793
|
if sys.stdin.isatty() is not True:
|
|
787
794
|
if parsed_args.stdin:
|
|
788
|
-
if
|
|
795
|
+
if sys.platform == "win32":
|
|
789
796
|
import msvcrt
|
|
790
797
|
|
|
791
|
-
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
|
|
798
|
+
msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY)
|
|
792
799
|
if hasattr(sys.stdin, 'buffer'):
|
|
793
800
|
kwargs['data'] = sys.stdin.buffer
|
|
794
801
|
else:
|
|
@@ -819,7 +826,7 @@ class SetImage(command.Command):
|
|
|
819
826
|
class ShowImage(command.ShowOne):
|
|
820
827
|
_description = _("Display image details")
|
|
821
828
|
|
|
822
|
-
def get_parser(self, prog_name):
|
|
829
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
823
830
|
parser = super().get_parser(prog_name)
|
|
824
831
|
parser.add_argument(
|
|
825
832
|
"--human-readable",
|
|
@@ -834,15 +841,15 @@ class ShowImage(command.ShowOne):
|
|
|
834
841
|
)
|
|
835
842
|
return parser
|
|
836
843
|
|
|
837
|
-
def take_action(
|
|
844
|
+
def take_action(
|
|
845
|
+
self, parsed_args: argparse.Namespace
|
|
846
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
838
847
|
image_client = self.app.client_manager.image
|
|
839
848
|
image = image_client.find_image(
|
|
840
849
|
parsed_args.image, ignore_missing=False
|
|
841
850
|
)
|
|
842
851
|
|
|
843
|
-
formatters: dict[
|
|
844
|
-
str, type[cliff_columns.FormattableColumn[ty.Any]]
|
|
845
|
-
] = {
|
|
852
|
+
formatters: dict[str, type[cliff_columns.FormattableColumn[Any]]] = {
|
|
846
853
|
'properties': format_columns.DictColumn,
|
|
847
854
|
}
|
|
848
855
|
if parsed_args.human_readable:
|
|
@@ -13,9 +13,12 @@
|
|
|
13
13
|
# License for the specific language governing permissions and limitations
|
|
14
14
|
# under the License.
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
17
|
+
from collections.abc import Iterable, Sequence
|
|
16
18
|
import copy
|
|
17
19
|
import datetime
|
|
18
20
|
import logging
|
|
21
|
+
from typing import Any
|
|
19
22
|
|
|
20
23
|
from osc_lib import exceptions
|
|
21
24
|
from osc_lib import utils
|
|
@@ -27,7 +30,7 @@ from openstackclient.i18n import _
|
|
|
27
30
|
LOG = logging.getLogger(__name__)
|
|
28
31
|
|
|
29
32
|
|
|
30
|
-
def _format_image_cache(cached_images):
|
|
33
|
+
def _format_image_cache(cached_images: dict[str, Any]) -> list[dict[str, Any]]:
|
|
31
34
|
"""Format image cache to make it more consistent with OSC operations."""
|
|
32
35
|
|
|
33
36
|
image_list = []
|
|
@@ -38,14 +41,14 @@ def _format_image_cache(cached_images):
|
|
|
38
41
|
image_obj['state'] = 'cached'
|
|
39
42
|
image_obj['last_accessed'] = (
|
|
40
43
|
datetime.datetime.fromtimestamp(
|
|
41
|
-
image['last_accessed'], tz=datetime.
|
|
44
|
+
image['last_accessed'], tz=datetime.UTC
|
|
42
45
|
)
|
|
43
46
|
.replace(tzinfo=None)
|
|
44
47
|
.isoformat()
|
|
45
48
|
)
|
|
46
49
|
image_obj['last_modified'] = (
|
|
47
50
|
datetime.datetime.fromtimestamp(
|
|
48
|
-
image['last_modified'], tz=datetime.
|
|
51
|
+
image['last_modified'], tz=datetime.UTC
|
|
49
52
|
)
|
|
50
53
|
.replace(tzinfo=None)
|
|
51
54
|
.isoformat()
|
|
@@ -70,11 +73,13 @@ def _format_image_cache(cached_images):
|
|
|
70
73
|
class ListCachedImage(command.Lister):
|
|
71
74
|
_description = _("Get Cache State")
|
|
72
75
|
|
|
73
|
-
def get_parser(self, prog_name):
|
|
76
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
74
77
|
parser = super().get_parser(prog_name)
|
|
75
78
|
return parser
|
|
76
79
|
|
|
77
|
-
def take_action(
|
|
80
|
+
def take_action(
|
|
81
|
+
self, parsed_args: argparse.Namespace
|
|
82
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
78
83
|
image_client = self.app.client_manager.image
|
|
79
84
|
|
|
80
85
|
# List of Cache data received
|
|
@@ -111,7 +116,7 @@ class ListCachedImage(command.Lister):
|
|
|
111
116
|
class QueueCachedImage(command.Command):
|
|
112
117
|
_description = _("Queue image(s) for caching.")
|
|
113
118
|
|
|
114
|
-
def get_parser(self, prog_name):
|
|
119
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
115
120
|
parser = super().get_parser(prog_name)
|
|
116
121
|
parser.add_argument(
|
|
117
122
|
"images",
|
|
@@ -121,7 +126,7 @@ class QueueCachedImage(command.Command):
|
|
|
121
126
|
)
|
|
122
127
|
return parser
|
|
123
128
|
|
|
124
|
-
def take_action(self, parsed_args):
|
|
129
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
125
130
|
image_client = self.app.client_manager.image
|
|
126
131
|
|
|
127
132
|
failures = 0
|
|
@@ -151,7 +156,7 @@ class QueueCachedImage(command.Command):
|
|
|
151
156
|
class DeleteCachedImage(command.Command):
|
|
152
157
|
_description = _("Delete image(s) from cache")
|
|
153
158
|
|
|
154
|
-
def get_parser(self, prog_name):
|
|
159
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
155
160
|
parser = super().get_parser(prog_name)
|
|
156
161
|
parser.add_argument(
|
|
157
162
|
"images",
|
|
@@ -161,7 +166,7 @@ class DeleteCachedImage(command.Command):
|
|
|
161
166
|
)
|
|
162
167
|
return parser
|
|
163
168
|
|
|
164
|
-
def take_action(self, parsed_args):
|
|
169
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
165
170
|
failures = 0
|
|
166
171
|
image_client = self.app.client_manager.image
|
|
167
172
|
for image in parsed_args.images:
|
|
@@ -190,7 +195,7 @@ class DeleteCachedImage(command.Command):
|
|
|
190
195
|
class ClearCachedImage(command.Command):
|
|
191
196
|
_description = _("Clear all images from cache, queue or both")
|
|
192
197
|
|
|
193
|
-
def get_parser(self, prog_name):
|
|
198
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
194
199
|
parser = super().get_parser(prog_name)
|
|
195
200
|
parser.add_argument(
|
|
196
201
|
"--cache",
|
|
@@ -210,7 +215,7 @@ class ClearCachedImage(command.Command):
|
|
|
210
215
|
)
|
|
211
216
|
return parser
|
|
212
217
|
|
|
213
|
-
def take_action(self, parsed_args):
|
|
218
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
214
219
|
image_client = self.app.client_manager.image
|
|
215
220
|
|
|
216
221
|
target = parsed_args.target
|