cms_net: Add wolmatch_ensure function to call wolmatch in a loop

This commit is contained in:
Adam Goldsmith 2022-10-05 14:24:04 -04:00
parent 22b2c1759a
commit 46191399f4

View File

@ -6,6 +6,7 @@ Network tools to run from the Master, specific to the Claremont MakerSpace
import logging
import socket
import netifaces
import time
import salt.utils.network
@ -40,3 +41,10 @@ def wolmatch(tgt, destport=9):
log.info('Waking up %s', mac)
ret.append(f"{name}: {mac}")
return ret
def wolmatch_ensure(tgt, destport=9):
'Ensure matched minions are online, and stay online'
while True:
log.info('Waking up minions')
wolmatch(tgt, destport)
time.sleep(5)