Skip to content

Instantly share code, notes, and snippets.

@syphernl
Last active September 23, 2016 21:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save syphernl/63655607e5b2f5339bd1 to your computer and use it in GitHub Desktop.
Save syphernl/63655607e5b2f5339bd1 to your computer and use it in GitHub Desktop.
Saltstack MasterMinion show_highstate attempt
# -*- coding: utf-8 -*-
'''
Functions to interact with the state compiler on the master
'''
from __future__ import absolute_import
import pprint
# Import salt libs
import salt.utils.minion
def show_highstate(minion, saltenv='base', **kwargs):
'''
Returns the compiled top data for pillar for a specified minion. If no
minion is specified, we use the first minion we find.
CLI Example:
.. code-block:: bash
salt-run highstate_magic.show_highstate
'''
id_, grains, pillar = salt.utils.minions.get_minion_data(minion, __opts__)
local_minion_opts = __opts__.copy()
local_minion_opts['id'] = id_
local_minion_opts['grains'] = grains
local_minion_opts['pillar'] = pillar
local_minion_opts['env'] = saltenv
local_minion_opts['master_uri'] = 'tcp://127.0.0.1:4506'
local_minion_opts['file_client'] = 'local'
mminion = salt.minion.MasterMinion(local_minion_opts)
mmhighstate = mminion.functions['state.show_highstate'](local_minion_opts)
return mmhighstate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment