Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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