File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/upstart_service.cpython-310.pyc
Back
o ;jZC � @ sN d Z ddlZddlZddlZddlZddlZddlZddlZddl ZddiZ dZdd� Zdd � Z d d� Zdd � Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zd d!� Zd"d#� Zd$d%� Zd&d'� Zd(d)� Zd*d+� Zd,d-� Zd.d/� Z d0d� Z!d1d2� Z"dCd3d4�Z#d5d6� Z$d7d8� Z%d9d:� Z&d;d<� Z'd=d>� Z(d?d@� Z)dAdB� Z*dS )Da� Module for the management of upstart systems. The Upstart system only supports service starting, stopping and restarting. .. important:: If you feel that Salt should be using this module to manage services on a minion, and it is using a different module (or gives an error similar to *'service.start' is not available*), see :ref:`here <module-provider-override>`. Currently (as of Ubuntu 12.04) there is no tool available to disable Upstart services (like update-rc.d). This[1] is the recommended way to disable an Upstart service. So we assume that all Upstart services that have not been disabled in this manner are enabled. But this is broken because we do not check to see that the dependent services are enabled. Otherwise we would have to do something like parse the output of "initctl show-config" to determine if all service dependencies are enabled to start on boot. For example, see the "start on" condition for the lightdm service below[2]. And this would be too hard. So we wait until the upstart developers have solved this problem. :) This is to say that an Upstart service that is enabled may not really be enabled. Also, when an Upstart service is enabled, should the dependent services be enabled too? Probably not. But there should be a notice about this, at least. [1] http://upstart.ubuntu.com/cookbook/#disabling-a-job-from-automatically-starting [2] example upstart configuration file:: lightdm emits login-session-start emits desktop-session-start emits desktop-shutdown start on ((((filesystem and runlevel [!06]) and started dbus) and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1 or stopped udev-fallback-graphics)) or runlevel PREVLEVEL=S) stop on runlevel [016] .. warning:: This module should not be used on Red Hat systems. For these, the :mod:`rh_service <salt.modules.rh_service>` module should be used, as it supports the hybrid upstart/sysvinit system used in RHEL/CentOS 6. � N�reload_�reload�servicec C s` t jj�t�r dS td dv rtS td dv r.d} tj� | �r.t j j�| d �}d|v r.tS dS ) z Only work on Ubuntu )FzQThe upstart execution module failed to load: this system was booted with systemd.�os)ZUbuntuZLinaroz elementary OSZMint)ZDebianZRaspbianz /sbin/initctlz versionZupstart)FztThe upstart execution module failed to load: the system must be Ubuntu-based, or Debian-based with upstart support.) �salt�utilsZsystemdZbooted�__context__Z __grains__�__virtualname__r �path�isfile�modulesZcmdmodZ _run_quiet)Zdebian_initctlZinitctl_version� r �P/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/upstart_service.py�__virtual__? s �r c C sL i } dD ]}z || t �|�j<