From af1034548342672b1b02ead510c8bd5f5abf0da8 Mon Sep 17 00:00:00 2001 From: Muayyad alsadi Date: Mon, 28 Feb 2022 01:19:07 +0300 Subject: [PATCH] FIXES #440: absolute secret --- podman_compose.py | 6 +++++- tests/secrets/docker-compose.yaml | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/podman_compose.py b/podman_compose.py index ca3df24..677e9b3 100755 --- a/podman_compose.py +++ b/podman_compose.py @@ -445,9 +445,11 @@ def get_secret_args(compose, cnt, secret): dest_file = f'/run/secrets/{secret_name}' elif not target.startswith("/"): sec = target if target else secret_name - dest_file = f's/run/secrets/{sec}' + dest_file = f'/run/secrets/{sec}' else: dest_file = target + basedir = compose.dirname + source_file = os.path.realpath(os.path.join(basedir, os.path.expanduser(source_file))) volume_ref = [ '--volume', f'{source_file}:{dest_file}:ro,rprivate,rbind' ] @@ -921,6 +923,8 @@ class Podman: return volumes def normalize_service(service, sub_dir=''): + # make `build.context` relative to sub_dir + # TODO: should we make volume and secret relative too? if sub_dir and 'build' in service: build = service['build'] context = build if is_str(build) else build.get('context', None) diff --git a/tests/secrets/docker-compose.yaml b/tests/secrets/docker-compose.yaml index e2b26a4..735746a 100644 --- a/tests/secrets/docker-compose.yaml +++ b/tests/secrets/docker-compose.yaml @@ -1,3 +1,7 @@ +--- +# echo "sec" | podman secret create my_secret - +# echo "sec2" | podman secret create my_secret_2 - +# echo "sec3" | podman secret create my_secret_3 - version: "3.8" services: test: