summaryrefslogtreecommitdiff
path: root/openstackclient/image
diff options
context:
space:
mode:
authorThomas Goirand <zigo@debian.org>2026-02-27 19:32:22 +0100
committergit-ubuntu importer <ubuntu-devel-discuss@lists.ubuntu.com>2026-02-27 22:30:41 +0000
commiteea691be496ccaccbfa6c5317edd3529fb19f3e4 (patch)
tree0c5af2c99703c82796c0a06e129d867c64cc183f /openstackclient/image
parent28412f7dd30f762954b495eb1fe0db14900e0b22 (diff)
9.0.0-1 (patches unapplied)import/9.0.0-1debian/experimental
Imported using git-ubuntu import.
Notes
Notes: * New upstream release. * Fixed (build-)depends for this release. * Removed patches applied upstream: - Fix_openstack_quota_show_without_cinder.patch - add-missing-backup_id-field.patch
Diffstat (limited to 'openstackclient/image')
-rw-r--r--openstackclient/image/v1/image.py35
-rw-r--r--openstackclient/image/v2/cache.py2
-rw-r--r--openstackclient/image/v2/image.py28
-rw-r--r--openstackclient/image/v2/info.py2
-rw-r--r--openstackclient/image/v2/metadef_namespaces.py2
-rw-r--r--openstackclient/image/v2/metadef_objects.py2
-rw-r--r--openstackclient/image/v2/metadef_properties.py5
-rw-r--r--openstackclient/image/v2/metadef_resource_type_association.py2
-rw-r--r--openstackclient/image/v2/metadef_resource_types.py2
-rw-r--r--openstackclient/image/v2/task.py2
10 files changed, 45 insertions, 37 deletions
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index 91b0db4..0ea7eca 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -19,15 +19,16 @@ import argparse
import logging
import os
import sys
+import typing as ty
from cliff import columns as cliff_columns
from osc_lib.api import utils as api_utils
from osc_lib.cli import format_columns
from osc_lib.cli import parseractions
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
CONTAINER_CHOICES = ["ami", "ari", "aki", "bare", "docker", "ova", "ovf"]
@@ -67,10 +68,7 @@ def _get_columns(item):
)
-_formatters = {}
-
-
-class HumanReadableSizeColumn(cliff_columns.FormattableColumn):
+class HumanReadableSizeColumn(cliff_columns.FormattableColumn[int]):
def human_readable(self):
"""Return a formatted visibility string
@@ -84,7 +82,7 @@ class HumanReadableSizeColumn(cliff_columns.FormattableColumn):
return ''
-class VisibilityColumn(cliff_columns.FormattableColumn):
+class VisibilityColumn(cliff_columns.FormattableColumn[bool]):
def human_readable(self):
"""Return a formatted visibility string
@@ -340,9 +338,12 @@ class CreateImage(command.ShowOne):
if image:
display_columns, columns = _get_columns(image)
- _formatters['properties'] = format_columns.DictColumn
data = utils.get_item_properties(
- image, columns, formatters=_formatters
+ image,
+ columns,
+ formatters={
+ 'properties': format_columns.DictColumn,
+ },
)
return (display_columns, data)
elif info:
@@ -493,19 +494,19 @@ class ListImage(command.Lister):
column_headers = columns
# List of image data received
- data = list(image_client.images(**kwargs))
+ images = list(image_client.images(**kwargs))
if parsed_args.property:
# NOTE(dtroyer): coerce to a list to subscript it in py3
attr, value = list(parsed_args.property.items())[0]
api_utils.simple_filter(
- data,
+ images,
attr=attr,
value=value,
property_field='properties',
)
- data = utils.sort_items(data, parsed_args.sort)
+ data = utils.sort_items(images, parsed_args.sort)
return (
column_headers,
@@ -839,11 +840,13 @@ class ShowImage(command.ShowOne):
parsed_args.image, ignore_missing=False
)
+ formatters: dict[
+ str, type[cliff_columns.FormattableColumn[ty.Any]]
+ ] = {
+ 'properties': format_columns.DictColumn,
+ }
if parsed_args.human_readable:
- _formatters['size'] = HumanReadableSizeColumn
+ formatters['size'] = HumanReadableSizeColumn
display_columns, columns = _get_columns(image)
- _formatters['properties'] = format_columns.DictColumn
- data = utils.get_item_properties(
- image, columns, formatters=_formatters
- )
+ data = utils.get_item_properties(image, columns, formatters=formatters)
return (display_columns, data)
diff --git a/openstackclient/image/v2/cache.py b/openstackclient/image/v2/cache.py
index 9fbce84..952d9ed 100644
--- a/openstackclient/image/v2/cache.py
+++ b/openstackclient/image/v2/cache.py
@@ -17,10 +17,10 @@ import copy
import datetime
import logging
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index f35c572..a7db86c 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -30,10 +30,10 @@ from openstack import utils as sdk_utils
from osc_lib.api import utils as api_utils
from osc_lib.cli import format_columns
from osc_lib.cli import parseractions
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.common import pagination
from openstackclient.common import progressbar
from openstackclient.i18n import _
@@ -551,7 +551,7 @@ class CreateImage(command.ShowOne):
sign_cert_id = parsed_args.sign_cert_id
signer = image_signer.ImageSigner()
try:
- pw = utils.get_password(
+ pw: str | None = utils.get_password(
self.app.stdin,
prompt=(
"Please enter private key password, leave "
@@ -562,12 +562,11 @@ class CreateImage(command.ShowOne):
if not pw or len(pw) < 1:
pw = None
- else:
- # load_private_key() requires the password to be
- # passed as bytes
- pw = pw.encode()
- signer.load_private_key(sign_key_path, password=pw)
+ signer.load_private_key(
+ sign_key_path,
+ password=pw.encode() if pw else None,
+ )
except Exception:
msg = _(
"Error during sign operation: private key "
@@ -623,7 +622,7 @@ class CreateImage(command.ShowOne):
)
# TODO(stephenfin): These should be an error in a future
# version
- LOG.warning(msg % opt_name)
+ LOG.warning(msg, opt_name)
source_volume = volume_client.find_volume(
parsed_args.volume, ignore_missing=False
@@ -933,18 +932,19 @@ class ListImage(command.Lister):
if 'limit' in kwargs:
# Disable automatic pagination in SDK
kwargs['paginated'] = False
- data = list(image_client.images(**kwargs))
+
+ images = list(image_client.images(**kwargs))
if parsed_args.property:
for attr, value in parsed_args.property.items():
api_utils.simple_filter(
- data,
+ images,
attr=attr,
value=value,
property_field='properties',
)
- data = utils.sort_items(data, parsed_args.sort, str)
+ data = utils.sort_items(images, parsed_args.sort, str)
return (
column_headers,
@@ -1393,7 +1393,10 @@ class SetImage(command.Command):
if parsed_args.visibility is not None:
kwargs['visibility'] = parsed_args.visibility
- if parsed_args.project:
+ # Only set owner_id if --project is used WITHOUT membership flags
+ # When --project is used with --accept/--reject/--pending, it should
+ # only identify which member's status to update, not change ownership
+ if parsed_args.project and not parsed_args.membership:
# We already did the project lookup above
kwargs['owner_id'] = project_id
@@ -1716,6 +1719,7 @@ class ImportImage(command.ShowOne):
)
stores_group.add_argument(
'--all-stores',
+ action='store_true',
help=_(
"Make image available to all stores "
"(either '--store' or '--all-stores' required with the "
diff --git a/openstackclient/image/v2/info.py b/openstackclient/image/v2/info.py
index 469b15a..6884813 100644
--- a/openstackclient/image/v2/info.py
+++ b/openstackclient/image/v2/info.py
@@ -12,8 +12,8 @@
from osc_lib.cli import format_columns
-from osc_lib.command import command
+from openstackclient import command
from openstackclient.i18n import _
diff --git a/openstackclient/image/v2/metadef_namespaces.py b/openstackclient/image/v2/metadef_namespaces.py
index f753286..af30f71 100644
--- a/openstackclient/image/v2/metadef_namespaces.py
+++ b/openstackclient/image/v2/metadef_namespaces.py
@@ -18,10 +18,10 @@
import logging
from osc_lib.cli import format_columns
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
_formatters = {
diff --git a/openstackclient/image/v2/metadef_objects.py b/openstackclient/image/v2/metadef_objects.py
index 09fc249..d5cbec1 100644
--- a/openstackclient/image/v2/metadef_objects.py
+++ b/openstackclient/image/v2/metadef_objects.py
@@ -17,10 +17,10 @@
import logging
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
diff --git a/openstackclient/image/v2/metadef_properties.py b/openstackclient/image/v2/metadef_properties.py
index 6027773..3a923c5 100644
--- a/openstackclient/image/v2/metadef_properties.py
+++ b/openstackclient/image/v2/metadef_properties.py
@@ -15,10 +15,10 @@
import json
import logging
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
@@ -127,7 +127,8 @@ class DeleteMetadefProperty(command.Command):
nargs="*",
help=_(
"Metadef properties to delete (name) "
- "(omit this argument to delete all properties in the namespace)"
+ "(omit this argument to delete all properties "
+ "in the namespace)"
),
)
return parser
diff --git a/openstackclient/image/v2/metadef_resource_type_association.py b/openstackclient/image/v2/metadef_resource_type_association.py
index 306783c..4d3ee46 100644
--- a/openstackclient/image/v2/metadef_resource_type_association.py
+++ b/openstackclient/image/v2/metadef_resource_type_association.py
@@ -12,10 +12,10 @@
import logging
-from osc_lib.command import command
from osc_lib import exceptions
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
LOG = logging.getLogger(__name__)
diff --git a/openstackclient/image/v2/metadef_resource_types.py b/openstackclient/image/v2/metadef_resource_types.py
index 3477df3..88001b7 100644
--- a/openstackclient/image/v2/metadef_resource_types.py
+++ b/openstackclient/image/v2/metadef_resource_types.py
@@ -12,9 +12,9 @@
"""Image V2 Action Implementations"""
-from osc_lib.command import command
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
diff --git a/openstackclient/image/v2/task.py b/openstackclient/image/v2/task.py
index 1b7170f..a0f1d35 100644
--- a/openstackclient/image/v2/task.py
+++ b/openstackclient/image/v2/task.py
@@ -11,9 +11,9 @@
# under the License.
from osc_lib.cli import format_columns
-from osc_lib.command import command
from osc_lib import utils
+from openstackclient import command
from openstackclient.i18n import _
_formatters = {