File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/nspawn.cpython-310.pyc
Back
o ;j�� � @ s d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddlZ ddlZ ddl Z ddlZ ddlmZmZ e�e�ZddiZdZdZdZd Zd d� Zdd � Zdd� Zdidd�Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#d d!� Z$d"d#� Z%d$d%� Z&djd'd(�Z'e ) & dkd*d+��Z(ed,d-� �Z) ) ) & dld.d/�Z* ) ) & dld0d1�Z+ ) ) & dld2d3�Z, ) ) & dld4d5�Z- ) ) & dld6d7�Z.dmd8d9�Z/d:d;� Z0 ) ) dnd<d=�Z1d>d?� Z2d@dA� Z3e j4j�5e3d�Z6dBdC� Z7dDdE� Z8edFdG� �Z9dHdI� Z:edJdK� �Z;edLdM� �Z<edNdO� �Z=edodPdQ��Z>dRdS� Z?dTdU� Z@dVdW� ZAedodXdY��ZBedodZd[��ZCe j4j�5eCd\�ZDedpd]d^��ZEe j4j�5eEd_�ZFd`da� ZGdodbdc�ZHdoddde�ZIdfdg� ZJe j4j�5eJdh�ZKdS )qau Manage nspawn containers .. versionadded:: 2015.8.0 `systemd-nspawn(1)`__ is a tool used to manage lightweight namespace containers. This execution module provides several functions to help manage these containers. .. __: http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html Minions running systemd >= 219 will place new containers in ``/var/lib/machines``, while those running systemd < 219 will place them in ``/var/lib/container``. .. note: ``nsenter(1)`` is required to run commands within containers. It should already be present on any systemd host, as part of the **util-linux** package. � N)�CommandExecutionError�SaltInvocationError�list_�listZnspawnz/nspawn.initial_seedzF/etc/systemd/system/multi-user.target.wants/systemd-nspawn@{0}.serviceZnsenterc C s@ t d dkrtjj�t�rtjj�� du rt�d� dS t S dS )zA Only work on systems that have been booted with systemd Zkernel�LinuxNz+nspawn: Unable to determine systemd version)FzdThe nspawn execution module failed to load: only work on systems that have been booted with systemd.) � __grains__�salt�utils�systemdZbooted�__context__�version�log�error�__virtualname__� r r �G/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/nspawn.py�__virtual__2 s �r c C s t jj�t�S )z� Returns __context__.get('systemd.version', 0), avoiding duplication of the call to dict.get and making it easier to change how we handle this context var in the future )r r r r r r r r r �_sd_versionB s r c s t �� �� fdd��}|S )z> Decorator to ensure that the named container exists. c s>