From 2bf123f315ecba055b6ce7909c7547da02768281 Mon Sep 17 00:00:00 2001 From: Mohammed Al-Dokimi Date: Mon, 2 Sep 2024 16:55:48 +0200 Subject: [PATCH] Removed the emit_duplicated_warning() funtion. Since this function is called once, I moved its implementaion to where its called. Story: 2010344 Change-Id: Iaf06def1a06ffbb605ee42569e6f87b409a72772 --- openstackclient/compute/v2/server.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/openstackclient/compute/v2/server.py b/openstackclient/compute/v2/server.py index 661453b65a..82f5fa376b 100644 --- a/openstackclient/compute/v2/server.py +++ b/openstackclient/compute/v2/server.py @@ -1520,17 +1520,6 @@ class CreateServer(command.ShowOne): if not image and parsed_args.image_properties: - def emit_duplicated_warning(img): - img_uuid_list = [str(image.id) for image in img] - LOG.warning( - 'Multiple matching images: %(img_uuid_list)s\n' - 'Using image: %(chosen_one)s', - { - 'img_uuid_list': img_uuid_list, - 'chosen_one': img_uuid_list[0], - }, - ) - def _match_image(image_api, wanted_properties): image_list = image_api.images() images_matched = [] @@ -1568,7 +1557,15 @@ class CreateServer(command.ShowOne): images = _match_image(image_client, parsed_args.image_properties) if len(images) > 1: - emit_duplicated_warning(images, parsed_args.image_properties) + img_uuid_list = [str(image.id) for image in images] + LOG.warning( + 'Multiple matching images: %(img_uuid_list)s\n' + 'Using image: %(chosen_one)s', + { + 'img_uuid_list': img_uuid_list, + 'chosen_one': img_uuid_list[0], + }, + ) if images: image = images[0] else: