From 46191399f494e7b5fb4da3d55b75a7d916f9423f Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Wed, 5 Oct 2022 14:24:04 -0400 Subject: [PATCH] cms_net: Add wolmatch_ensure function to call wolmatch in a loop --- _runners/cms_net.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/_runners/cms_net.py b/_runners/cms_net.py index 6ec6ae8..15d46e1 100644 --- a/_runners/cms_net.py +++ b/_runners/cms_net.py @@ -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)