def _get_host_ip_addr(attributes, networks):
if 'intern_ip' not in attributes:
if not networks:
raise CreateError(
'"intern_ip" is not given, and no networks could be found.'
)
intern_ip = _choose_ip_addr(networks)
if intern_ip is None:
raise CreateError(
'No IP address could be selected from the given networks.'
)
return intern_ip
try:
intern_ip = ip_interface(attributes['intern_ip'])
except ValueError as error:
raise CreateError(str(error))
_check_in_networks(networks, intern_ip.network)
return intern_ip.ip
评论列表
文章目录