diff --git a/bootstrap/scripts/validation.py b/bootstrap/scripts/validation.py index 54e65d2b..eba12ef3 100644 --- a/bootstrap/scripts/validation.py +++ b/bootstrap/scripts/validation.py @@ -49,22 +49,22 @@ def _validate_distribution(distribution: str) -> None: def _validate_node(node: dict, node_cidr: str, distribution: str) -> None: if not node.get("name"): - raise ValueError(f"Node {node.get('name')} is missing a name") + raise ValueError(f"A node is missing a name") if not node.get("username") and distribution not in ["k0s", "k3s"]: - raise ValueError(f"Node {node.get('username')} is missing a username") + raise ValueError(f"Node {node.get('name')} is missing a username") if not node.get("diskSerial") and distribution in ["talos"]: - raise ValueError(f"Node {node.get('diskSerial')} is missing a disk serial") + raise ValueError(f"Node {node.get('name')} is missing a disk serial") if not re.match(r"^[a-z0-9-\.]+$", node.get('name')): - raise ValueError(f"Invalid node name {node.get('name')}") + raise ValueError(f"Node {node.get('name')} has an invalid name") ip = _validate_ip(node.get("address")) if netaddr.IPAddress(ip, 4) not in netaddr.IPNetwork(node_cidr): - raise ValueError(f"Node {node.get('address')} is not in the node CIDR {node_cidr}") + raise ValueError(f"Node {node.get('name')} is not in the node CIDR {node_cidr}") port = 50000 if distribution == "talos" else 22 with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as sock: sock.settimeout(5) result = sock.connect_ex((ip, port)) if result != 0: - raise ValueError(f"Node {ip} port {port} is not open") + raise ValueError(f"Node {node.get('name')} port {port} is not open") def validate_python_version() -> None: required_version = (3, 11, 0)