diff --git a/tuxrun/__main__.py b/tuxrun/__main__.py index 6ce970e..b71a0c2 100644 --- a/tuxrun/__main__.py +++ b/tuxrun/__main__.py @@ -355,10 +355,12 @@ def handler(*_): if job.device.flag_use_pre_run_cmd or job.qemu_image or options.device_dict: LOG.debug("Pre run command") if options.device_dict: + options.dispatcher_download_dir.mkdir(parents=True, exist_ok=True) runtime.bind(options.dispatcher_download_dir, Path("/srv/tftp")) runtime.bind( options.dispatcher_download_dir, options.dispatcher_download_dir ) + runtime._device_dict_volume = str(options.dispatcher_download_dir) else: runtime.bind(tmpdir / "dispatcher" / "tmp", options.dispatcher_download_dir) (tmpdir / "dispatcher" / "tmp").mkdir() diff --git a/tuxrun/runtimes.py b/tuxrun/runtimes.py index e52418d..2321a82 100644 --- a/tuxrun/runtimes.py +++ b/tuxrun/runtimes.py @@ -174,13 +174,15 @@ class DockerRuntime(ContainerRuntime): prefix = ["docker", "run", "--rm", "--hostname", "tuxrun"] def pre_run(self, tmpdir): - # Render and bind the docker wrapper + volume = getattr(self, "_device_dict_volume", None) or str( + tmpdir / "dispatcher" / "tmp" + ) wrap = ( wrappers() .get_template("docker.jinja2") .render( runtime="docker", - volume=str(tmpdir / "dispatcher" / "tmp"), + volume=volume, dispatcher_download_dir=self.dispatcher_download_dir, ) )