| print >> sys.stderr, "syntax: run_tosca.py <port> <username> <password> <fn>" |
| xos_auth=(username, password) |
| url = "http://%s:%d/api/utility/tosca/run/" % (hostname, port) |
| recipe = open(tosca_fn).read() |
| r = requests.post(url, data={"recipe": recipe}, auth=xos_auth) |
| if (r.status_code != 200): |
| print >> sys.stderr, "ERR: recieved status %d" % r.status_code |
| print >> sys.stderr, r.json()["error_text"] |
| traceback.print_exc("error while printing the error!") |
| print "\n".join(result["log_msgs"])+"\n" |
| if __name__ == "__main__": |