Skip to content

Commit 67dadda

Browse files
author
Dean Troyer
committed
Remove deprecated image commands
* Remove ``image create|set`` option ``--owner`` Change-Id: I1fabab98c8660eba6d0dd75e74544c6c9d432b9e Signed-off-by: Dean Troyer <dtroyer@gmail.com>
1 parent f9fdc29 commit 67dadda

6 files changed

Lines changed: 43 additions & 147 deletions

File tree

doc/source/cli/backwards-incompatible.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ Release 4.0
4949
* Removed in: 4.0
5050
* Commit: https://review.opendev.org/612798
5151

52+
6. Remove ``image create|set`` option ``--owner``.
53+
Use ``--project`` option instead.
54+
55+
* Removed in: 4.0
56+
* Commit: https://review.opendev.org/659431
57+
5258
.. 1. Change ``volume transfer request accept`` to use new option ``--auth-key``
5359
.. rather than a second positional argument.
5460

doc/source/cli/data/glance.csv

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
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>,Delete the tag associated with the given image.
10-
image-tag-update,image unset --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.
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 unset --tag <tag>,Delete the tag associated with the given image.
10+
image-tag-update,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.

openstackclient/image/v1/image.py

Lines changed: 2 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -182,29 +182,16 @@ def get_parser(self, prog_name):
182182
help=_("Set a property on this image "
183183
"(repeat option to set multiple properties)"),
184184
)
185-
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
186-
# 2.x release. Do not remove before Jan 2017
187-
# and a 3.x release.
188-
project_group = parser.add_mutually_exclusive_group()
189-
project_group.add_argument(
185+
parser.add_argument(
190186
"--project",
191187
metavar="<project>",
192188
help=_("Set an alternate project on this image (name or ID)"),
193189
)
194-
project_group.add_argument(
195-
"--owner",
196-
metavar="<project>",
197-
help=argparse.SUPPRESS,
198-
)
199190
return parser
200191

201192
def take_action(self, parsed_args):
202193
image_client = self.app.client_manager.image
203194

204-
if getattr(parsed_args, 'owner', None) is not None:
205-
LOG.warning(_('The --owner option is deprecated, '
206-
'please use --project instead.'))
207-
208195
# Build an attribute dict from the parsed args, only include
209196
# attributes that were actually set on the command line
210197
kwargs = {}
@@ -599,29 +586,16 @@ def get_parser(self, prog_name):
599586
metavar="<checksum>",
600587
help=_("Image hash used for verification"),
601588
)
602-
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
603-
# 2.x release. Do not remove before Jan 2017
604-
# and a 3.x release.
605-
project_group = parser.add_mutually_exclusive_group()
606-
project_group.add_argument(
589+
parser.add_argument(
607590
"--project",
608591
metavar="<project>",
609592
help=_("Set an alternate project on this image (name or ID)"),
610593
)
611-
project_group.add_argument(
612-
"--owner",
613-
metavar="<project>",
614-
help=argparse.SUPPRESS,
615-
)
616594
return parser
617595

618596
def take_action(self, parsed_args):
619597
image_client = self.app.client_manager.image
620598

621-
if getattr(parsed_args, 'owner', None) is not None:
622-
LOG.warning(_('The --owner option is deprecated, '
623-
'please use --project instead.'))
624-
625599
kwargs = {}
626600
copy_attrs = ('name', 'owner', 'min_disk', 'min_ram', 'properties',
627601
'container_format', 'disk_format', 'size', 'store',

openstackclient/image/v2/image.py

Lines changed: 6 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -250,20 +250,11 @@ def get_parser(self, prog_name):
250250
help=_("Set a tag on this image "
251251
"(repeat option to set multiple tags)"),
252252
)
253-
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
254-
# 2.x release. Do not remove before Jan 2017
255-
# and a 3.x release.
256-
project_group = parser.add_mutually_exclusive_group()
257-
project_group.add_argument(
253+
parser.add_argument(
258254
"--project",
259255
metavar="<project>",
260256
help=_("Set an alternate project on this image (name or ID)"),
261257
)
262-
project_group.add_argument(
263-
"--owner",
264-
metavar="<project>",
265-
help=argparse.SUPPRESS,
266-
)
267258
common.add_project_domain_option_to_parser(parser)
268259
for deadopt in self.deadopts:
269260
parser.add_argument(
@@ -321,16 +312,10 @@ def take_action(self, parsed_args):
321312
kwargs['visibility'] = 'community'
322313
if parsed_args.shared:
323314
kwargs['visibility'] = 'shared'
324-
# Handle deprecated --owner option
325-
project_arg = parsed_args.project
326-
if parsed_args.owner:
327-
project_arg = parsed_args.owner
328-
LOG.warning(_('The --owner option is deprecated, '
329-
'please use --project instead.'))
330-
if project_arg:
315+
if parsed_args.project:
331316
kwargs['owner'] = common.find_project(
332317
identity_client,
333-
project_arg,
318+
parsed_args.project,
334319
parsed_args.project_domain,
335320
).id
336321

@@ -347,13 +332,6 @@ def take_action(self, parsed_args):
347332
LOG.warning(_("Failed to get an image file."))
348333
return {}, {}
349334

350-
if parsed_args.owner:
351-
kwargs['owner'] = common.find_project(
352-
identity_client,
353-
parsed_args.owner,
354-
parsed_args.project_domain,
355-
).id
356-
357335
# sign an image using a given local private key file
358336
if parsed_args.sign_key_path or parsed_args.sign_cert_id:
359337
if not parsed_args.file:
@@ -933,20 +911,11 @@ def get_parser(self, prog_name):
933911
action="store_true",
934912
help=_("Activate the image"),
935913
)
936-
# NOTE(dtroyer): --owner is deprecated in Jan 2016 in an early
937-
# 2.x release. Do not remove before Jan 2017
938-
# and a 3.x release.
939-
project_group = parser.add_mutually_exclusive_group()
940-
project_group.add_argument(
914+
parser.add_argument(
941915
"--project",
942916
metavar="<project>",
943917
help=_("Set an alternate project on this image (name or ID)"),
944918
)
945-
project_group.add_argument(
946-
"--owner",
947-
metavar="<project>",
948-
help=argparse.SUPPRESS,
949-
)
950919
common.add_project_domain_option_to_parser(parser)
951920
for deadopt in self.deadopts:
952921
parser.add_argument(
@@ -1020,17 +989,11 @@ def take_action(self, parsed_args):
1020989
kwargs['visibility'] = 'community'
1021990
if parsed_args.shared:
1022991
kwargs['visibility'] = 'shared'
1023-
# Handle deprecated --owner option
1024-
project_arg = parsed_args.project
1025-
if parsed_args.owner:
1026-
project_arg = parsed_args.owner
1027-
LOG.warning(_('The --owner option is deprecated, '
1028-
'please use --project instead.'))
1029992
project_id = None
1030-
if project_arg:
993+
if parsed_args.project:
1031994
project_id = common.find_project(
1032995
identity_client,
1033-
project_arg,
996+
parsed_args.project,
1034997
parsed_args.project_domain,
1035998
).id
1036999
kwargs['owner'] = project_id

openstackclient/tests/unit/image/v2/test_image.py

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -188,40 +188,6 @@ def test_image_reserve_options(self, mock_open):
188188
image_fakes.FakeImage.get_image_data(self.new_image),
189189
data)
190190

191-
def test_image_create_with_unexist_owner(self):
192-
self.project_mock.get.side_effect = exceptions.NotFound(None)
193-
self.project_mock.find.side_effect = exceptions.NotFound(None)
194-
195-
arglist = [
196-
'--container-format', 'ovf',
197-
'--disk-format', 'ami',
198-
'--min-disk', '10',
199-
'--min-ram', '4',
200-
'--owner', 'unexist_owner',
201-
'--protected',
202-
'--private',
203-
image_fakes.image_name,
204-
]
205-
verifylist = [
206-
('container_format', 'ovf'),
207-
('disk_format', 'ami'),
208-
('min_disk', 10),
209-
('min_ram', 4),
210-
('owner', 'unexist_owner'),
211-
('protected', True),
212-
('unprotected', False),
213-
('public', False),
214-
('private', True),
215-
('name', image_fakes.image_name),
216-
]
217-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
218-
219-
self.assertRaises(
220-
exceptions.CommandError,
221-
self.cmd.take_action,
222-
parsed_args,
223-
)
224-
225191
def test_image_create_with_unexist_project(self):
226192
self.project_mock.get.side_effect = exceptions.NotFound(None)
227193
self.project_mock.find.side_effect = exceptions.NotFound(None)
@@ -1146,24 +1112,6 @@ def test_image_set_options(self):
11461112
image_fakes.image_id, **kwargs)
11471113
self.assertIsNone(result)
11481114

1149-
def test_image_set_with_unexist_owner(self):
1150-
self.project_mock.get.side_effect = exceptions.NotFound(None)
1151-
self.project_mock.find.side_effect = exceptions.NotFound(None)
1152-
1153-
arglist = [
1154-
'--owner', 'unexist_owner',
1155-
image_fakes.image_id,
1156-
]
1157-
verifylist = [
1158-
('owner', 'unexist_owner'),
1159-
('image', image_fakes.image_id),
1160-
]
1161-
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
1162-
1163-
self.assertRaises(
1164-
exceptions.CommandError,
1165-
self.cmd.take_action, parsed_args)
1166-
11671115
def test_image_set_with_unexist_project(self):
11681116
self.project_mock.get.side_effect = exceptions.NotFound(None)
11691117
self.project_mock.find.side_effect = exceptions.NotFound(None)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
upgrade:
3+
- |
4+
Remove ``image create|set`` option ``--owner``.
5+
Use ``--project`` option instead.

0 commit comments

Comments
 (0)