зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1572355 - Add a function to parse the .extra file r=ahal
Adds `parse_extra_file(path)` to simply read some json .extra file and return a json dict, or an empty dict if it raises a `ValueError`. In patches for Bug 1572244 this function is used. Differential Revision: https://phabricator.services.mozilla.com/D59749 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
77cb44a9dc
Коммит
c0aff2f5ef
|
@ -5,6 +5,7 @@
|
|||
from __future__ import absolute_import, print_function
|
||||
|
||||
import glob
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import shutil
|
||||
|
@ -349,6 +350,14 @@ class CrashInfo(object):
|
|||
errors,
|
||||
extra)
|
||||
|
||||
def _parse_extra_file(self, path):
|
||||
with open(path) as file:
|
||||
try:
|
||||
return json.load(file)
|
||||
except ValueError:
|
||||
self.logger.warning(".extra file does not contain proper json")
|
||||
return {}
|
||||
|
||||
def _save_dump_file(self, path, extra):
|
||||
if os.path.isfile(self.dump_save_path):
|
||||
os.unlink(self.dump_save_path)
|
||||
|
|
Загрузка…
Ссылка в новой задаче