Current File : //usr/lib/python3/dist-packages/sos/collector/transports/__pycache__/__init__.cpython-312.pyc |
�
-�_g A � �` � d dl Z d dlZd dlZd dlmZ d dlZd dlmZmZ d dl m
Z
G d� d� Zy)� N)�quote)�ConnectionException�CommandTimeoutException)�boldc � � e Zd ZdZdZdZd� Zd� Zd� Zd� Z d� Z
ed � � Zed
� � Z
ed� � Zed� � Zed
� � Zd� Zd� Zd� Zd� Zd� Zed� � Z dd�Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Z d� Z!d� Z"y) �RemoteTransportaO The base class used for defining supported remote transports to connect
to remote nodes in conjunction with `sos collect`.
This abstraction is used to manage the backend connections to nodes so that
SoSNode() objects can be leveraged generically to connect to nodes, inspect
those nodes, and run commands on them.
� undefinedNc �� � || _ |d | _ |d | _ |d | _ d | _ t j d� | _ t j d� | _ y )N�cmdlineopts�tmpdir� need_sudo�sos�sos_ui) �address�optsr r
� _hostname�logging� getLogger�soslog�ui_log)�selfr �commonss �C/usr/lib/python3/dist-packages/sos/collector/transports/__init__.py�__init__zRemoteTransport.__init__# sX � �����M�*�� ��h�'��� ��-�������'�'��.����'�'��1��� c �4 � d}t j |d|� S )zUAttempts to obfuscate sensitive information in log messages such as
passwordsz>(?P<var>(pass|key|secret|PASS|KEY|SECRET).*?=)(?P<value>.*?\s)z\g<var>****** )�re�sub)r �msg�regs r �_sanitize_log_msgz!RemoteTransport._sanitize_log_msg, s � � P���v�v�c�,�c�2�2r c � � t j � d d }d| j � d|� d|� �}| j j |� y)z#Used to print and log info messages� � �[�:�] N)�inspect�stack�hostnamer �info�r r �caller�lmsgs r �log_infozRemoteTransport.log_info2 sE � ������#�A�&���4�=�=�/��6�(�"�S�E�2��������r c � � t j � d d }d| j � d|� d|� �}| j j |� y)z$Used to print and log error messagesr# r$ r% r&