예제 #1
0
def main():
    pipe.fix_encoding()
    if len(sys.argv) > 1:
        argparser = setup_argparser()
        args = argparser.parse_args()
    data = pipe.get_jsondata()
    jsonschema.validate(data, CONFIG_SCHEMA)
    if len(sys.argv) > 1:
        render_outputdata(data, vars(args))
    else:
        pprint.pprint(data)
        print("Everything ok, data validated successful!")
예제 #2
0
def main():
    pipe.fix_encoding()
    if len(sys.argv) > 1:
        argparser = setup_argparser()
        args = argparser.parse_args()
        data = build_inputdata(vars(args))
        jsonschema.validate(data, INPUT_SCHEMA)
        json.dump(data, sys.stdout, indent=4, sort_keys=True)
    else:
        data = pipe.get_jsondata()
        jsonschema.validate(data, INPUT_SCHEMA)
        pprint.pprint(data)
        print("Everything ok, data validated successful!")
예제 #3
0
def main():
    pipe.fix_encoding()
    if len(sys.argv) > 1:
        argparser = setup_argparser()
        args = argparser.parse_args()
    data = pipe.get_jsondata()
    jsonschema.validate(data, OUTPUT_SCHEMA)
    if len(sys.argv) > 1:
        render_outputdata(data, vars(args))
    else:
        pprint.pprint(data)
        print("Everything ok, data validated successful!")
    if not data.get("success", False):
        print("Job failed with error message: %s" %
              data.get("errorMessage", "n/a"))
        sys.exit(1)
    else:
        print("Job completed successful!")
        sys.exit(0)