Commit 05f6119d authored by Daniel Nurmi's avatar Daniel Nurmi
Browse files

fix to handle transition between extra and base module output types during differencing


Signed-off-by: default avatarDaniel Nurmi nurmi@anchore.com>
parent 8f0d380a
......@@ -1789,22 +1789,31 @@ def diff_images(imageId, baseimageId):
output = {}
adata = areport[module_name][module_value][module_type]
bdata = breport[module_name][module_value][module_type]
for akey in adata.keys():
if akey not in bdata:
output[akey] = "INIMG_NOTINBASE"
elif adata[akey] != bdata[akey]:
output[akey] = "VERSION_DIFF"
for bkey in bdata.keys():
if bkey not in adata:
output[bkey] = "INBASE_NOTINIMG"
if module_name not in ret:
ret[module_name] = {}
if module_value not in ret[module_name]:
ret[module_name][module_value] = {}
ret[module_name][module_value][module_type] = output
try:
bdata = breport[module_name][module_value][module_type]
except:
for btype in breport[module_name][module_value].keys():
try:
bdata = breport[module_name][module_value][btype]
break
except:
pass
if adata and bdata:
for akey in adata.keys():
if akey not in bdata:
output[akey] = "INIMG_NOTINBASE"
elif adata[akey] != bdata[akey]:
output[akey] = "VERSION_DIFF"
for bkey in bdata.keys():
if bkey not in adata:
output[bkey] = "INBASE_NOTINIMG"
if module_name not in ret:
ret[module_name] = {}
if module_value not in ret[module_name]:
ret[module_name][module_value] = {}
ret[module_name][module_value][module_type] = output
return(ret)
......
Supports Markdown
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