| Current Path : /lib/fm-agent/library/__pycache__/ |
| Current File : //lib/fm-agent/library/__pycache__/container_discovery.cpython-36.pyc |
3 q��i- � @ sP d dl Z d dlZd dlZd dlmZmZ e jd�Zdd� Z ddd�Z d d � ZdS )� N)�UnixHTTPConnection� json_loadsZ Containersc C sR t jjd�sdS y(td�} | jddddid� | j� W n tk rL dS X d S ) Nz/var/run/docker.sockz no-docker�GETz/containers/json�Host� localhost)�headersz no-permission�success)�os�path�existsr �request�getresponse� Exception)�conn� r �0/usr/lib/fm-agent/library/container_discovery.py�check_access s r Fc C s t d�}|jddddid� |j� j� }t|�}t|�s<g S i }| jd�rx| jd�}x"|D ]\} } |j| g �j | � qZW g }�x�|D �]|}|d d d � } |d }|j | �}| r�|dkr�q�|r�| r�|d |d k}|j|� |r�d|d <