Gracefully handle empty config json data

If the json config data is set to Null, the current code throws an error
because we attempt to use .items() on the parsed result. We should just
treat and empty file as an empty dict so the code properly continues.

Change-Id: I02bb2ce5359aeec1e600b0c0f04fb72c7a335407
Closes-Bug: #1828295
This commit is contained in:
Alex Schultz 2019-05-08 14:33:06 -06:00
parent 62ffd0683d
commit 055d15f928

View File

@ -552,6 +552,11 @@ for infile in infiles:
with open(infile) as f:
infile_data = json.load(f)
# if the contents of the file is None, we need should just create an empty
# data set see LP#1828295
if not infile_data:
infile_data = {}
for k, v in iter(infile_data.items()):
config_volumes = match_config_volumes(config_volume_prefix, v)
config_hashes = [get_config_hash(volume_path) for volume_path in config_volumes]