mirror of
https://github.com/containers/podman-compose.git
synced 2025-04-25 09:59:02 +02:00
Don't resolve links to compose file
docker-compose uses the path to the compose file even if it's symlink to get the context directory. Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
This commit is contained in:
parent
dab6b1b98d
commit
f0bae1e2d9
1
newsfragments/dont-resolve-links-to-compose-file.bugfix
Normal file
1
newsfragments/dont-resolve-links-to-compose-file.bugfix
Normal file
@ -0,0 +1 @@
|
|||||||
|
Fix compatibility with docker-compose in how symlinks to docker-compose.yml are handled.
|
@ -1785,7 +1785,6 @@ class PodmanCompose:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
# make absolute
|
# make absolute
|
||||||
relative_files = files
|
relative_files = files
|
||||||
files = list(map(os.path.realpath, files))
|
|
||||||
filename = files[0]
|
filename = files[0]
|
||||||
project_name = args.project_name
|
project_name = args.project_name
|
||||||
# no_ansi = args.no_ansi
|
# no_ansi = args.no_ansi
|
||||||
|
1
tests/integration/filesystem/compose_symlink/docker-compose.yml
Symbolic link
1
tests/integration/filesystem/compose_symlink/docker-compose.yml
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../compose_symlink_dest/docker-compose.yml
|
1
tests/integration/filesystem/compose_symlink/file
Normal file
1
tests/integration/filesystem/compose_symlink/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
data_compose_symlink
|
@ -0,0 +1,7 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
container1:
|
||||||
|
image: nopush/podman-compose-test
|
||||||
|
command: ["/bin/busybox", "cat", "/file"]
|
||||||
|
volumes:
|
||||||
|
- "./file:/file"
|
1
tests/integration/filesystem/compose_symlink_dest/file
Normal file
1
tests/integration/filesystem/compose_symlink_dest/file
Normal file
@ -0,0 +1 @@
|
|||||||
|
data_compose_symlink_dest
|
47
tests/integration/filesystem/test_filesystem.py
Normal file
47
tests/integration/filesystem/test_filesystem.py
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
|
|
||||||
|
import os
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from tests.integration.test_podman_compose import podman_compose_path
|
||||||
|
from tests.integration.test_podman_compose import test_path
|
||||||
|
from tests.integration.test_utils import RunSubprocessMixin
|
||||||
|
|
||||||
|
|
||||||
|
class TestFilesystem(unittest.TestCase, RunSubprocessMixin):
|
||||||
|
def test_compose_symlink(self):
|
||||||
|
"""The context of podman-compose.yml should come from the same directory as the file even
|
||||||
|
if it is a symlink
|
||||||
|
"""
|
||||||
|
|
||||||
|
compose_path = os.path.join(test_path(), "filesystem/compose_symlink/docker-compose.yml")
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.run_subprocess_assert_returncode([
|
||||||
|
podman_compose_path(),
|
||||||
|
"-f",
|
||||||
|
compose_path,
|
||||||
|
"up",
|
||||||
|
"-d",
|
||||||
|
"container1",
|
||||||
|
])
|
||||||
|
|
||||||
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
|
podman_compose_path(),
|
||||||
|
"-f",
|
||||||
|
compose_path,
|
||||||
|
"logs",
|
||||||
|
"container1",
|
||||||
|
])
|
||||||
|
|
||||||
|
# BUG: figure out why cat is called twice
|
||||||
|
self.assertEqual(out, b'data_compose_symlink\ndata_compose_symlink\n')
|
||||||
|
|
||||||
|
finally:
|
||||||
|
out, _ = self.run_subprocess_assert_returncode([
|
||||||
|
podman_compose_path(),
|
||||||
|
"-f",
|
||||||
|
compose_path,
|
||||||
|
"down",
|
||||||
|
])
|
Loading…
Reference in New Issue
Block a user