summaryrefslogtreecommitdiff
path: root/openstackclient/image/v2
diff options
Diffstat (limited to 'openstackclient/image/v2')
-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
9 files changed, 26 insertions, 21 deletions
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 = {