U
    -_g                     @   s0   d dl Z d dlZd dlmZ G dd deZdS )    N)RemoteTransportc                   @   sP   e Zd ZdZdZdd Zdd Zedd Zd	d
 Z	dd Z
dd Zdd ZdS )LocalTransportz
    A 'transport' to represent a local node. No remote connection is actually
    made, and all commands set to be run by this transport are executed locally
    without any wrappers.
    Z
local_nodec                 C   s   dS NT )selfZpasswordr   r   @/usr/lib/python3/dist-packages/sos/collector/transports/local.py_connect   s    zLocalTransport._connectc                 C   s   dS r   r   r   r   r   r   _disconnect   s    zLocalTransport._disconnectc                 C   s   dS r   r   r	   r   r   r   	connected    s    zLocalTransport.connectedc                 C   s&   |  d| d|  t|| dS )NzMoving z to T)	log_debugshutilcopyr   fnamedestr   r   r   _retrieve_file$   s    zLocalTransport._retrieve_filec                 C   s   |S )Nr   )r   cmdr   r   r   _format_cmd_for_exec)   s    z#LocalTransport._format_cmd_for_execc                 C   s   dS r   r   r   r   r   r   _copy_file_to_remote,   s    z#LocalTransport._copy_file_to_remotec              
   C   sJ   t j|r6t|ddd}| W  5 Q R  S Q R X | d|  dS )Nrzutf-8)encodingzNo such file:  )ospathexistsopenreadr   )r   r   Zrfiler   r   r   
_read_file/   s
    zLocalTransport._read_fileN)__name__
__module____qualname____doc__namer   r
   propertyr   r   r   r   r   r   r   r   r   r      s   
r   )r   r   Zsos.collector.transportsr   r   r   r   r   r   <module>   s   