Remove deprecated image commands

* Remove ``image create|set`` option ``--owner``

Change-Id: I1fabab98c8660eba6d0dd75e74544c6c9d432b9e
Signed-off-by: Dean Troyer <dtroyer@gmail.com>
This commit is contained in:
Dean Troyer 2019-05-15 22:20:25 -05:00
parent f9fdc296bc
commit 67dadda746
6 changed files with 43 additions and 147 deletions
doc/source/cli
openstackclient
image
tests/unit/image/v2
releasenotes/notes

View File

@ -49,6 +49,12 @@ Release 4.0
* Removed in: 4.0
* Commit: https://review.opendev.org/612798
6. Remove ``image create|set`` option ``--owner``.
Use ``--project`` option instead.
* Removed in: 4.0
* Commit: https://review.opendev.org/659431
.. 1. Change ``volume transfer request accept`` to use new option ``--auth-key``
.. rather than a second positional argument.

View File

@ -1,24 +1,24 @@
explain,WONTFIX,Describe a specific model.
image-create,image create,Create a new image.
image-deactivate,image set --deactivate,Deactivate specified image.
image-delete,image delete,Delete specified image.
image-download,image save,Download a specific image.
image-list,image list,List images you can access.
image-reactivate,image set --activate,Reactivate specified image.
image-show,image show,Describe a specific image.
image-tag-delete,image set --tag <tag>,Delete the tag associated with the given image.
image-tag-update,image unset --tag <tag>,Update an image with the given tag.
image-update,image set,Update an existing image.
image-upload,,Upload data for a specific image.
location-add,,Add a location (and related metadata) to an image.
location-delete,,Remove locations (and related metadata) from an image.
location-update,,Update metadata of an image's location.
member-create,image add project,Create member for a given image.
member-delete,image remove project,Delete image member.
member-list,,Describe sharing permissions by image.
member-update,image set --accept --reject --status,Update the status of a member for a given image.
task-create,,Create a new task.
task-list,,List tasks you can access.
task-show,,Describe a specific task.
bash-completion,complete,Prints arguments for bash_completion.
help,help,Display help about this program or one of its subcommands.
explain,WONTFIX,Describe a specific model.
image-create,image create,Create a new image.
image-deactivate,image set --deactivate,Deactivate specified image.
image-delete,image delete,Delete specified image.
image-download,image save,Download a specific image.
image-list,image list,List images you can access.
image-reactivate,image set --activate,Reactivate specified image.
image-show,image show,Describe a specific image.
image-tag-delete,image unset --tag <tag>,Delete the tag associated with the given image.
image-tag-update,image set --tag <tag>,Update an image with the given tag.
image-update,image set,Update an existing image.
image-upload,,Upload data for a specific image.
location-add,,Add a location (and related metadata) to an image.
location-delete,,Remove locations (and related metadata) from an image.
location-update,,Update metadata of an image's location.
member-create,image add project,Create member for a given image.
member-delete,image remove project,Delete image member.
member-list,,Describe sharing permissions by image.
member-update,image set --accept --reject --status,Update the status of a member for a given image.
task-create,,Create a new task.
task-list,,List tasks you can access.
task-show,,Describe a specific task.
bash-completion,complete,Prints arguments for bash_completion.
help,help,Display help about this program or one of its subcommands.

1 explain WONTFIX Describe a specific model.
2 image-create image create Create a new image.
3 image-deactivate image set --deactivate Deactivate specified image.
4 image-delete image delete Delete specified image.
5 image-download image save Download a specific image.
6 image-list image list List images you can access.
7 image-reactivate image set --activate Reactivate specified image.
8 image-show image show Describe a specific image.
9 image-tag-delete image set --tag <tag> image unset --tag <tag> Delete the tag associated with the given image.
10 image-tag-update image unset --tag <tag> image set --tag <tag> Update an image with the given tag.
11 image-update image set Update an existing image.
12 image-upload Upload data for a specific image.
13 location-add Add a location (and related metadata) to an image.
14 location-delete Remove locations (and related metadata) from an image.
15 location-update Update metadata of an image's location.
16 member-create image add project Create member for a given image.
17 member-delete image remove project Delete image member.
18 member-list Describe sharing permissions by image.
19 member-update image set --accept --reject --status Update the status of a member for a given image.
20 task-create Create a new task.
21 task-list List tasks you can access.
22 task-show Describe a specific task.
23 bash-completion complete Prints arguments for bash_completion.
24 help help Display help about this program or one of its subcommands.

View File

@ -182,29 +182,16 @@ class CreateImage(command.ShowOne):
help=_("Set a property on this image "
"(repeat option to set multiple properties)"),
)
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
# 2.x release. Do not remove before Jan 2017
# and a 3.x release.
project_group = parser.add_mutually_exclusive_group()
project_group.add_argument(
parser.add_argument(
"--project",
metavar="<project>",
help=_("Set an alternate project on this image (name or ID)"),
)
project_group.add_argument(
"--owner",
metavar="<project>",
help=argparse.SUPPRESS,
)
return parser
def take_action(self, parsed_args):
image_client = self.app.client_manager.image
if getattr(parsed_args, 'owner', None) is not None:
LOG.warning(_('The --owner option is deprecated, '
'please use --project instead.'))
# Build an attribute dict from the parsed args, only include
# attributes that were actually set on the command line
kwargs = {}
@ -599,29 +586,16 @@ class SetImage(command.Command):
metavar="<checksum>",
help=_("Image hash used for verification"),
)
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
# 2.x release. Do not remove before Jan 2017
# and a 3.x release.
project_group = parser.add_mutually_exclusive_group()
project_group.add_argument(
parser.add_argument(
"--project",
metavar="<project>",
help=_("Set an alternate project on this image (name or ID)"),
)
project_group.add_argument(
"--owner",
metavar="<project>",
help=argparse.SUPPRESS,
)
return parser
def take_action(self, parsed_args):
image_client = self.app.client_manager.image
if getattr(parsed_args, 'owner', None) is not None:
LOG.warning(_('The --owner option is deprecated, '
'please use --project instead.'))
kwargs = {}
copy_attrs = ('name', 'owner', 'min_disk', 'min_ram', 'properties',
'container_format', 'disk_format', 'size', 'store',

View File

@ -250,20 +250,11 @@ class CreateImage(command.ShowOne):
help=_("Set a tag on this image "
"(repeat option to set multiple tags)"),
)
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
# 2.x release. Do not remove before Jan 2017
# and a 3.x release.
project_group = parser.add_mutually_exclusive_group()
project_group.add_argument(
parser.add_argument(
"--project",
metavar="<project>",
help=_("Set an alternate project on this image (name or ID)"),
)
project_group.add_argument(
"--owner",
metavar="<project>",
help=argparse.SUPPRESS,
)
common.add_project_domain_option_to_parser(parser)
for deadopt in self.deadopts:
parser.add_argument(
@ -321,16 +312,10 @@ class CreateImage(command.ShowOne):
kwargs['visibility'] = 'community'
if parsed_args.shared:
kwargs['visibility'] = 'shared'
# Handle deprecated --owner option
project_arg = parsed_args.project
if parsed_args.owner:
project_arg = parsed_args.owner
LOG.warning(_('The --owner option is deprecated, '
'please use --project instead.'))
if project_arg:
if parsed_args.project:
kwargs['owner'] = common.find_project(
identity_client,
project_arg,
parsed_args.project,
parsed_args.project_domain,
).id
@ -347,13 +332,6 @@ class CreateImage(command.ShowOne):
LOG.warning(_("Failed to get an image file."))
return {}, {}
if parsed_args.owner:
kwargs['owner'] = common.find_project(
identity_client,
parsed_args.owner,
parsed_args.project_domain,
).id
# sign an image using a given local private key file
if parsed_args.sign_key_path or parsed_args.sign_cert_id:
if not parsed_args.file:
@ -933,20 +911,11 @@ class SetImage(command.Command):
action="store_true",
help=_("Activate the image"),
)
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
# 2.x release. Do not remove before Jan 2017
# and a 3.x release.
project_group = parser.add_mutually_exclusive_group()
project_group.add_argument(
parser.add_argument(
"--project",
metavar="<project>",
help=_("Set an alternate project on this image (name or ID)"),
)
project_group.add_argument(
"--owner",
metavar="<project>",
help=argparse.SUPPRESS,
)
common.add_project_domain_option_to_parser(parser)
for deadopt in self.deadopts:
parser.add_argument(
@ -1020,17 +989,11 @@ class SetImage(command.Command):
kwargs['visibility'] = 'community'
if parsed_args.shared:
kwargs['visibility'] = 'shared'
# Handle deprecated --owner option
project_arg = parsed_args.project
if parsed_args.owner:
project_arg = parsed_args.owner
LOG.warning(_('The --owner option is deprecated, '
'please use --project instead.'))
project_id = None
if project_arg:
if parsed_args.project:
project_id = common.find_project(
identity_client,
project_arg,
parsed_args.project,
parsed_args.project_domain,
).id
kwargs['owner'] = project_id

View File

@ -188,40 +188,6 @@ class TestImageCreate(TestImage):
image_fakes.FakeImage.get_image_data(self.new_image),
data)
def test_image_create_with_unexist_owner(self):
self.project_mock.get.side_effect = exceptions.NotFound(None)
self.project_mock.find.side_effect = exceptions.NotFound(None)
arglist = [
'--container-format', 'ovf',
'--disk-format', 'ami',
'--min-disk', '10',
'--min-ram', '4',
'--owner', 'unexist_owner',
'--protected',
'--private',
image_fakes.image_name,
]
verifylist = [
('container_format', 'ovf'),
('disk_format', 'ami'),
('min_disk', 10),
('min_ram', 4),
('owner', 'unexist_owner'),
('protected', True),
('unprotected', False),
('public', False),
('private', True),
('name', image_fakes.image_name),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.assertRaises(
exceptions.CommandError,
self.cmd.take_action,
parsed_args,
)
def test_image_create_with_unexist_project(self):
self.project_mock.get.side_effect = exceptions.NotFound(None)
self.project_mock.find.side_effect = exceptions.NotFound(None)
@ -1146,24 +1112,6 @@ class TestImageSet(TestImage):
image_fakes.image_id, **kwargs)
self.assertIsNone(result)
def test_image_set_with_unexist_owner(self):
self.project_mock.get.side_effect = exceptions.NotFound(None)
self.project_mock.find.side_effect = exceptions.NotFound(None)
arglist = [
'--owner', 'unexist_owner',
image_fakes.image_id,
]
verifylist = [
('owner', 'unexist_owner'),
('image', image_fakes.image_id),
]
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
self.assertRaises(
exceptions.CommandError,
self.cmd.take_action, parsed_args)
def test_image_set_with_unexist_project(self):
self.project_mock.get.side_effect = exceptions.NotFound(None)
self.project_mock.find.side_effect = exceptions.NotFound(None)

View File

@ -0,0 +1,5 @@
---
upgrade:
- |
Remove ``image create|set`` option ``--owner``.
Use ``--project`` option instead.