mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #42140 from rallytime/bp-42097
Back-port #42097 to 2016.11
This commit is contained in:
commit
c8afd7a3c9
1 changed files with 6 additions and 3 deletions
|
@ -20,6 +20,7 @@ import re
|
|||
import platform
|
||||
import logging
|
||||
import locale
|
||||
import datetime
|
||||
import salt.exceptions
|
||||
|
||||
__proxyenabled__ = ['*']
|
||||
|
@ -1688,12 +1689,14 @@ def ip_fqdn():
|
|||
ret[key] = []
|
||||
else:
|
||||
try:
|
||||
start_time = datetime.datetime.utcnow()
|
||||
info = socket.getaddrinfo(_fqdn, None, socket_type)
|
||||
ret[key] = list(set(item[4][0] for item in info))
|
||||
except socket.error:
|
||||
if __opts__['__role'] == 'master':
|
||||
log.warning('Unable to find IPv{0} record for "{1}" causing a 10 second timeout when rendering grains. '
|
||||
'Set the dns or /etc/hosts for IPv{0} to clear this.'.format(ipv_num, _fqdn))
|
||||
timediff = datetime.datetime.utcnow() - start_time
|
||||
if timediff.seconds > 5 and __opts__['__role'] == 'master':
|
||||
log.warning('Unable to find IPv{0} record for "{1}" causing a {2} second timeout when rendering grains. '
|
||||
'Set the dns or /etc/hosts for IPv{0} to clear this.'.format(ipv_num, _fqdn, timediff))
|
||||
ret[key] = []
|
||||
|
||||
return ret
|
||||
|
|
Loading…
Add table
Reference in a new issue