Report sandbox DHCP diagnostics
Homelab Main / validate (push) Waiting to run Details
Homelab Main / running-update (push) Blocked by required conditions Details
Homelab Main / debian-ops (push) Blocked by required conditions Details

This commit is contained in:
juvenal.diaz 2026-11-06 22:35:40 -06:00
parent 61ee7be54e
commit 6bbc7ca72f
1 changed files with 22 additions and 2 deletions

View File

@ -52,6 +52,26 @@ def peer_probe(source, own_ip, peer_ip):
return 'inconclusive: peer ping failed to execute'
def client_address(guest, network):
output = run('pct', 'exec', str(guest), '--', 'ip', '-4', 'addr', 'show', 'dev', 'eth0')
try:
return address_from_output(output, network)
except RuntimeError as exc:
print(f'Client {guest} address check: {exc}', file=sys.stderr)
print('Interface state:', file=sys.stderr)
print(output[:2000], file=sys.stderr)
diagnostic = subprocess.run(
['pct', 'exec', str(guest), '--', 'sh', '-c',
"printf '%s\\n' '-- network configuration'; "
"if [ -f /etc/network/interfaces ]; then cat /etc/network/interfaces; else echo 'No /etc/network/interfaces'; fi; "
"printf '%s\\n' '-- DHCP processes'; ps | grep '[u]dhcpc' || true"],
capture_output=True, text=True, timeout=20)
print(diagnostic.stdout[:3000], file=sys.stderr)
if diagnostic.returncode:
print(f'Client diagnostics exit: {diagnostic.returncode}', file=sys.stderr)
raise
def main():
try:
for command, guest in (('qm', 9100), ('pct', 9110), ('pct', 9111)):
@ -80,8 +100,8 @@ def main():
raise RuntimeError(f'{port} has an unexpected sandbox VLAN')
ports[port] = sorted(ids)
addresses = {
9110: address_from_output(run('pct', 'exec', '9110', '--', 'ip', '-4', 'addr', 'show', 'dev', 'eth0'), '172.29.210.0/24'),
9111: address_from_output(run('pct', 'exec', '9111', '--', 'ip', '-4', 'addr', 'show', 'dev', 'eth0'), '172.29.220.0/24'),
9110: client_address(9110, '172.29.210.0/24'),
9111: client_address(9111, '172.29.220.0/24'),
}
probes = {
'vlan10_to_vlan20': peer_probe(9110, addresses[9110], addresses[9111]),