Fix server image create
The final find_resource() call errored because servers.create_image() returns an image ID rather than an Image resource. Reset expectations and arguments. Change-Id: I1b9132f66091f9df76198724156acb7a6fb2f6fe
This commit is contained in:
parent
6c5f2e39e2
commit
da5e31dbb6
@ -393,7 +393,7 @@ class CreateServerImage(show.ShowOne):
|
||||
parser = super(CreateServerImage, self).get_parser(prog_name)
|
||||
parser.add_argument(
|
||||
'server',
|
||||
metavar='<server',
|
||||
metavar='<server>',
|
||||
help='Server (name or ID)',
|
||||
)
|
||||
parser.add_argument(
|
||||
@ -421,7 +421,7 @@ class CreateServerImage(show.ShowOne):
|
||||
else:
|
||||
name = server.name
|
||||
|
||||
image = compute_client.servers.create_image(
|
||||
image_id = compute_client.servers.create_image(
|
||||
server,
|
||||
name,
|
||||
)
|
||||
@ -429,7 +429,7 @@ class CreateServerImage(show.ShowOne):
|
||||
if parsed_args.wait:
|
||||
if utils.wait_for_status(
|
||||
image_client.images.get,
|
||||
image,
|
||||
image_id,
|
||||
callback=_show_progress,
|
||||
):
|
||||
sys.stdout.write('\n')
|
||||
@ -443,7 +443,7 @@ class CreateServerImage(show.ShowOne):
|
||||
|
||||
image = utils.find_resource(
|
||||
image_client.images,
|
||||
image.id,
|
||||
image_id,
|
||||
)
|
||||
|
||||
info = {}
|
||||
|
@ -80,11 +80,7 @@ class TestServerImageCreate(TestServer):
|
||||
loaded=True,
|
||||
)
|
||||
|
||||
self.servers_mock.create_image.return_value = fakes.FakeResource(
|
||||
None,
|
||||
copy.deepcopy(image_fakes.IMAGE),
|
||||
loaded=True,
|
||||
)
|
||||
self.servers_mock.create_image.return_value = image_fakes.image_id
|
||||
|
||||
self.images_mock.get.return_value = fakes.FakeResource(
|
||||
None,
|
||||
|
Loading…
x
Reference in New Issue
Block a user