fix: Some nodes do not have IPs, can't always use it for comparaison

pull/605/head
Raphaël Vinot 2023-02-09 15:39:40 +01:00
parent 7210f39c42
commit 2f2fd6024b
1 changed files with 7 additions and 6 deletions

View File

@ -46,12 +46,13 @@ class Comparator():
to_return['url'] = {'message': 'The nodes have the same URL.',
'details': left.name}
# IP in HAR
if left.ip_address != right.ip_address:
to_return['ip'] = {'message': 'The nodes load content from different IPs.',
'details': [str(left.ip_address), str(right.ip_address)]}
else:
to_return['ip'] = {'message': 'The nodes load content from the same IP.',
'details': str(left.ip_address)}
if hasattr(left, 'ip_address') and hasattr(right, 'ip_address'):
if left.ip_address != right.ip_address:
to_return['ip'] = {'message': 'The nodes load content from different IPs.',
'details': [str(left.ip_address), str(right.ip_address)]}
else:
to_return['ip'] = {'message': 'The nodes load content from the same IP.',
'details': str(left.ip_address)}
# IPs in hostnode + ASNs
return to_return