summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2019-06-21 23:00:57 +0000
committerGerrit Code Review <review@openstack.org>2019-06-21 23:00:57 +0000
commit3161f87c44b200eb5fe5d540d5c75136190ac455 (patch)
tree4ac16e860db4019fd604147746f46668ba75b64b
parent377c0ce0f73a961c0d013e10d85fcbd950f3d409 (diff)
parent67dadda746759d8cf47822e6f426c473e46acc27 (diff)
downloadpython-openstackclient-3161f87c44b200eb5fe5d540d5c75136190ac455.tar.gz
Merge "Remove deprecated image commands"
-rw-r--r--doc/source/cli/backwards-incompatible.rst6
-rw-r--r--doc/source/cli/data/glance.csv48
-rw-r--r--openstackclient/image/v1/image.py30
-rw-r--r--openstackclient/image/v2/image.py49
-rw-r--r--openstackclient/tests/unit/image/v2/test_image.py52
-rw-r--r--releasenotes/notes/osc4-image-e922ee6f8e028648.yaml5
6 files changed, 43 insertions, 147 deletions
diff --git a/doc/source/cli/backwards-incompatible.rst b/doc/source/cli/backwards-incompatible.rst
index ef5468c6..2b97b59d 100644
--- a/doc/source/cli/backwards-incompatible.rst
+++ b/doc/source/cli/backwards-incompatible.rst
@@ -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.
diff --git a/doc/source/cli/data/glance.csv b/doc/source/cli/data/glance.csv
index 2985e307..994a8fda 100644
--- a/doc/source/cli/data/glance.csv
+++ b/doc/source/cli/data/glance.csv
@@ -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. \ No newline at end of file
+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.
diff --git a/openstackclient/image/v1/image.py b/openstackclient/image/v1/image.py
index 64c4049c..caf3d54f 100644
--- a/openstackclient/image/v1/image.py
+++ b/openstackclient/image/v1/image.py
@@ -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',
diff --git a/openstackclient/image/v2/image.py b/openstackclient/image/v2/image.py
index bdec99d7..97169a92 100644
--- a/openstackclient/image/v2/image.py
+++ b/openstackclient/image/v2/image.py
@@ -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
diff --git a/openstackclient/tests/unit/image/v2/test_image.py b/openstackclient/tests/unit/image/v2/test_image.py
index 4cc8f448..45b5a0a8 100644
--- a/openstackclient/tests/unit/image/v2/test_image.py
+++ b/openstackclient/tests/unit/image/v2/test_image.py
@@ -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)
diff --git a/releasenotes/notes/osc4-image-e922ee6f8e028648.yaml b/releasenotes/notes/osc4-image-e922ee6f8e028648.yaml
new file mode 100644
index 00000000..eab3f70c
--- /dev/null
+++ b/releasenotes/notes/osc4-image-e922ee6f8e028648.yaml
@@ -0,0 +1,5 @@
+---
+upgrade:
+ - |
+ Remove ``image create|set`` option ``--owner``.
+ Use ``--project`` option instead.