debian-forge/assemblers/org.osbuild.error
Christian Kellner 72ffa50c45 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.
2021-03-09 21:40:47 +00:00

36 lines
646 B
Python
Executable file

#!/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)