403Webshell
Server IP : 198.38.94.67  /  Your IP : 216.73.217.178
Web Server : LiteSpeed
System : Linux d6054.dxb1.stableserver.net 5.14.0-570.25.1.el9_6.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 9 04:57:09 EDT 2025 x86_64
User : azfilmst ( 1070)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/pillar/nodegroups.py
"""
Nodegroups Pillar
=================

Introspection: to which nodegroups does my minion belong?
Provides a pillar with the default name of `nodegroups`
which contains a list of nodegroups which match for a given minion.

.. versionadded:: 2016.11.0

Command Line
------------

.. code-block:: bash

    salt-call pillar.get nodegroups
    local:
        - class_infra
        - colo_sj
        - state_active
        - country_US
        - type_saltmaster

Configuring Nodegroups Pillar
-----------------------------

.. code-block:: yaml

    extension_modules: /srv/salt/ext
    ext_pillar:
      - nodegroups:
          pillar_name: 'nodegroups'

"""

# Import futures

from salt.utils.minions import CkMinions

__version__ = "0.0.2"


def ext_pillar(minion_id, pillar, pillar_name=None):
    """
    A salt external pillar which provides the list of nodegroups of which the minion is a member.

    :param minion_id: used for compound matching nodegroups
    :param pillar: provided by salt, but not used by nodegroups ext_pillar
    :param pillar_name: optional name to use for the pillar, defaults to 'nodegroups'
    :return: a dictionary which is included by the salt master in the pillars returned to the minion
    """

    pillar_name = pillar_name or "nodegroups"
    all_nodegroups = __opts__["nodegroups"]
    nodegroups_minion_is_in = []
    ckminions = None
    for nodegroup_name in all_nodegroups.keys():
        ckminions = ckminions or CkMinions(__opts__)
        _res = ckminions.check_minions(all_nodegroups[nodegroup_name], "compound")
        match = _res["minions"]

        if minion_id in match:
            nodegroups_minion_is_in.append(nodegroup_name)

    return {pillar_name: nodegroups_minion_is_in}

Youez - 2016 - github.com/yon3zu
LinuXploit