-
Notifications
You must be signed in to change notification settings - Fork 2
/
diffJobSettings.py
executable file
·48 lines (39 loc) · 1.23 KB
/
diffJobSettings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python
import argparse
import requests
parser = argparse.ArgumentParser()
parser.add_argument('--host')
parser.add_argument('--jobids')
parser.add_argument('--nossl', action='store_true')
args = parser.parse_args()
source_url=''
obvious_differs=("NAME")
ids=args.jobids.split(",")
if args.nossl:
source_url = 'http://'
else:
source_url = 'https://'
if args.host:
source_url += args.host + '/api/v1/jobs/'
else:
source_url += 'openqa.suse.de/api/v1/jobs/'
print('Result url - ' + source_url)
group_json1 = requests.get(source_url+ids[0]).json()
group_json2 = requests.get(source_url+ids[1]).json()
diff_data = dict()
extra_second = dict()
for key, value in group_json1['job']['settings'].items():
if key in obvious_differs:
continue
if key in group_json2['job']['settings']:
if value != group_json2['job']['settings'][key]:
diff_data.update({key:value})
else:
diff_data.update({key:value})
for key in group_json2['job']['settings'].keys():
if key not in group_json1['job']['settings']:
extra_second.update({key:value})
print('All extra keys in first job AND diff between first and second ')
print(diff_data)
print('Extra keys in second job')
print(extra_second)