cms_net: Add wolmatch_ensure function to call wolmatch in a loop
This commit is contained in:
parent
22b2c1759a
commit
46191399f4
@ -6,6 +6,7 @@ Network tools to run from the Master, specific to the Claremont MakerSpace
|
|||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
import netifaces
|
import netifaces
|
||||||
|
import time
|
||||||
|
|
||||||
import salt.utils.network
|
import salt.utils.network
|
||||||
|
|
||||||
@ -40,3 +41,10 @@ def wolmatch(tgt, destport=9):
|
|||||||
log.info('Waking up %s', mac)
|
log.info('Waking up %s', mac)
|
||||||
ret.append(f"{name}: {mac}")
|
ret.append(f"{name}: {mac}")
|
||||||
return ret
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user