aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>2023-04-08 10:25:44 +0100
committerAbdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>2023-05-03 15:09:02 +0100
commitb8a809bf6ca5334b337ce599014043d69a734109 (patch)
tree9cb878bce5acddcdda3bab6ea0f65909fd61ec7b
parentbe011898d1944d2ddac75f429255e0c358a8a83b (diff)
downloadlibvirt-ci-b8a809bf6ca5334b337ce599014043d69a734109.zip
libvirt-ci-b8a809bf6ca5334b337ce599014043d69a734109.tar.gz
libvirt-ci-b8a809bf6ca5334b337ce599014043d69a734109.tar.bz2
lcitool: edit error message during container run (or shell) operation.
If only an "ubuntu:22.04" image is present locally, passing "ubuntu" as the image argument halts the operation giving no indication that the error is caused because "ubuntu" equates to "ubuntu:latest". Adding this information helps give more context to the error message. From: ... Image 'ubuntu' not found in local cache. Build it or pull from registry first. ... To: ... Image 'ubuntu:latest' not found in local cache. Build it or pull from registry first. ... Signed-off-by: Abdulwasiu Apalowo <abdulwasiuapalowo@gmail.com>
-rw-r--r--lcitool/application.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lcitool/application.py b/lcitool/application.py
index f2808af..0d3a8dd 100644
--- a/lcitool/application.py
+++ b/lcitool/application.py
@@ -350,8 +350,13 @@ class Application:
dir=util.get_temp_dir())
params["tempdir"] = container_tempdir.name
- if not client.image_exists(args.image):
- print(f"Image '{args.image}' not found in local cache. Build it or pull from registry first.")
+ image = args.image
+ tag = "latest"
+ if ":" in image:
+ image, tag = args.image.split(":")
+
+ if not client.image_exists(image, tag):
+ print(f"Image '{image}:{tag}' not found in local cache. Build it or pull from registry first.")
return
params["image"] = args.image