assemblers: use api.arguments
Instead of reading the arguments from sys.stdin, which requires that stdin is setup properly for that in the runner, use the new api.arguments() method to directly fetch the arguments. Also fix missing newlines between imports and methods to be more PEP-8 complaint, where needed.
This commit is contained in:
parent
fc5e0070c5
commit
fc6e6285ca
5 changed files with 20 additions and 6 deletions
|
|
@ -10,13 +10,19 @@ and then exits.
|
|||
import json
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false
|
||||
"""
|
||||
|
||||
|
||||
def main(_tree, _output_dir, options):
|
||||
print("Not doing anything with these options:", json.dumps(options))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = json.load(sys.stdin)
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["tree"], args["output_dir"], args.get("options", {}))
|
||||
sys.exit(r)
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ import subprocess
|
|||
import sys
|
||||
import tempfile
|
||||
|
||||
import osbuild.api
|
||||
|
||||
|
||||
DEFAULT_PATH = "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
|
|
@ -269,6 +271,6 @@ def main(tree, output_dir, options):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = json.load(sys.stdin)
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["tree"], args["output_dir"], args["options"])
|
||||
sys.exit(r)
|
||||
|
|
|
|||
|
|
@ -184,6 +184,6 @@ def main(tree, output_dir, options, meta):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = json.load(sys.stdin)
|
||||
args = api.arguments()
|
||||
r = main(args["tree"], args["output_dir"], args["options"], args["meta"])
|
||||
sys.exit(r)
|
||||
|
|
|
|||
|
|
@ -29,8 +29,11 @@ import subprocess
|
|||
import sys
|
||||
import tempfile
|
||||
from typing import List, BinaryIO
|
||||
|
||||
import osbuild.api
|
||||
import osbuild.remoteloop as remoteloop
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false,
|
||||
"required": ["format", "filename", "ptuuid", "size"],
|
||||
|
|
@ -144,6 +147,7 @@ SCHEMA = """
|
|||
}
|
||||
"""
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def mount(source, dest):
|
||||
subprocess.run(["mount", source, dest], check=True)
|
||||
|
|
@ -697,6 +701,6 @@ def main(tree, output_dir, options, loop_client):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = json.load(sys.stdin)
|
||||
args = osbuild.api.arguments()
|
||||
ret = main(args["tree"], args["output_dir"], args["options"], remoteloop.LoopClient("/run/osbuild/api/remoteloop"))
|
||||
sys.exit(ret)
|
||||
|
|
|
|||
|
|
@ -21,12 +21,14 @@ read from `/proc/sys/kernel/random/uuid` if your kernel provides it.
|
|||
|
||||
|
||||
import contextlib
|
||||
import json
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
import osbuild.remoteloop as remoteloop
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false,
|
||||
"required": ["filename", "root_fs_uuid", "size"],
|
||||
|
|
@ -104,6 +106,6 @@ def main(tree, output_dir, options, loop_client):
|
|||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = json.load(sys.stdin)
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args["tree"], args["output_dir"], args["options"], remoteloop.LoopClient("/run/osbuild/api/remoteloop"))
|
||||
sys.exit(r)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue