1
0
Fork 0
mirror of https://github.com/containers/ansible-podman-collections.git synced 2026-02-04 07:11:49 +00:00

Fix issue with pushing podman image to repo name and org

If destination doesn't have image, but only repo name and org,
complete with image name and tag.

Signed-off-by: Sagi Shnaidman <sshnaidm@redhat.com>
This commit is contained in:
Sagi Shnaidman 2024-06-02 20:57:13 +03:00
parent abb667546c
commit 185a0b6dca
2 changed files with 49 additions and 0 deletions

View file

@ -797,6 +797,9 @@ class PodmanImageManager(object):
dest_string = dest_format_string.format(transport=transport, name=self.name, dest=dest)
else:
dest_string = dest
# In case of dest as a repository with org name only, append image name to it
if ":" not in dest and "@" not in dest and len(dest.rstrip("/").split("/")) == 2:
dest_string = dest.rstrip("/") + "/" + self.image_name
if "/" not in dest_string and "@" not in dest_string and "docker-daemon" not in dest_string:
self.module.fail_json(msg="Destination must be a full URL or path to a directory.")

View file

@ -99,6 +99,52 @@
- "'authentication required' in img_result4.stderr"
- "'push testimage2:testtag quay.io/testing/testimage' in img_result4.actions"
- containers.podman.podman_image:
name: testimage2
tag: testtag
pull: false
push: true
push_args:
dest: quay.io/testing
ignore_errors: true
register: img_result4a
- name: Check outputs
assert:
that:
- "'authentication required' in img_result4a.stderr"
- "'push testimage2:testtag quay.io/testing/testimage2:testtag' in img_result4a.actions"
- containers.podman.podman_image:
name: testimage2:testtag
pull: false
push: true
push_args:
dest: quay.io/testing/
ignore_errors: true
register: img_result4b
- name: Check outputs
assert:
that:
- "'authentication required' in img_result4b.stderr"
- "'push testimage2:testtag quay.io/testing/testimage2:testtag' in img_result4b.actions"
- containers.podman.podman_image:
name: testimage2
pull: false
push: true
push_args:
dest: quay.io/testing/
ignore_errors: true
register: img_result4c
- name: Check outputs
assert:
that:
- "'authentication required' in img_result4c.stderr"
- "'push testimage2:latest quay.io/testing/testimage2:latest' in img_result4c.actions"
- containers.podman.podman_image:
name: testimage2
pull: false