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//powerpath.py
"""
Powerpath configuration support
===============================

Allows configuration of EMC Powerpath.  Currently
only addition/deletion of licenses is supported.

.. code-block:: yaml

    key:
      powerpath.license_present: []
"""


def license_present(name):
    """
    Ensures that the specified PowerPath license key is present
    on the host.

    name
        The license key to ensure is present
    """
    ret = {"name": name, "changes": {}, "result": False, "comment": ""}

    if not __salt__["powerpath.has_powerpath"]():
        ret["result"] = False
        ret["comment"] = "PowerPath is not installed."
        return ret

    licenses = [l["key"] for l in __salt__["powerpath.list_licenses"]()]

    if name in licenses:
        ret["result"] = True
        ret["comment"] = f"License key {name} already present"
        return ret

    if __opts__["test"]:
        ret["result"] = None
        ret["comment"] = f"License key {name} is set to be added"
        return ret

    data = __salt__["powerpath.add_license"](name)
    if data["result"]:
        ret["changes"] = {name: "added"}
        ret["result"] = True
        ret["comment"] = data["output"]
        return ret
    else:
        ret["result"] = False
        ret["comment"] = data["output"]
        return ret


def license_absent(name):
    """
    Ensures that the specified PowerPath license key is absent
    on the host.

    name
        The license key to ensure is absent
    """
    ret = {"name": name, "changes": {}, "result": False, "comment": ""}

    if not __salt__["powerpath.has_powerpath"]():
        ret["result"] = False
        ret["comment"] = "PowerPath is not installed."
        return ret

    licenses = [l["key"] for l in __salt__["powerpath.list_licenses"]()]

    if name not in licenses:
        ret["result"] = True
        ret["comment"] = f"License key {name} not present"
        return ret

    if __opts__["test"]:
        ret["result"] = None
        ret["comment"] = f"License key {name} is set to be removed"
        return ret

    data = __salt__["powerpath.remove_license"](name)
    if data["result"]:
        ret["changes"] = {name: "removed"}
        ret["result"] = True
        ret["comment"] = data["output"]
        return ret
    else:
        ret["result"] = False
        ret["comment"] = data["output"]
        return ret

Youez - 2016 - github.com/yon3zu
LinuXploit