summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2025-07-31 20:26:11 +0200
committerChristian Breunig <christian@breunig.cc>2025-07-31 20:26:11 +0200
commit318eaf2bfdb81d7cf2e31fe9c7b6e215e3522e77 (patch)
tree5440c2a34b1b0f8b92b8399fe2764719a56380b0
parent8c34aa09954f4b266478d48d8a0256e695f4e666 (diff)
downloadvyos-1x-318eaf2bfdb81d7cf2e31fe9c7b6e215e3522e77.tar.gz
vyos-1x-318eaf2bfdb81d7cf2e31fe9c7b6e215e3522e77.zip
op-mode: T7403: fix image deletion when a single image ID is provided
Commit a99ca6d11 ("op-mode: T7403: add option for forcefully removing a container image") did not account for the case where a single image ID is passed as a string. This led to incorrect behavior during iteration. Without converting the string to a list, the code iterates over individual characters of the image ID rather than treating it as a single item. As a result, the system attempts to delete non-existent container images based on these characters.
-rwxr-xr-xsrc/op_mode/container.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/op_mode/container.py b/src/op_mode/container.py
index feb9f41cc..2dc7ce4ec 100755
--- a/src/op_mode/container.py
+++ b/src/op_mode/container.py
@@ -76,6 +76,9 @@ def delete_image(name: str, force: typing.Optional[bool] = False):
name = name.replace('\n', ' ')
# convert to list
name = name.split()
+ else:
+ # convert str -> list for further processing down the line
+ name = [name]
for image in name:
# convert the truncated image ID to a full image ID