| Server IP : 186.64.123.29 / Your IP : 216.73.217.94 Web Server : LiteSpeed System : Linux house.hostinglat.cl 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64 User : tuemp9827 ( 1016) PHP Version : 8.1.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3/dist-packages/sos/report/plugins/__pycache__/ |
Upload File : |
o
O6uf� � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlZddlZddl Z ddl
Z
ddlmZ ddlm
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlmZmZ dd� Z d d
� Z!dd� Z"e�#d
ej$�Z%dZ&G dd� de'�Z(G dd� de'�Z)G dd� d�Z*G dd� d�Z+G dd� d�Z,G dd� de,�Z-G dd� de,�Z.G dd� de,�Z/G dd � d e,�Z0G d!d"� d"e,�Z1G d#d$� d$e,�Z2G d%d&� d&e,�Z3G d'd(� d(e,�Z4G d)d*� d*e,�Z5d-d+d,�Z6dS ).z; This exports methods available for use by plugins for sos � N)�time)�datetime)�sos_get_command_output�
import_module�grep�fileobj�tail�
is_executable�TIMEOUT_DEFAULT�path_exists�
path_isdir�path_isfile�path_islink�listdir� path_join�bold�file_is_binary�recursive_dict_values_by_key)�P_FILE�P_LINKc C s\ z"t |��}t�| |�� tj�W d � W S 1 sw Y W dS ty- g Y S w )z=Return a list of all non overlapping matches in the string(s)N)r �re�findall�read� MULTILINE�AttributeError)�regex�fname�f� r �=/usr/lib/python3/dist-packages/sos/report/plugins/__init__.py�
regex_findall% s
(��r c C s@ t �dd| �}t �dd|�}t �dd|��d�}|d|� }|S ) Nz^/(usr/|)(bin|sbin)/� z[^\w\-\.\/]+�_�/�.z ._-r )r �sub�strip)�command�name_max�manglednamer r r �_mangle_command. s
r* c C sL t jdft jdft jdft jdfg}|D ]}|d | j�r#|d S qdS )z� return a string indicating the type of special node represented by
the stat buffer st (block, character, fifo, socket).
zblock devicezcharacter devicez
named pipe�socketr � r! )�stat�S_ISBLK�S_ISCHR�S_ISFIFO�S_ISSOCK�st_mode)�st�_types�tr r r �
_node_type6 s ��r6 z!----(?:-| )BEGIN.*?----(?:-| )ENDz
-----SCRUBBEDc @ s� e Zd ZdZdZdZg Zg Zg Zg Z g Z
d%dd�Zdd� Zd d
� Z
dd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd� Zdd � Zd!d"� Zdg g g g g i fd#d$�ZdS )&�SoSPredicatea� A class to implement collection predicates.
A predicate gates the collection of data by an sos plugin. For any
`add_cmd_output()`, `add_copy_spec()` or `add_journal()` call, the
passed predicate will be evaulated and collection will proceed if
the result is `True`, and not otherwise.
Predicates may be used to control conditional data collection
without the need for explicit conditional blocks in plugins.
:param owner: The ``Plugin`` object creating the predicate
:type owner: ``Plugin``
:param dry_run: Is sos running in dry_run mode?
:type dry_run: ``bool``
:param kmods: Kernel module name(s) to check presence of
:type kmods: ``list``, or ``str`` of single name
:param services: Service name(s) to check if running
:type services: ``list``, or ``str`` of single name
:param packages: Package name(s) to check presence of
:type packages: ``list``, or ``str`` of single name
:param cmd_outputs: Command to run, with output string to check
:type cmd_outputs: ``list`` of ``dict``s, or single ``dict`` taking form
{'cmd': <command to run>,
'output': <string that output should contain>}
:param arch: Architecture(s) that the local system is matched
against
:type arch: ``list``, or ``str`` of single architecture
:param required: For each parameter provided, should the checks
require all items, no items, or any items provided
:type required: ``dict``, with keys matching parameter names and values
being either 'any', 'all', or 'none. Default 'any'.
NFr! c
s d� d| j � d�}| j}|r� fdd�|D �n|}|dd�|�� d�7 }| j}|r2� fd d�|D �n|}|d
d�|�� d�7 }| j}|rM� fdd�|D �n|}|dd�|�� d�7 }� fd
d�| jD �}|dd�|�� d�7 }| j} |r}� fdd�| D �n| } |dd�| �� d�7 }|| | S )zxReturn a string representation of this SoSPredicate with
optional prefix, suffix and value quoting.
z"%s"zdry_run=�, c � g | ]}� | �qS r r )�.0�k��quotesr r �
<listcomp>� � z&SoSPredicate.__str.<locals>.<listcomp>zkmods=[�,z], c r9 r r )r: �sr<