def get_local_ip() -> Result:
"""
Returns the local IPAddr address associated with this server
# Failures
Returns a GlusterError representing any failure that may have happened
while trying to
query this information.
"""
ip_addr = get_host_ip(unit_get('private-address'))
try:
parsed = ip_address(address=ip_addr)
return Ok(parsed) # Resolves a str hostname into a ip address.
except ValueError:
return Err("failed to parse ip address: {}".format(ip_addr))
评论列表
文章目录