sources: provide an unverified tmpdir
Some downloading program need a global unverified tmpdir to work within before storing the definitive data. Provide this in the workflow directly.
This commit is contained in:
parent
128845da3c
commit
0953cf64e0
2 changed files with 4 additions and 3 deletions
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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():
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue