Simplify hostname lookup
When we are trying to resolve the hostname to an IP address we only care about the IP address so remove the rest of the unused variables. This popped up in a pylint run. Change-Id: I8e3b6cfd80be3d872f3bfc0ee5ac581fae5f45af Signed-off-by: Chuck Short <chucks@redhat.com>
This commit is contained in:
parent
edfbe6fd43
commit
0912617731
|
@ -1005,11 +1005,10 @@ def resolve_hostname(hostname):
|
|||
:param hostname: Host name to resolve.
|
||||
:returns: IP Address for Host name.
|
||||
"""
|
||||
result = socket.getaddrinfo(hostname, None)[0]
|
||||
(family, socktype, proto, canonname, sockaddr) = result
|
||||
ip = socket.getaddrinfo(hostname, None)[0][4][0]
|
||||
LOG.debug('Asked to resolve hostname %(host)s and got IP %(ip)s.',
|
||||
{'host': hostname, 'ip': sockaddr[0]})
|
||||
return sockaddr[0]
|
||||
{'host': hostname, 'ip': ip})
|
||||
return ip
|
||||
|
||||
|
||||
def build_or_str(elements, str_format=None):
|
||||
|
|
Loading…
Reference in New Issue