debian-forge/inputs/org.osbuild.noop
Christian Kellner 1ed85dc790 inputs: convert to host service
Create a `InputService` class with an abstract method called `map`,
meant to be implemented by all inputs. An `unmap` method may be
optionally overridden by inputs to cleanup resources.
Instantiate a `host.ServiceManager` in the `Stage.run` section and
pass the to the host side input code so it can be used to spawn the
input services.
Convert all existing inputs to the new service framework.
2021-06-09 18:37:47 +01:00

44 lines
687 B
Python
Executable file

#!/usr/bin/python3
"""
No-op inputs
Does nothing with the supplied data but just forwards
it to the stage.
"""
import os
import sys
import uuid
from osbuild import inputs
SCHEMA = """
"additionalProperties": true
"""
class NoopInput(inputs.InputService):
def map(self, _store, _origin, refs, target, _options):
uid = str(uuid.uuid4())
path = os.path.join(target, uid)
os.makedirs(path)
reply = {
"path": target,
"data": {
"refs": refs
}
}
return reply
def main():
service = NoopInput.from_args(sys.argv[1:])
service.main()
if __name__ == '__main__':
main()