Merge pull request #1037 from UtahDave/add_wollist_runner

Add capability to wake up multiple minions at once
This commit is contained in:
Thomas S Hatch 2012-04-02 22:40:33 -07:00
commit d90dc6929b

View File

@ -4,6 +4,25 @@ Network tools to run from the Master
import socket
def wollist(maclist, bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up a list of Minions.
This list must contain one MAC hardware address per line
CLI Example::
salt-run '/path/to/maclist'
salt-run '/path/to/maclist' 255.255.255.255 7
salt-run '/path/to/maclist' 255.255.255.255 7
'''
try:
file = open(maclist, 'r')
for mac in file:
wol(mac.strip(), bcast, destport)
print "Waking up %s" % mac.strip()
except Exception as inst:
print "Failed to open the MAC file. Error: %s" % inst
def wol(mac, bcast='255.255.255.255', destport=9):
'''
Send a "Magic Packet" to wake up a Minion