관리-도구
편집 파일: utils.cpython-37.pyc
B � dJ8 � @ s� d Z ddlZddlZddlZddlZddlZddlZddlm m Z ddlmZ ddl mZ ddlmZmZ ddlmZ ddlmZmZmZmZmZmZmZ ddlmZmZ dd lmZ ddlZdd l m!Z! ddl"m#Z# ddl$m%Z% dd l&m'Z' ddl(m)Z) ddl*m+Z+m,Z, ddl-m.Z. ddl/m0Z0 e�1d�Z2edddg�Z3e4e3d�dd�Z5dd�dd�Z6dVe4e7e4d�dd �Z8e4e4d!�d"d#�Z9e4d$d%�d&d'�Z:e4d�d(d)�Z;dWe4e4d+�d,d-�Z<e4d�d.d/�Z=e>e?d0�d1d2�Z@e4ee4 d3�d4d5�ZAee4 d�d6d7�ZBee4 d�d8d9�ZCe7d�d:d;�ZDe7d�d<d=�ZEe7d�d>d?�ZFe7dd@�dAdB�ZGe7d�dCdD�ZHe4d�dEdF�ZIe4ee4ef e7dG�dHdI�ZJdJdK� ZKedXe>ddL�dMdN��ZLedYe>e>e>ddQ�dRdS��ZMdPZNdTdU� ZOdS )Zz> This module contains helpful utility functions for SSA Agent � N)� namedtuple)�contextmanager)�date� timedelta)�LooseVersion)�socket�fromfd�AF_UNIX�SOCK_STREAM�AF_INET�AF_INET6� SOCK_DGRAM)�Optional�Union)�urlparse)�AtexitIntegration)�LoggingIntegration)�Feature)�is_panel_feature_supported)�get_kmodlve_module_version)�is_cl_solo_edition�is_container� )� sentry_dsn)�SSAErrorZutils�URLZdomain_nameZuri_path)�url�returnc C sJ t | �}|jrd|j� �nd}|jr2|j� |� �nd}t|j�dd�|�S )z� Split URL into domain_name and uripath including query string :param url: URL of format protocol://domain/path;parameters?query#fragment :return: namedtuple URL(domain_name, uripath) �?� �/zwww.)r Zquery�pathr Znetloc�replace)r Z fragmentsZqsZuri� r# �C/opt/alt/python37/lib/python3.7/site-packages/ssa/internal/utils.py� url_split0 s r% )r c s� t t t d�dd�} dd� � � fdd�}dd �d d�}ttjtjd�}t|d �}tjt| d||gd� t� � �}d|� i|_ W dQ R X dS )u� Initialize Sentry client shutdown_timeout=0 disables Atexit integration as stated in docs: 'it’s easier to disable it by setting the shutdown_timeout to 0' https://docs.sentry.io/platforms/python/default-integrations/#atexit On the other hand, docs say, that 'Setting this value too low will most likely cause problems for sending events from command line applications' https://docs.sentry.io/error-reporting/configuration/?platform=python#shutdown-timeout )�event�hintr c S s | d � ddi� | S )z� Add extra data into sentry event :param event: original event :param hint: additional data caught :return: updated event �extrazssa.versionz 0.3-9.el8)�update)r&