Write to acloud metrics when acloud operation failed.
- When user didn't provide report args, acloud still write error into
metrics.
Bug: 145963402
Test: acloud-dev create --boot-time 50
Change-Id: I4faef505b782bfbe8c9eeb8045d86e82009187a2
diff --git a/public/acloud_main.py b/public/acloud_main.py
index fbd40b9..d005bf8 100644
--- a/public/acloud_main.py
+++ b/public/acloud_main.py
@@ -407,15 +407,15 @@
setup.Run(args)
else:
sys.stderr.write("Invalid command %s" % args.which)
- return 2
+ return constants.EXIT_BY_WRONG_CMD
if report and args.report_file:
report.Dump(args.report_file)
- if report.errors:
- msg = "\n".join(report.errors)
- sys.stderr.write("Encountered the following errors:\n%s\n" % msg)
- return 1
- return 0
+ if report and report.errors:
+ msg = "\n".join(report.errors)
+ sys.stderr.write("Encountered the following errors:\n%s\n" % msg)
+ return constants.EXIT_BY_FAIL_REPORT
+ return constants.EXIT_SUCCESS
if __name__ == "__main__":