PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/grains/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //proc/self/root/opt/saltstack/salt/lib/python3.10/site-packages/salt/grains/minion_process.py

"""
Set grains describing the minion process.
"""

import os

import salt.utils.platform
import salt.utils.user


def _uid():
    """
    Grain for the minion User ID
    """
    return salt.utils.user.get_uid()


def _username():
    """
    Grain for the minion username
    """
    return salt.utils.user.get_user()


def _gid():
    """
    Grain for the minion Group ID
    """
    return salt.utils.user.get_gid()


def _groupname():
    """
    Grain for the minion groupname
    """
    try:
        return salt.utils.user.get_default_group(_username()) or ""
    except KeyError:
        return ""


def _pid():
    """
    Return the current process pid
    """
    return os.getpid()


def grains():
    """
    Return the grains dictionary
    """
    ret = {
        "username": _username(),
        "groupname": _groupname(),
        "pid": _pid(),
    }

    if not salt.utils.platform.is_windows():
        ret["gid"] = _gid()
        ret["uid"] = _uid()

    return ret