File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/__pycache__/adb.cpython-310.pyc
Back
o ;jF � @ sT d Z ddlZddlZddlZe�e�ZdZi Z ddd�Z dd� Zdd � Zd d� Z dS )zY Beacon to emit adb device state changes for Android devices .. versionadded:: 2016.3.0 � N�adbF)�value� no_devicesc C s4 t jj�d�} | d u rd}t�dt|� d|fS tS )Nr zadb is missing.zUnable to load %s beacon: %sF)�salt�utils�path�which�log�error�__virtualname__)Zwhich_result�err_msg� r �D/opt/saltstack/salt/lib/python3.10/site-packages/salt/beacons/adb.py�__virtual__ s r c s� t | t�st�d� dS tjj�| �} d| vrt�d� dS t | d t�s,t�d� dS g d�� t� fdd�| d D ��rPt�d d � � �� dd� d � � ��fS d S )z+ Validate the beacon configuration �,Configuration for adb beacon must be a list.)Fr �states�9Configuration for adb beacon must include a states array.)Fr ) ZofflineZ bootloader�device�hostZrecoveryzno permissionsZsideloadZunauthorized�unknown�missingc 3 s � | ]}|� vV qd S )Nr )�.0�s�r r r � <genexpr>= s � zvalidate.<locals>.<genexpr>z*Need a one of the following adb states: %sz, Fz*Need a one of the following adb states: {})TzValid beacon configuration)� isinstance�listr �infor r �beacons�list_to_dict�any�join�format)�configr r r �validate s* ���r$ c C s( t �d� g }tjj�| �} td d| �dd�d�}|�d�dd� }t t �� �}g }|D ]�}z�|�d �\}}|�|� ||vsNd t | v rct | d |krc|| d v rc|�|||d�� d |it |<