dataset/seed/host-systemd-machined/funcs/machined.py

25 lines
635 B
Python
Raw Normal View History

2022-12-25 17:11:26 +01:00
from risotto.utils import multi_function as _multi_function
from typing import List as _List
@_multi_function
def get_internal_zone_names(zones) -> _List[str]:
return list(zones)
def is_first_interface(index) -> bool:
return index == 0
2023-06-23 08:12:05 +02:00
@_multi_function
def get_host_ip(zones: dict,
server_name: str,
):
host_name, domain_name = server_name.split('.', 1)
for zone in zones.values():
if domain_name == zone['domain_name']:
break
else:
raise ValueError(f'cannot find IP in domain name "{domain_name}" (for "{server_name}")')
return zone['host_ip']