Skip to content

Commit

Permalink
#47: swallow invalid host exception
Browse files Browse the repository at this point in the history
  • Loading branch information
abdul committed Jan 22, 2018
1 parent 6d672ec commit 04bbb35
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions mongoctl/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,17 @@ def is_same_host(host1, host2):
"""
Returns true if host1 == host2 OR map to the same host (using DNS)
"""
try:

if host1 == host2:
return True
else:
ips1 = get_host_ips(host1)
ips2 = get_host_ips(host2)
return len(set(ips1) & set(ips2)) > 0
if host1 == host2:
return True
else:
ips1 = get_host_ips(host1)
ips2 = get_host_ips(host2)
return len(set(ips1) & set(ips2)) > 0
except Exception, ex:
log_exception(ex)
return False

###############################################################################
def is_same_address(addr1, addr2):
Expand Down

0 comments on commit 04bbb35

Please sign in to comment.