debian-forge/mounts/org.osbuild.noop
David Rheinsberg 4b09088661 test/isort: apply diff to full tree
Apply the isort modifications to the entire source tree, not just the
selected python files of test-src.

Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
2022-09-23 12:08:10 +02:00

62 lines
1.1 KiB
Python
Executable file

#!/usr/bin/python3
"""
No-op mount service
Does not mount anything, but only creates an empty directory.
Useful for testing.
"""
import os
import sys
from typing import Dict
from osbuild import mounts
SCHEMA_2 = """
"additionalProperties": false,
"required": ["name", "type", "source", "target"],
"properties": {
"name": { "type": "string" },
"type": { "type": "string" },
"source": {
"type": "string"
},
"target": {
"type": "string"
},
"options": {
"type": "object",
"additionalProperties": true
}
}
"""
class NoOpMount(mounts.MountService):
mountpoint = None
def mount(self, args: Dict):
root = args["root"]
target = args["target"]
mountpoint = os.path.join(root, target.lstrip("/"))
os.makedirs(mountpoint, exist_ok=True)
self.mountpoint = mountpoint
return mountpoint
def umount(self):
self.mountpoint = None
def sync(self):
pass
def main():
service = NoOpMount.from_args(sys.argv[1:])
service.main()
if __name__ == '__main__':
main()