mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
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:
commit
7f1115e611
2 changed files with 5 additions and 1 deletions
|
@ -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]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue