assemblers: add org.osbuild.error
This is, like the stage with the same name, an assembler that will exit with an error code (default 255, but can be specified via the assembler options). It is mostly useful for testing.
This commit is contained in:
parent
d98f460841
commit
72ffa50c45
1 changed files with 36 additions and 0 deletions
36
assemblers/org.osbuild.error
Executable file
36
assemblers/org.osbuild.error
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/python3
|
||||
"""
|
||||
Return an error
|
||||
|
||||
Error assembler. Return the given error. Very much like the error stage this
|
||||
is useful for testing, debugging, and wasting time.
|
||||
"""
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
import osbuild.api
|
||||
|
||||
|
||||
SCHEMA = """
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"returncode": {
|
||||
"description": "What to return code to use",
|
||||
"type": "number",
|
||||
"default": 255
|
||||
}
|
||||
}
|
||||
"""
|
||||
|
||||
|
||||
def main(options):
|
||||
errno = options.get("returncode", 255)
|
||||
print(f"Error assembler will now return error: {errno}")
|
||||
return errno
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
args = osbuild.api.arguments()
|
||||
r = main(args.get("options", {}))
|
||||
sys.exit(r)
|
||||
Loading…
Add table
Add a link
Reference in a new issue