scripts/send-error-report: Set exit code if error occurs

If an error occurs, set an error exit code so the world knows about it. This fixes
issues where the autobuilder doesn't notice these failures.

[YOCTO #7265]

(From OE-Core rev: b219377defc9517af360986352bd7da1a7906f10)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2015-01-29 14:32:15 +00:00
parent 3f15d8a807
commit e2cffc00e1
1 changed files with 5 additions and 1 deletions

View File

@ -62,6 +62,7 @@ def sendData(json_file, server):
g.write(email + "\n") g.write(email + "\n")
else: else:
print("Invalid inputs, try again.") print("Invalid inputs, try again.")
sys.exit(1)
return return
with open(json_file) as f: with open(json_file) as f:
@ -74,6 +75,7 @@ def sendData(json_file, server):
data = json.dumps(jsondata, indent=4, sort_keys=True) data = json.dumps(jsondata, indent=4, sort_keys=True)
except: except:
print("Invalid json data") print("Invalid json data")
sys.exit(1)
return return
try: try:
@ -87,12 +89,14 @@ def sendData(json_file, server):
print("There was a problem submiting your data, response written in %s.response.html" % json_file) print("There was a problem submiting your data, response written in %s.response.html" % json_file)
with open("%s.response.html" % json_file, "w") as f: with open("%s.response.html" % json_file, "w") as f:
f.write(res) f.write(res)
sys.exit(1)
conn.close() conn.close()
except Exception as e: except Exception as e:
print("Server connection failed: %s" % e) print("Server connection failed: %s" % e)
sys.exit(1)
else: else:
print("No data file found.") print("No data file found.")
sys.exit(1)
if __name__ == '__main__': if __name__ == '__main__':