stage/error: new simple stage always erroring out
A simple stage like 'noop' that will return with `returncode` or 255 if nothing is specified. Like 'noop' it might be useful for testing, debugging, and wasting time.
This commit is contained in:
parent
ede3f6baeb
commit
6333d1c3bd
1 changed files with 31 additions and 0 deletions
31
stages/org.osbuild.error
Executable file
31
stages/org.osbuild.error
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import json
|
||||
import sys
|
||||
|
||||
STAGE_DESC = "Return an error"
|
||||
STAGE_INFO = """
|
||||
Error stage. Return the given error. Useful for testing, debugging, and
|
||||
wasting time.
|
||||
"""
|
||||
STAGE_OPTS = """
|
||||
"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 = json.load(sys.stdin)
|
||||
r = main(args["tree"], args.get("options", {}))
|
||||
sys.exit(r)
|
||||
Loading…
Add table
Add a link
Reference in a new issue