Merge pull request #34284 from rallytime/fix-34129

Don't require 'domain' to be present before checking fqdn_ip* grains
This commit is contained in:
Mike Place 2016-06-27 10:06:17 -07:00 committed by GitHub
commit dc8462451d

View File

@ -1603,9 +1603,8 @@ def fqdn_ip4():
addrs = []
try:
hostname_grains = hostname()
if hostname_grains['domain']:
info = socket.getaddrinfo(hostname_grains['fqdn'], None, socket.AF_INET)
addrs = list(set(item[4][0] for item in info))
info = socket.getaddrinfo(hostname_grains['fqdn'], None, socket.AF_INET)
addrs = list(set(item[4][0] for item in info))
except socket.error:
pass
return {'fqdn_ip4': addrs}
@ -1633,9 +1632,8 @@ def fqdn_ip6():
addrs = []
try:
hostname_grains = hostname()
if hostname_grains['domain']:
info = socket.getaddrinfo(hostname_grains['fqdn'], None, socket.AF_INET6)
addrs = list(set(item[4][0] for item in info))
info = socket.getaddrinfo(hostname_grains['fqdn'], None, socket.AF_INET6)
addrs = list(set(item[4][0] for item in info))
except socket.error:
pass
return {'fqdn_ip6': addrs}