diff --git a/utils/compare_garr_psnc.sh b/utils/compare_garr_psnc.sh new file mode 100755 index 0000000000000000000000000000000000000000..cb666104d85ad9eb51a68a5c8ea7e417a1b22484 --- /dev/null +++ b/utils/compare_garr_psnc.sh @@ -0,0 +1,16 @@ +#!/bin/bash +if [ -z $1 ] +then + echo provide agriment 1 - to compare production and 0 to compare pre-preproduction + exit +fi +date +LEVEL=$1 +GARR='http://test-ot-1.aai-test.garr.it/' +PSNC='https://technical.edugain.org/new/' +URL=${GARR}'api.php?action=list_entity_sha1&opt='${LEVEL} +wget -q -O f1.json $URL +URL=${PSNC}'api.php?action=list_entity_sha1&opt='${LEVEL} +wget -q -O f2.json $URL +python3 compare_sha.py f1.json f2.json +rm f1.json f2.json diff --git a/utils/compare_sha.py b/utils/compare_sha.py new file mode 100644 index 0000000000000000000000000000000000000000..0a523c5b6b688897653b00c4b73596b2f620996d --- /dev/null +++ b/utils/compare_sha.py @@ -0,0 +1,59 @@ +import sys +import json + +if len(sys.argv) != 3: + print("Usage: "+sys.argv[0]+" first_file second_file") + sys.exit() + +E1 = {} +E2 = {} +F1 = {} +F2 = {} +onlyE1=[] +onlyE2=[] +modified=[] + +# first load both jsons +inp = sys.argv[1] +f = open(inp,"r") +x=json.load(f) +f.close() +for l in x: + E1[l[0]] = l[1] + F1[l[0]] = l[2] + +inp = sys.argv[2] +f = open(inp,"r") +x=json.load(f) +f.close() +for l in x: + E2[l[0]] = l[1] + F2[l[0]] = l[2] + +# now find the diffs +for l in E1: + if l not in E2: + onlyE1.append(l) + continue + if E1[l] != E2[l]: + modified.append(l) + continue + +for l in E2: + if l not in E1: + onlyE2.append(l) + +if len(onlyE1) > 0: + print("Only in feed 1") + for l in onlyE1: + print(l) + +if len(onlyE2) > 0: + print("Only in feed 2") + for l in onlyE2: + print(l) + +if len(modified) > 0: + print("Modified") + for l in modified: + print(l+"; "+F1[l]+"; "+F2[l])