Show final image state after image create
creating the image is a 2step process, first an 'empty' image is created and then the data is uploaded. Currently the output of the 'image create' command is that 'empty' image, in `queued` status etc. A more user friendly approach would be to make a second refresh call to show the user image as it is after data was uploaded. Change-Id: I2f78b113dcc3c941f8cf8dd9b63262971a780a39
This commit is contained in:
parent
eb0dbd5c33
commit
4f95e0aa18
@ -576,6 +576,9 @@ class CreateImage(command.ShowOne):
|
||||
if parsed_args.filename:
|
||||
fp.close()
|
||||
|
||||
# NOTE(pas-ha): create_image returns the image object as it was created
|
||||
# before the data was uploaded, need a refresh to show the final state
|
||||
image = image_client.get_image(image)
|
||||
return _format_image(image)
|
||||
|
||||
def _take_action_volume(self, parsed_args):
|
||||
|
@ -55,6 +55,7 @@ class TestImageCreate(TestImage):
|
||||
self.new_image = image_fakes.create_one_image()
|
||||
self.image_client.create_image.return_value = self.new_image
|
||||
self.image_client.update_image.return_value = self.new_image
|
||||
self.image_client.get_image.return_value = self.new_image
|
||||
|
||||
self.project_mock.get.return_value = self.project
|
||||
|
||||
@ -89,6 +90,7 @@ class TestImageCreate(TestImage):
|
||||
container_format=_image.DEFAULT_CONTAINER_FORMAT,
|
||||
disk_format=_image.DEFAULT_DISK_FORMAT,
|
||||
)
|
||||
self.image_client.get_image.assert_called_once_with(self.new_image)
|
||||
|
||||
self.assertEqual(self.expected_columns, columns)
|
||||
self.assertCountEqual(self.expected_data, data)
|
||||
@ -146,6 +148,7 @@ class TestImageCreate(TestImage):
|
||||
is_protected=self.new_image.is_protected,
|
||||
visibility=self.new_image.visibility,
|
||||
)
|
||||
self.image_client.get_image.assert_called_once_with(self.new_image)
|
||||
|
||||
self.assertEqual(self.expected_columns, columns)
|
||||
self.assertCountEqual(self.expected_data, data)
|
||||
@ -243,6 +246,7 @@ class TestImageCreate(TestImage):
|
||||
tags=self.new_image.tags,
|
||||
filename=imagefile.name,
|
||||
)
|
||||
self.image_client.get_image.assert_called_once_with(self.new_image)
|
||||
|
||||
self.assertEqual(self.expected_columns, columns)
|
||||
self.assertCountEqual(self.expected_data, data)
|
||||
@ -275,6 +279,7 @@ class TestImageCreate(TestImage):
|
||||
data=fake_stdin,
|
||||
validate_checksum=False,
|
||||
)
|
||||
self.image_client.get_image.assert_called_once_with(self.new_image)
|
||||
|
||||
self.assertEqual(self.expected_columns, columns)
|
||||
self.assertCountEqual(self.expected_data, data)
|
||||
@ -315,6 +320,7 @@ class TestImageCreate(TestImage):
|
||||
disk_format=_image.DEFAULT_DISK_FORMAT,
|
||||
use_import=True,
|
||||
)
|
||||
self.image_client.get_image.assert_called_once_with(self.new_image)
|
||||
|
||||
@mock.patch('osc_lib.utils.find_resource')
|
||||
@mock.patch('openstackclient.image.v2.image.get_data_from_stdin')
|
||||
|
Loading…
x
Reference in New Issue
Block a user