Skip to content

Commit 9f23f1f

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "image set should not show the resource"
2 parents 72bf89c + 2bd82ab commit 9f23f1f

6 files changed

Lines changed: 27 additions & 34 deletions

File tree

doc/source/backwards-incompatible.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ List of Backwards Incompatible Changes
9090
* Bug: https://bugs.launchpad.net/python-openstackclient/+bug/1453229
9191
* Commit: https://review.openstack.org/#/c/181514/
9292

93+
7. `image set` commands will no longer return the modified resource
94+
95+
Previously, modifying an image would result in the new image being displayed
96+
to the user. To keep things consistent with other `set` commands, we will
97+
no longer be showing the modified resource.
98+
99+
* In favor of: Use `set` then `show`
100+
* As of: NA
101+
* Removed in: NA
102+
* Bug: NA
103+
* Commit: NA
104+
93105
For Developers
94106
==============
95107

functional/tests/image/v1/test_image.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,9 @@ def setUpClass(cls):
3535
@classmethod
3636
def tearDownClass(cls):
3737
# Rename test
38-
opts = cls.get_show_opts(cls.FIELDS)
39-
raw_output = cls.openstack(
40-
'image set --name ' + cls.OTHER_NAME + ' ' + cls.NAME + opts)
41-
cls.assertOutput(cls.OTHER_NAME + "\n", raw_output)
38+
raw_output = cls.openstack('image set --name ' + cls.OTHER_NAME + ' '
39+
+ cls.NAME)
40+
cls.assertOutput('', raw_output)
4241
# Delete test
4342
raw_output = cls.openstack('image delete ' + cls.OTHER_NAME)
4443
cls.assertOutput('', raw_output)
@@ -56,13 +55,13 @@ def test_image_show(self):
5655
def test_image_set(self):
5756
opts = self.get_show_opts([
5857
"disk_format", "is_public", "min_disk", "min_ram", "name"])
59-
raw_output = self.openstack('image set --min-disk 4 --min-ram 5 ' +
60-
'--disk-format qcow2 --public ' +
61-
self.NAME + opts)
58+
self.openstack('image set --min-disk 4 --min-ram 5 ' +
59+
'--disk-format qcow2 --public ' + self.NAME)
60+
raw_output = self.openstack('image show ' + self.NAME + opts)
6261
self.assertEqual("qcow2\nTrue\n4\n5\n" + self.NAME + '\n', raw_output)
6362

6463
def test_image_metadata(self):
6564
opts = self.get_show_opts(["name", "properties"])
66-
raw_output = self.openstack(
67-
'image set --property a=b --property c=d ' + self.NAME + opts)
65+
self.openstack('image set --property a=b --property c=d ' + self.NAME)
66+
raw_output = self.openstack('image show ' + self.NAME + opts)
6867
self.assertEqual(self.NAME + "\na='b', c='d'\n", raw_output)

openstackclient/image/v1/image.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ def take_action(self, parsed_args):
454454
gc_utils.save_image(data, parsed_args.file)
455455

456456

457-
class SetImage(show.ShowOne):
457+
class SetImage(command.Command):
458458
"""Set image properties"""
459459

460460
log = logging.getLogger(__name__ + ".SetImage")
@@ -631,7 +631,7 @@ def take_action(self, parsed_args):
631631
volume_client.volumes,
632632
parsed_args.volume,
633633
)
634-
response, body = volume_client.volumes.upload_to_image(
634+
volume_client.volumes.upload_to_image(
635635
source_volume.id,
636636
parsed_args.force,
637637
parsed_args.image,
@@ -642,7 +642,6 @@ def take_action(self, parsed_args):
642642
if parsed_args.disk_format
643643
else image.disk_format),
644644
)
645-
info = body['os-volume_upload_image']
646645
elif parsed_args.file:
647646
# Send an open file handle to glanceclient so it will
648647
# do a chunked transfer
@@ -675,10 +674,7 @@ def take_action(self, parsed_args):
675674
kwargs['data'] != sys.stdin):
676675
kwargs['data'].close()
677676

678-
info = {}
679-
info.update(image._info)
680-
info['properties'] = utils.format_dict(info.get('properties', {}))
681-
return zip(*sorted(six.iteritems(info)))
677+
return
682678

683679

684680
class ShowImage(show.ShowOne):

openstackclient/image/v2/image.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ def take_action(self, parsed_args):
521521
gc_utils.save_image(data, parsed_args.file)
522522

523523

524-
class SetImage(show.ShowOne):
524+
class SetImage(command.Command):
525525
"""Set image properties"""
526526

527527
log = logging.getLogger(__name__ + ".SetImage")
@@ -717,9 +717,6 @@ def take_action(self, parsed_args):
717717
kwargs['tags'] = list(set(image.tags).union(set(parsed_args.tags)))
718718

719719
image = image_client.images.update(image.id, **kwargs)
720-
info = {}
721-
info.update(image)
722-
return zip(*sorted(six.iteritems(info)))
723720

724721

725722
class ShowImage(show.ShowOne):

openstackclient/tests/image/v1/test_image.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -499,8 +499,7 @@ def test_image_set_options(self):
499499
]
500500
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
501501

502-
# DisplayCommandBase.take_action() returns two tuples
503-
columns, data = self.cmd.take_action(parsed_args)
502+
self.cmd.take_action(parsed_args)
504503

505504
kwargs = {
506505
'name': 'new-name',
@@ -517,9 +516,6 @@ def test_image_set_options(self):
517516
**kwargs
518517
)
519518

520-
self.assertEqual(image_fakes.IMAGE_columns, columns)
521-
self.assertEqual(image_fakes.IMAGE_data, data)
522-
523519
def test_image_set_bools1(self):
524520
arglist = [
525521
'--protected',
@@ -644,8 +640,7 @@ def test_image_update_volume(self):
644640
]
645641
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
646642

647-
# DisplayCommandBase.take_action() returns two tuples
648-
columns, data = self.cmd.take_action(parsed_args)
643+
self.cmd.take_action(parsed_args)
649644

650645
# VolumeManager.upload_to_image(volume, force, image_name,
651646
# container_format, disk_format)
@@ -664,9 +659,6 @@ def test_image_update_volume(self):
664659
volume='volly',
665660
)
666661

667-
self.assertEqual(image_fakes.IMAGE_columns, columns)
668-
self.assertEqual(image_fakes.IMAGE_data, data)
669-
670662

671663
class TestImageShow(TestImage):
672664

openstackclient/tests/image/v2/test_image.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -676,7 +676,7 @@ def test_image_set_options(self):
676676
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
677677

678678
# DisplayCommandBase.take_action() returns two tuples
679-
columns, data = self.cmd.take_action(parsed_args)
679+
self.cmd.take_action(parsed_args)
680680

681681
kwargs = {
682682
'name': 'new-name',
@@ -690,9 +690,6 @@ def test_image_set_options(self):
690690
self.images_mock.update.assert_called_with(
691691
image_fakes.image_id, **kwargs)
692692

693-
self.assertEqual(image_fakes.IMAGE_columns, columns)
694-
self.assertEqual(image_fakes.IMAGE_data, data)
695-
696693
def test_image_set_bools1(self):
697694
arglist = [
698695
'--protected',

0 commit comments

Comments
 (0)