diff --git a/osbuild/sources.py b/osbuild/sources.py index 74fc4e6e..7c572a6b 100644 --- a/osbuild/sources.py +++ b/osbuild/sources.py @@ -55,6 +55,7 @@ class SourceService(host.Service): super().__init__(*args, **kwargs) self.cache = None self.options = None + self.tmpdir = None @abc.abstractmethod def download(self, items): @@ -80,6 +81,7 @@ class SourceService(host.Service): def dispatch(self, method: str, args, fds): if method == "download": self.setup(args) - return self.download(SourceService.load_items(fds)), None + with tempfile.TemporaryDirectory(prefix=".unverified-", dir=self.cache) as self.tmpdir: + return self.download(SourceService.load_items(fds)), None raise host.ProtocolError("Unknown method") diff --git a/sources/org.osbuild.inline b/sources/org.osbuild.inline index 53098d18..e13116f0 100755 --- a/sources/org.osbuild.inline +++ b/sources/org.osbuild.inline @@ -84,8 +84,7 @@ class InlineSource(sources.SourceService): content_type = "org.osbuild.files" def download(self, items): - with tempfile.TemporaryDirectory(prefix=".unverified-", dir=self.cache) as tmpdir: - process(items, self.cache, tmpdir) + process(items, self.cache, self.tmpdir) def main():