image set should not show the resource
the rest of OSC set commands do not show the resource after it has been updated. unless the update fails then we report back a failure, otherwise the user should assume everything went fine. Change-Id: I2bd4188450c3853b4a1bc25f80fc9450cda32bdd
This commit is contained in:
parent
1afb574533
commit
2bd82ab892
@ -90,6 +90,18 @@ List of Backwards Incompatible Changes
|
|||||||
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1453229
|
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1453229
|
||||||
* Commit: https://review.openstack.org/#/c/181514/
|
* Commit: https://review.openstack.org/#/c/181514/
|
||||||
|
|
||||||
|
7. `image set` commands will no longer return the modified resource
|
||||||
|
|
||||||
|
Previously, modifying an image would result in the new image being displayed
|
||||||
|
to the user. To keep things consistent with other `set` commands, we will
|
||||||
|
no longer be showing the modified resource.
|
||||||
|
|
||||||
|
* In favor of: Use `set` then `show`
|
||||||
|
* As of: NA
|
||||||
|
* Removed in: NA
|
||||||
|
* Bug: NA
|
||||||
|
* Commit: NA
|
||||||
|
|
||||||
For Developers
|
For Developers
|
||||||
==============
|
==============
|
||||||
|
|
||||||
|
@ -35,10 +35,9 @@ class ImageTests(test.TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
# Rename test
|
# Rename test
|
||||||
opts = cls.get_show_opts(cls.FIELDS)
|
raw_output = cls.openstack('image set --name ' + cls.OTHER_NAME + ' '
|
||||||
raw_output = cls.openstack(
|
+ cls.NAME)
|
||||||
'image set --name ' + cls.OTHER_NAME + ' ' + cls.NAME + opts)
|
cls.assertOutput('', raw_output)
|
||||||
cls.assertOutput(cls.OTHER_NAME + "\n", raw_output)
|
|
||||||
# Delete test
|
# Delete test
|
||||||
raw_output = cls.openstack('image delete ' + cls.OTHER_NAME)
|
raw_output = cls.openstack('image delete ' + cls.OTHER_NAME)
|
||||||
cls.assertOutput('', raw_output)
|
cls.assertOutput('', raw_output)
|
||||||
@ -56,13 +55,13 @@ class ImageTests(test.TestCase):
|
|||||||
def test_image_set(self):
|
def test_image_set(self):
|
||||||
opts = self.get_show_opts([
|
opts = self.get_show_opts([
|
||||||
"disk_format", "is_public", "min_disk", "min_ram", "name"])
|
"disk_format", "is_public", "min_disk", "min_ram", "name"])
|
||||||
raw_output = self.openstack('image set --min-disk 4 --min-ram 5 ' +
|
self.openstack('image set --min-disk 4 --min-ram 5 ' +
|
||||||
'--disk-format qcow2 --public ' +
|
'--disk-format qcow2 --public ' + self.NAME)
|
||||||
self.NAME + opts)
|
raw_output = self.openstack('image show ' + self.NAME + opts)
|
||||||
self.assertEqual("qcow2\nTrue\n4\n5\n" + self.NAME + '\n', raw_output)
|
self.assertEqual("qcow2\nTrue\n4\n5\n" + self.NAME + '\n', raw_output)
|
||||||
|
|
||||||
def test_image_metadata(self):
|
def test_image_metadata(self):
|
||||||
opts = self.get_show_opts(["name", "properties"])
|
opts = self.get_show_opts(["name", "properties"])
|
||||||
raw_output = self.openstack(
|
self.openstack('image set --property a=b --property c=d ' + self.NAME)
|
||||||
'image set --property a=b --property c=d ' + self.NAME + opts)
|
raw_output = self.openstack('image show ' + self.NAME + opts)
|
||||||
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
|
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)
|
||||||
|
@ -452,7 +452,7 @@ class SaveImage(command.Command):
|
|||||||
gc_utils.save_image(data, parsed_args.file)
|
gc_utils.save_image(data, parsed_args.file)
|
||||||
|
|
||||||
|
|
||||||
class SetImage(show.ShowOne):
|
class SetImage(command.Command):
|
||||||
"""Set image properties"""
|
"""Set image properties"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + ".SetImage")
|
log = logging.getLogger(__name__ + ".SetImage")
|
||||||
@ -629,7 +629,7 @@ class SetImage(show.ShowOne):
|
|||||||
volume_client.volumes,
|
volume_client.volumes,
|
||||||
parsed_args.volume,
|
parsed_args.volume,
|
||||||
)
|
)
|
||||||
response, body = volume_client.volumes.upload_to_image(
|
volume_client.volumes.upload_to_image(
|
||||||
source_volume.id,
|
source_volume.id,
|
||||||
parsed_args.force,
|
parsed_args.force,
|
||||||
parsed_args.image,
|
parsed_args.image,
|
||||||
@ -640,7 +640,6 @@ class SetImage(show.ShowOne):
|
|||||||
if parsed_args.disk_format
|
if parsed_args.disk_format
|
||||||
else image.disk_format),
|
else image.disk_format),
|
||||||
)
|
)
|
||||||
info = body['os-volume_upload_image']
|
|
||||||
elif parsed_args.file:
|
elif parsed_args.file:
|
||||||
# Send an open file handle to glanceclient so it will
|
# Send an open file handle to glanceclient so it will
|
||||||
# do a chunked transfer
|
# do a chunked transfer
|
||||||
@ -673,10 +672,7 @@ class SetImage(show.ShowOne):
|
|||||||
kwargs['data'] != sys.stdin):
|
kwargs['data'] != sys.stdin):
|
||||||
kwargs['data'].close()
|
kwargs['data'].close()
|
||||||
|
|
||||||
info = {}
|
return
|
||||||
info.update(image._info)
|
|
||||||
info['properties'] = utils.format_dict(info.get('properties', {}))
|
|
||||||
return zip(*sorted(six.iteritems(info)))
|
|
||||||
|
|
||||||
|
|
||||||
class ShowImage(show.ShowOne):
|
class ShowImage(show.ShowOne):
|
||||||
|
@ -521,7 +521,7 @@ class SaveImage(command.Command):
|
|||||||
gc_utils.save_image(data, parsed_args.file)
|
gc_utils.save_image(data, parsed_args.file)
|
||||||
|
|
||||||
|
|
||||||
class SetImage(show.ShowOne):
|
class SetImage(command.Command):
|
||||||
"""Set image properties"""
|
"""Set image properties"""
|
||||||
|
|
||||||
log = logging.getLogger(__name__ + ".SetImage")
|
log = logging.getLogger(__name__ + ".SetImage")
|
||||||
@ -717,9 +717,6 @@ class SetImage(show.ShowOne):
|
|||||||
kwargs['tags'] = list(set(image.tags).union(set(parsed_args.tags)))
|
kwargs['tags'] = list(set(image.tags).union(set(parsed_args.tags)))
|
||||||
|
|
||||||
image = image_client.images.update(image.id, **kwargs)
|
image = image_client.images.update(image.id, **kwargs)
|
||||||
info = {}
|
|
||||||
info.update(image)
|
|
||||||
return zip(*sorted(six.iteritems(info)))
|
|
||||||
|
|
||||||
|
|
||||||
class ShowImage(show.ShowOne):
|
class ShowImage(show.ShowOne):
|
||||||
|
@ -499,8 +499,7 @@ class TestImageSet(TestImage):
|
|||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
# DisplayCommandBase.take_action() returns two tuples
|
self.cmd.take_action(parsed_args)
|
||||||
columns, data = self.cmd.take_action(parsed_args)
|
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'name': 'new-name',
|
'name': 'new-name',
|
||||||
@ -517,9 +516,6 @@ class TestImageSet(TestImage):
|
|||||||
**kwargs
|
**kwargs
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(image_fakes.IMAGE_columns, columns)
|
|
||||||
self.assertEqual(image_fakes.IMAGE_data, data)
|
|
||||||
|
|
||||||
def test_image_set_bools1(self):
|
def test_image_set_bools1(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--protected',
|
'--protected',
|
||||||
@ -644,8 +640,7 @@ class TestImageSet(TestImage):
|
|||||||
]
|
]
|
||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
# DisplayCommandBase.take_action() returns two tuples
|
self.cmd.take_action(parsed_args)
|
||||||
columns, data = self.cmd.take_action(parsed_args)
|
|
||||||
|
|
||||||
# VolumeManager.upload_to_image(volume, force, image_name,
|
# VolumeManager.upload_to_image(volume, force, image_name,
|
||||||
# container_format, disk_format)
|
# container_format, disk_format)
|
||||||
@ -664,9 +659,6 @@ class TestImageSet(TestImage):
|
|||||||
volume='volly',
|
volume='volly',
|
||||||
)
|
)
|
||||||
|
|
||||||
self.assertEqual(image_fakes.IMAGE_columns, columns)
|
|
||||||
self.assertEqual(image_fakes.IMAGE_data, data)
|
|
||||||
|
|
||||||
|
|
||||||
class TestImageShow(TestImage):
|
class TestImageShow(TestImage):
|
||||||
|
|
||||||
|
@ -676,7 +676,7 @@ class TestImageSet(TestImage):
|
|||||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||||
|
|
||||||
# DisplayCommandBase.take_action() returns two tuples
|
# DisplayCommandBase.take_action() returns two tuples
|
||||||
columns, data = self.cmd.take_action(parsed_args)
|
self.cmd.take_action(parsed_args)
|
||||||
|
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'name': 'new-name',
|
'name': 'new-name',
|
||||||
@ -690,9 +690,6 @@ class TestImageSet(TestImage):
|
|||||||
self.images_mock.update.assert_called_with(
|
self.images_mock.update.assert_called_with(
|
||||||
image_fakes.image_id, **kwargs)
|
image_fakes.image_id, **kwargs)
|
||||||
|
|
||||||
self.assertEqual(image_fakes.IMAGE_columns, columns)
|
|
||||||
self.assertEqual(image_fakes.IMAGE_data, data)
|
|
||||||
|
|
||||||
def test_image_set_bools1(self):
|
def test_image_set_bools1(self):
|
||||||
arglist = [
|
arglist = [
|
||||||
'--protected',
|
'--protected',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user