Previously, we would make the improper assumption in the get_input_string function within catalog_impl.py that the split() function on the image_key's tag field would always return two items: the registry and image name and then the tag for the image. However when a port number was explicitly used in the registry, this caused the
split() function to return three things: the registry name, port number and image name, and then the image tag.
This fix changes the split() function to rsplit() and will only split the string once, ensuring that the first item is always the registry (with port if specified) and image name, and the second is the tag for the image.
New unit test parameters were added to test_get_input_string to ensure that the updated function still works as intended and that the observed bad behavior has been fixed.
Previously, we would make the improper assumption in the
get_input_string
function withincatalog_impl.py
that thesplit()
function on the image_key's tag field would always return two items: the registry and image name and then the tag for the image. However when a port number was explicitly used in the registry, this caused thesplit()
function to return three things: the registry name, port number and image name, and then the image tag.This fix changes the
split()
function torsplit()
and will only split the string once, ensuring that the first item is always the registry (with port if specified) and image name, and the second is the tag for the image.New unit test parameters were added to
test_get_input_string
to ensure that the updated function still works as intended and that the observed bad behavior has been fixed.Signed-off-by: Dustin Schoenbrun dustin.schoenbrun@anchore.com