🔐 Sid Gifari File Manager Pro
v8.0.5 | 2026-08-07 16:29:30 | PHP 8.2.32
📂
/ (Root)
/
usr
/
lib
/
python3.6
/
site-packages
/
sos
/
upload
/
targets
/
__pycache__
📍 /usr/lib/python3.6/site-packages/sos/upload/targets/__pycache__
🔄 Refresh
✏️
Editing: redhat.cpython-36.pyc
Read Only
3 ��'j�( � @ s� d dl Z d dlZd dlmZ d dlmZmZ d dlmZ d dl m Z d dlmZ yd dlZdZW n ek rx dZY nX G d d � d e�ZdS )� N)�UploadTarget)� convert_bytes�TIMEOUT_DEFAULT)�DeviceAuthorizationClass)� RHELPolicy)�_sosTFc s� e Zd ZdZdZdZdZd'� fdd� ZdZd Z e Z d ZdZdZ dd � Z� fdd�Zdd� Zdd� Zdd� Zdd� Zd(dd�Zdd� Zdd� Zdd � Zd)� fd!d"� Zd#d$� Z� fd%d&�Z� ZS )*�RHELUploadTargetzVhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/auth/devicezPhttps://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/tokenzRed Hat Upload TargetZredhatNc s t � j|||d� d S )N)�parser�args�cmdline)�super�__init__)�selfr r r )� __class__� �/usr/lib/python3.6/redhat.pyr ! s zRHELUploadTarget.__init__zhttps://api.access.redhat.comzsftp://sftp.access.redhat.com�posti @c C s t | jd t�S )z.Return true if we are running in a RHEL systemZpolicy)� isinstance�commonsr )r r r r �check_distribution- s z#RHELUploadTarget.check_distributionc s t � j|� | jd j| _d S )N�cmdlineopts)r �pre_workr �upload_directory)r Zhook_commons)r r r r 1 s zRHELUploadTarget.pre_workc C s@ | j d jr| jjtd�� | j d js<| j| _| jjd� d S )Nr zVThe option --upload-user has been deprecated in favour of device authorization in RHELz&No case id provided, uploading to SFTP)r Zupload_user�ui_log�info�_�case_id�RH_SFTP_HOST� upload_url)r r r r �prompt_for_upload_user7 s z'RHELUploadTarget.prompt_for_upload_userc C s | j d jr| jjtd�� d S )Nr zVThe option --upload-pass has been deprecated in favour of device authorization in RHEL)r Zupload_passr r r )r r r r �prompt_for_upload_passwordB s z+RHELUploadTarget.prompt_for_upload_passwordc C s� d| j d j� d�}yP| jr"| jS | j d jr:| j d jS | j d jdkrP| jS | j d jsb| jS W n4 tk r� } z| jjd|� �� W Y d d }~X nX | j� |� �S )Nz/support/v1/cases/r z/attachmentsZsftpz=There was a problem while setting the remote upload target: ) r r r Zupload_protocolr � Exceptionr r �RH_API_HOST)r Zrh_case_api�er r r �get_upload_urlJ s zRHELUploadTarget.get_upload_urlc C s d| j � �}d|iS )NzBearer Z Authorization)� _device_token)r Zstr_authr r r �_get_upload_https_auth^ s z'RHELUploadTarget._get_upload_https_authTc C sh d|j jd�d || j� fi}t| j| j�}|j� | _| jj d| j � � �� tj| j � || j� |td�S )z�If upload_https() needs to use requests.post(), use this method. Policies should override this method instead of the base upload_https() :param archive: The open archive file object �file�/� z/Device authorized correctly. Uploading file to )�files�headers�verify�timeout���)�name�split�_get_upload_headersr �client_identifier_url�token_endpoint�get_access_tokenr% r r �get_upload_url_string�requestsr r$ r&