Except only if required.

This commit is contained in:
Jeffrey Townsend
2016-12-13 21:32:08 +00:00
parent aada217a4c
commit 2018320174

View File

@@ -158,8 +158,12 @@ class OnlPlatformBase(object):
def add_info_json(self, name, f, klass=None, required=True):
if os.path.exists(f):
d = json.load(file(f))
self.add_info_dict(name, d, klass)
try:
d = json.load(file(f))
self.add_info_dict(name, d, klass)
except ValueError, e:
if required:
raise e
elif required:
raise RuntimeError("A required system file (%s) is missing." % f)