Blob Blame History Raw
#!/usr/bin/python3
"""
Return an error

Error stage. Return the given error. 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(_tree, options):
    errno = options.get("returncode", 255)
    print(f"Error stage will now return error: {errno}")
    return errno


if __name__ == '__main__':
    args = osbuild.api.arguments()
    r = main(args["tree"], args.get("options", {}))
    sys.exit(r)