osbuild: introduce secrets

Add a new command line option `--secrets`, which accepts a JSON file
that is structured similarly to a source file. It is should contain data
that is necessary to fetch content, but shouldn't appear in any logs.
This commit is contained in:
Lars Karlitski 2020-01-04 02:18:53 +02:00 committed by Tom Gundersen
parent 02ad4e3810
commit e123715bc6
3 changed files with 24 additions and 8 deletions

View file

@ -6,16 +6,18 @@ import threading
class SourcesServer:
def __init__(self, socket_address, sources_dir, source_options):
def __init__(self, socket_address, sources_dir, source_options, secrets=None):
self.socket_address = socket_address
self.sources_dir = sources_dir
self.source_options = source_options
self.source_options = source_options or {}
self.secrets = secrets or {}
self.event_loop = asyncio.new_event_loop()
self.thread = threading.Thread(target=self._run_event_loop)
def _run_source(self, source, checksums):
msg = {
"options": self.source_options.get(source, {}),
"secrets": self.secrets.get(source, {}),
"checksums": checksums
}