Skip to content
Snippets Groups Projects
Commit 5bd856c8 authored by Tomasz Wolniewicz's avatar Tomasz Wolniewicz
Browse files

The feeds comparison script

parent 5c7aa62d
No related branches found
No related tags found
1 merge request!18The feeds comparison script
#!/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
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])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment