File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/nilrt_ip.cpython-310.pyc
o
�N�g� � @ s� d Z ddlZddlZddlZddlZddlZddlZddlZddl Zzddl
Z
W n ey3 dZ
Y nw zddlZW n eyE dZY nw zddl
Z
ddlmZmZ W n ey_ dZ
Y nw zddlmZ W n eys dZY nw e�e�ZdZdZdZdZd Zg d
�ZdZdd
� Zdd� Zdd� Zdd� Z dd� Z!dd� Z"dd� Z#dd� Z$dd� Z%dd� Z&d d!� Z'd"d#� Z(d$efd%d&�Z)d'd(� Z*d)d*� Z+d+d,� Z,d-d.� Z-d/d0� Z.d1d2� Z/d3d4� Z0d5d6� Z1d7d8� Z2d9d:� Z3d;d<� Z4d=d>� Z5d?efd@dA�Z6dBdC� Z7dfdDdE�Z8dFdG� Z9dfdHdI�Z:dJdK� Z;dLdM� Z<dNdO� Z=dPdQ� Z>dRdS� Z?dTdU� Z@dVdW� ZAdXdY� ZBdfdZd[�ZCd\d]� ZDd^d_� ZEd`da� ZFdbdc� ZGddde� ZHdS )gz6
The networking module for NI Linux Real-Time distro
� N)�IFF_LOOPBACK�IFF_RUNNING)�CaseInsensitiveDict�ipz/net/connman/service/z"/var/lib/connman/interfaces.configz/usr/local/natinst/bin/nirtcfgz/etc/natinst/share/ni-rt.ini)�yes�on�true�1TZEtherCATc C s | st |��dS )z6
Raise an exception if the condition is false
N)�RuntimeError)Z condition�err� r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/nilrt_ip.py�_assume_condition2 s �r c
C s� z3d} t td dk| � t td� t td� td dkr1t td� t td � t t� d
kd� W t S W t S tyK } zdt|�fW Y d
}~S d
}~ww )zA
Confine this module to NI Linux Real-Time based distros
z>The nilrt_ip module could not be loaded: unsupported OS familyZ os_familyZ NILinuxRTz+The python package request is not installedz+The python pyiface package is not installed�lsb_distrib_id�nilrtz-The python package pyconnman is not installedz(The python DBus package is not installed�offlinezConnman is not runningFN)
r �
__grains__r �pyiface� pyconnman�dbus�
_get_stater
�str�__virtualname__)�msg�excr r r
�__virtual__: s( �
�
����r c
C sP zt �� �d�W S ty Y dS tjy' } z tj�d| � ���d} ~ ww )z&
Returns the state of connman
�Stater zConnman daemon error: N) r �ConnManager�get_property�KeyErrorr Z
DBusException�salt�
exceptions�CommandExecutionError)r r r r
r P s ��r c
C sP d} t �� �� }|D ]\}}| d�||d |d |d dk|d dk�7 } q
| S )z-
Returns the technologies of connman
� z7{}
Name = {}
Type = {}
Powered = {}
Connected = {}
�Name�TypeZPowered� Z Connected)r r Zget_technologies�format)ZtechZtechnologies�path�paramsr r r
�_get_technologies\ s
�� r* c C s<