Merge pull request #47191 from terminalmage/issue47150

salt-ssh: Do not attempt to match host/ip to minion ID if reverse lookup fails
This commit is contained in:
Nicole Thomas 2018-04-20 10:20:04 -04:00 committed by GitHub
commit 7f1115e611
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View file

@ -353,6 +353,9 @@ class SSH(object):
needs_expansion = '*' not in hostname and salt.utils.network.is_reachable_host(hostname)
if needs_expansion:
hostname = salt.utils.network.ip_to_host(hostname)
if hostname is None:
# Reverse lookup failed
return
self._get_roster()
for roster_filename in self.__parsed_rosters:
roster_data = self.__parsed_rosters[roster_filename]

View file

@ -218,7 +218,8 @@ def ip_to_host(ip):
'''
try:
hostname, aliaslist, ipaddrlist = socket.gethostbyaddr(ip)
except Exception:
except Exception as exc:
log.debug('salt.utils.network.ip_to_host(%r) failed: %s', ip, exc)
hostname = None
return hostname