-
-
Save basepi/e5d0013406c6f79f13b3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!py | |
# -*- coding: utf-8 -*- | |
import logging | |
import salt.client as salt_client | |
def run(): | |
"""EdgeCast Pending Auth""" | |
logger = logging.getLogger(__name__) | |
logger.trace("Handling minion event with data : %s", data) | |
# check type of event | |
if 'act' not in data: | |
logger.trace("Event does not have an 'act' field, so ignoring it") | |
return {} | |
minion_id = data['id'] | |
local = salt_client.LocalClient() | |
""" run sync_all to load all files to minion """ | |
local.cmd(minion_id, 'saltutil.sync_all') | |
""" refresh pillars to get uber data for new minion """ | |
local.cmd(minion_id, 'saltutil.refresh_pillar') | |
""" run global.minion.state """ | |
local.cmd(minion_id, 'state.sls', ['global.minion']) | |
""" run global state """ | |
local.cmd(minion_id, 'state.sls', 'global') | |
if __name__ == '__main__': | |
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#What i want to do is python | |
CMD="salt '${SERVER}' system.reboot && salt-run state.event 'salt/minion/${SERVER}/start' count=1 quiet=True && salt '${SERVER}' st | |
ate.highstate" | |
eval ${CMD} | |
RET=$? | |
if [ $RET == 0 ];then | |
echo " server looks a ok " | |
else | |
echo " server failed the highstate after reboot " | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment