Skip to content

Commit e6b976d

Browse files
lorenzobenvenutiLorenzo Benvenuti
andauthored
fix(redpanda): copy the startup script to a path that can be written … (#867)
…by the redpanda user (#841) See #841 Co-authored-by: Lorenzo Benvenuti <lbenvenu@redhat.com>
1 parent bb646e9 commit e6b976d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

modules/kafka/testcontainers/kafka/_redpanda.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import os.path
12
import tarfile
23
import time
34
from io import BytesIO
@@ -21,7 +22,7 @@ class RedpandaContainer(DockerContainer):
2122
... connection = redpanda.get_bootstrap_server()
2223
"""
2324

24-
TC_START_SCRIPT = "/tc-start.sh"
25+
TC_START_SCRIPT = "/var/lib/redpanda/tc-start.sh"
2526

2627
def __init__(
2728
self,
@@ -74,9 +75,10 @@ def start(self, timeout=10) -> "RedpandaContainer":
7475

7576
def create_file(self, content: bytes, path: str) -> None:
7677
with BytesIO() as archive, tarfile.TarFile(fileobj=archive, mode="w") as tar:
77-
tarinfo = tarfile.TarInfo(name=path)
78+
dirname, basename = os.path.split(path)
79+
tarinfo = tarfile.TarInfo(name=basename)
7880
tarinfo.size = len(content)
7981
tarinfo.mtime = time.time()
8082
tar.addfile(tarinfo, BytesIO(content))
8183
archive.seek(0)
82-
self.get_wrapped_container().put_archive("/", archive)
84+
self.get_wrapped_container().put_archive(dirname, archive)

0 commit comments

Comments
 (0)