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/states/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/aptpkg.py
"""
Package management operations specific to APT- and DEB-based systems
====================================================================
"""

import logging

import salt.utils.data

log = logging.getLogger(__name__)


# Define the module's virtual name
__virtualname__ = "apt"


def __virtual__():
    """
    Only work on apt-based platforms with pkg.get_selections
    """
    if "pkg.get_selections" in __salt__:
        return True
    return (False, "apt module could not be loaded")


def held(name):
    """
    Set package in 'hold' state, meaning it will not be upgraded.

    name
        The name of the package, e.g., 'tmux'
    """
    ret = {"name": name, "changes": {}, "result": False, "comment": ""}
    state = __salt__["pkg.get_selections"](
        pattern=name,
    )
    if not state:
        ret.update(comment=f"Package {name} does not have a state")
    elif not salt.utils.data.is_true(state.get("hold", False)):
        if not __opts__["test"]:
            result = __salt__["pkg.set_selections"](selection={"hold": [name]})
            ret.update(
                changes=result[name],
                result=True,
                comment=f"Package {name} is now being held",
            )
        else:
            ret.update(result=None, comment=f"Package {name} is set to be held")
    else:
        ret.update(result=True, comment=f"Package {name} is already held")

    return ret

Youez - 2016 - github.com/yon3zu
LinuXploit