applied jamespage review fixes

This commit is contained in:
Edward Hope-Morley 2014-09-24 13:56:03 +01:00
parent e5ca14fc27
commit 720bfb06e9
1 changed files with 3 additions and 3 deletions

View File

@ -71,10 +71,10 @@ def get_unit_hostname():
@cached
def get_host_ip(hostname=None):
if config('prefer-ipv6'):
return get_ipv6_addr()[0]
hostname = hostname or unit_get('private-address')
if config('prefer-ipv6'):
return hostname or get_ipv6_addr()[0]
try:
# Test to see if already an IPv4 address
socket.inet_aton(hostname)