summaryrefslogtreecommitdiff
path: root/openstackclient/image/v2
diff options
context:
space:
mode:
Diffstat (limited to 'openstackclient/image/v2')
-rw-r--r--openstackclient/image/v2/image.py36
1 files changed, 32 insertions, 4 deletions
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index ad38c01e..becb54f4 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -31,7 +31,6 @@ from osc_lib import exceptions
from osc_lib import utils
from openstackclient.common import progressbar
-from openstackclient.common import sdk_utils
from openstackclient.i18n import _
from openstackclient.identity import common
@@ -99,13 +98,13 @@ _formatters = {
def _get_member_columns(item):
- # Trick sdk_utils to return URI attribute
column_map = {
'image_id': 'image_id'
}
hidden_columns = ['id', 'location', 'name']
- return sdk_utils.get_osc_show_columns_for_sdk_resource(
- item.to_dict(), column_map, hidden_columns)
+ return utils.get_osc_show_columns_for_sdk_resource(
+ item.to_dict(), column_map, hidden_columns,
+ )
def get_data_file(args):
@@ -490,6 +489,8 @@ class CreateImage(command.ShowOne):
parsed_args.name,
parsed_args.container_format,
parsed_args.disk_format,
+ visibility=kwargs.get('visibility', 'private'),
+ protected=True if parsed_args.protected else False
)
info = body['os-volume_upload_image']
try:
@@ -616,6 +617,12 @@ class ListImage(command.Lister):
help=_('Filter images based on tag.'),
)
parser.add_argument(
+ '--hidden',
+ action='store_true',
+ default=False,
+ help=_('List hidden images'),
+ )
+ parser.add_argument(
'--long',
action='store_true',
default=False,
@@ -686,6 +693,8 @@ class ListImage(command.Lister):
parsed_args.project_domain,
).id
kwargs['owner'] = project_id
+ if parsed_args.hidden:
+ kwargs['is_hidden'] = True
if parsed_args.long:
columns = (
'ID',
@@ -1016,6 +1025,22 @@ class SetImage(command.Command):
action="store_true",
help=_("Reset the image membership to 'pending'"),
)
+
+ hidden_group = parser.add_mutually_exclusive_group()
+ hidden_group.add_argument(
+ "--hidden",
+ dest='hidden',
+ default=None,
+ action="store_true",
+ help=_("Hide the image"),
+ )
+ hidden_group.add_argument(
+ "--unhidden",
+ dest='hidden',
+ default=None,
+ action="store_false",
+ help=_("Unhide the image"),
+ )
return parser
def take_action(self, parsed_args):
@@ -1106,6 +1131,9 @@ class SetImage(command.Command):
# Tags should be extended, but duplicates removed
kwargs['tags'] = list(set(image.tags).union(set(parsed_args.tags)))
+ if parsed_args.hidden is not None:
+ kwargs['is_hidden'] = parsed_args.hidden
+
try:
image = image_client.update_image(image.id, **kwargs)
except Exception: