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/runners/
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/runners/launchd.py

"""
Manage launchd plist files
"""

import os
import sys


def write_launchd_plist(program):
    """
    Write a launchd plist for managing salt-master or salt-minion

    CLI Example:

    .. code-block:: bash

        salt-run launchd.write_launchd_plist salt-master
    """
    plist_sample_text = """
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>org.saltstack.{program}</string>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>ProgramArguments</key>
    <array>
        <string>{script}</string>
    </array>
    <key>SoftResourceLimits</key>
    <dict>
        <key>NumberOfFiles</key>
        <integer>100000</integer>
    </dict>
    <key>HardResourceLimits</key>
    <dict>
        <key>NumberOfFiles</key>
        <integer>100000</integer>
    </dict>
  </dict>
</plist>
    """.strip()

    supported_programs = ["salt-master", "salt-minion"]

    if program not in supported_programs:
        sys.stderr.write(f"Supported programs: '{supported_programs}'\n")
        sys.exit(-1)

    return plist_sample_text.format(
        program=program,
        python=sys.executable,
        script=os.path.join(os.path.dirname(sys.executable), program),
    )