Remove image 'host' parameter when delete image.

Image object has added 'host', just uuid is necessary when
delete image.

Change-Id: I64a3504ca47df7141a9339ec90a767daf2ba509a
This commit is contained in:
weikeyou 2018-08-23 14:10:19 +08:00
parent 362d003f01
commit c39c60ddcb
3 changed files with 3 additions and 12 deletions

View File

@ -166,17 +166,12 @@ class DeleteImage(command.Command):
'uuid', 'uuid',
metavar='<uuid>', metavar='<uuid>',
help='UUID of image to describe') help='UUID of image to describe')
parser.add_argument(
'host',
metavar='<host>',
help='Name or UUID of the host')
return parser return parser
def take_action(self, parsed_args): def take_action(self, parsed_args):
client = _get_client(self, parsed_args) client = _get_client(self, parsed_args)
opts = {} opts = {}
opts['image_id'] = parsed_args.uuid opts['image_id'] = parsed_args.uuid
opts['host'] = parsed_args.host
try: try:
client.images.delete(**opts) client.images.delete(**opts)
print(_('Request to delete image %s has been accepted.') print(_('Request to delete image %s has been accepted.')

View File

@ -90,12 +90,12 @@ class ImageManager(base.Manager):
"Key must be in %s" % ','.join(PULL_ATTRIBUTES)) "Key must be in %s" % ','.join(PULL_ATTRIBUTES))
return self._create(self._path(), new) return self._create(self._path(), new)
def delete(self, image_id, **kwargs): def delete(self, image_id):
"""Delete an image """Delete an image
:params image_id: uuid of the image. :params image_id: uuid of the image.
""" """
return self._delete(self._path(image_id), qparams=kwargs) return self._delete(self._path(image_id))
def search_image(self, image, **kwargs): def search_image(self, image, **kwargs):
"""Retrieves list of images based on image name and image_driver name """Retrieves list of images based on image name and image_driver name

View File

@ -73,14 +73,10 @@ def do_image_show(cs, args):
@utils.arg('id', @utils.arg('id',
metavar='<uuid>', metavar='<uuid>',
help='UUID of image to delete') help='UUID of image to delete')
@utils.arg('host',
metavar='<host>',
help='Name or UUID of the host')
def do_image_delete(cs, args): def do_image_delete(cs, args):
"""Delete a specified image from a host.""" """Delete a specified image."""
opts = {} opts = {}
opts['image_id'] = args.id opts['image_id'] = args.id
opts['host'] = args.host
cs.images.delete(**opts) cs.images.delete(**opts)