bundlewrap/bundles/wol-waker/metadata.py
CroneKorkN 14e055a5e0
wol: share the wakeonlan command via wol-sleeper/waker_command
Sleeper now exposes the full `/usr/bin/wakeonlan -i <broadcast> <mac>`
invocation as wol-sleeper/waker_command; waker reads that instead of
rebuilding the command line itself. Adds the `-i <subnet-broadcast>`
flag so magic packets reach sleepers on a different L2 segment than
the waker.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-16 01:00:30 +02:00

31 lines
895 B
Python

defaults = {
'apt': {
'packages': {
'wakeonlan': {},
},
},
}
@metadata_reactor.provides(
'users/wol/authorized_users',
)
def user(metadata):
return {
'users': {
'wol': {
'authorized_users': {
f'root@{ssh_client.name}': {
'commands': {
sleeper.metadata.get('wol-sleeper/waker_command')
for sleeper in repo.nodes
if sleeper.has_bundle('wol-sleeper')
and sleeper.metadata.get('wol-sleeper/waker') == node.name
}
}
for ssh_client in repo.nodes
if ssh_client.dummy == False and ssh_client.has_bundle('ssh')
},
},
},
}