Commit 87172073 authored by Takuto Ikuta's avatar Takuto Ikuta Committed by LUCI CQ

ninjalog_uploader_wrapper.py: handle broken config file

This is to make the script work even when config file is broken.

Change-Id: I6c2a090b01026b5747137bcc9fdec0bd5c03f75e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/3607373
Auto-Submit: Takuto Ikuta <tikuta@chromium.org>
Reviewed-by: 's avatarFumitoshi Ukai <ukai@google.com>
Commit-Queue: Fumitoshi Ukai <ukai@google.com>
parent 2065eee6
......@@ -23,7 +23,16 @@ VERSION = 3
def LoadConfig():
if os.path.isfile(CONFIG):
with open(CONFIG, 'r') as f:
config = json.load(f)
try:
config = json.load(f)
except Exception:
# Set default value when failed to load config.
config = {
'is-googler': ninjalog_uploader.IsGoogler(),
'countdown': 10,
'version': VERSION,
}
if config['version'] == VERSION:
config['countdown'] = max(0, config['countdown'] - 1)
return config
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment