File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/states/__pycache__/service.cpython-310.pyc
Back
o ;jȖ � @ s� d Z ddlZddlZddlZddlZddlmZ ddlm Z ddlmZ dZ e�e�ZdZdd � Zd d� Zdd � Zdd� Zd*dd�Zd*dd�Zdd� Zdd� Zd+dd�Zd+dd�Zdd� Zdd � Zd,d"d#�Zd,d$d%�Z ! ! !d-d&d'�Z d(d)� Z!dS ).a� Starting or restarting of services and daemons ============================================== Services are defined as system daemons and are typically launched using system init or rc scripts. This service state uses whichever service module is loaded on the minion with the virtualname of ``service``. Services can be defined as either running or dead. If you need to know if your init system is supported, see the list of supported :mod:`service modules <salt.modules.service.py>` for your desired init system (systemd, sysvinit, launchctl, etc.). Note that Salt's service execution module, and therefore this service state, uses OS grains to ascertain which service module should be loaded and used to execute service functions. As existing distributions change init systems or new distributions are created, OS detection can sometimes be incomplete. If your service states are running into trouble with init system detection, please see the :ref:`Overriding Virtual Module Providers <module-provider-override>` section of Salt's module documentation to work around possible errors. For services managed by systemd, the systemd_service module includes a built-in feature to reload the daemon when unit files are changed or extended. This feature is used automatically by the service state and the systemd_service module when running on a systemd minion, so there is no need to set up your own methods of reloading the daemon. If you need to manually reload the daemon for some reason, you can use the :func:`systemd_service.systemctl_reload <salt.modules.systemd_service.systemctl_reload>` function provided by Salt. .. note:: The current status of a service is determined by the return code of the init/rc script status command. A status return code of 0 it is considered running. Any other return code is considered dead. .. code-block:: yaml httpd: service.running: [] The service can also be set to start at runtime via the enable option: .. code-block:: yaml openvpn: service.running: - enable: True By default if a service is triggered to refresh due to a watch statement the service is restarted. If the desired behavior is to reload the service, then set the reload value to True: .. code-block:: yaml redis: service.running: - enable: True - reload: True - watch: - pkg: redis .. note:: More details regarding ``watch`` can be found in the :ref:`Requisites <requisites>` documentation. � N)�CommandExecutionError)�get_function_argspec)�booted)Zno_block�unmask�unmask_runtime�servicec C s&