Do not parse options.android_build_credential if the file does not exist.
So moblab upstart job can have the arg specified to a fixed file even if the
file is not existed yet.
BUG=chromium:570705
TEST=verify with a local moblab build
Change-Id: I339343bb61b3eb40885fbb2f339ecb94bf2f7fb1
Reviewed-on: https://chromium-review.googlesource.com/320416
Commit-Ready: Dan Shi <dshi@google.com>
Tested-by: Dan Shi <dshi@google.com>
Reviewed-by: Simran Basi <sbasi@chromium.org>
diff --git a/devserver.py b/devserver.py
index ebe46f2..b9a6eab 100755
--- a/devserver.py
+++ b/devserver.py
@@ -1449,9 +1449,14 @@
if options.portfile:
cherrypy_ext.PortFile(cherrypy.engine, options.portfile).subscribe()
- if options.android_build_credential:
- with open(options.android_build_credential) as f:
- android_build.BuildAccessor.credential_info = json.load(f)
+ if (options.android_build_credential and
+ os.path.exists(options.android_build_credential)):
+ try:
+ with open(options.android_build_credential) as f:
+ android_build.BuildAccessor.credential_info = json.load(f)
+ except ValueError as e:
+ _Log('Failed to load the android build credential: %s. Error: %s.' %
+ (options.android_build_credential, e))
cherrypy.quickstart(dev_server, config=_GetConfig(options))