Skip to content

Commit

Permalink
Add 10.4.24.0/24 route
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidma committed Jan 16, 2025
1 parent fd4a008 commit a729f97
Showing 1 changed file with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ based on the team number and the number of the NAO, and sets the hostname.

from __future__ import annotations

import sys
import tomllib
from pathlib import Path
from subprocess import check_call, check_output
from typing import Any

import tomllib

TEAM_TOML = "/media/internal/team.toml"
HEAD_ID_SCRIPT = "/opt/aldebaran/bin/head_id"
WLAN_NETWORK_PATH = "/etc/systemd/network/20-wlan.network"
Expand Down Expand Up @@ -79,7 +79,9 @@ def find_nao_with_head_id(
"""
try:
return next(x for x in configuration["naos"] if x["head_id"] == head_id)
return next(
x for x in configuration["naos"] if x["head_id"] == head_id
)
except StopIteration as error:
msg = f"Could not find NAO with head_id {head_id}"
raise ValueError(msg) from error
Expand Down Expand Up @@ -129,6 +131,10 @@ Address=10.1.{team_number}.{nao["number"]}/16
[Route]
Gateway=10.1.24.1
Destination=10.2.24.0/24
[Route]
Gateway=10.1.24.1
Destination=10.4.24.0/24
"""


Expand Down Expand Up @@ -163,10 +169,16 @@ if __name__ == "__main__":
except ValueError as error:
print(error)
write_to_file(FALLBACK_NETWORK_PATH, FALLBACK_CONFIGURATION)
exit(1)

wlan_configuration = compose_wlan_network(nao, configuration["team_number"])
wired_configuration = compose_wired_network(nao, configuration["team_number"])
sys.exit(1)

wlan_configuration = compose_wlan_network(
nao,
configuration["team_number"],
)
wired_configuration = compose_wired_network(
nao,
configuration["team_number"],
)

write_to_file(WLAN_NETWORK_PATH, wlan_configuration)
write_to_file(WIRED_NETWORK_PATH, wired_configuration)
Expand Down

0 comments on commit a729f97

Please sign in to comment.