From 043ae8bd920c91e9e71808a0970cd199d0b05a02 Mon Sep 17 00:00:00 2001 From: Bo Maryniuk Date: Fri, 3 Jun 2016 16:23:32 +0200 Subject: [PATCH] Use api of the distinct list --- salt/utils/network.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/utils/network.py b/salt/utils/network.py index 912ea2bd92..b522f03db3 100644 --- a/salt/utils/network.py +++ b/salt/utils/network.py @@ -114,13 +114,13 @@ def generate_minion_id(): hosts = DistinctList().append(socket.getfqdn()).append(socket.gethostname()).append(platform.node()) if hosts: try: - for a_nfo in socket.getaddrinfo(hosts[0], socket.AF_UNSPEC, socket.SOCK_STREAM, + for a_nfo in socket.getaddrinfo(hosts.first(), socket.AF_UNSPEC, socket.SOCK_STREAM, socket.SOL_TCP, socket.AI_CANONNAME): if len(a_nfo) > 3: hosts.append(a_nfo[3]) except socket.gaierror: log.warn('Cannot resolve address {addr} info via socket: {message}'.format( - addr=hosts[0], message=socket.gaierror) + addr=hosts.first(), message=socket.gaierror) ) # Universal method for everywhere (Linux, Slowlaris, Windows etc)