<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
3
mi                 @   sR  d dl Z d dlZd dlmZ d dlmZ d dlZd dlmZ d dl	m
Z
 yd dlZW n ek
rr   d dljZY nX d dlZejdddZeed	seje_ejZd d
lmZ d dlmZ d dlmZ d dlmZ d dlmZ edddd eddeddeddeddeddeddeddeddeddgZG dd  d eZd!d" ZdS )#    N)Option)OptionParser)rpclib)sstrzrhn-client-toolsT)Zfallbackugettext)config)up2dateAuth)up2dateErrors)
up2dateLog)up2dateUtilsz-vz	--verbosecountzShow additional output)actiondefaulthelpz--proxyZstorezSpecify an http proxy to use)r   r   z--proxyUserz:Specify a username to use with an authenticated http proxyz--proxyPasswordz:Specify a password to use with an authenticated http proxyz--debug
store_truez&Enable debug output (network requests)c               @   sd   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
edd Zedd ZdS )RhnClic             C   s"   t ttj d| _d | _d | _d S )N)Zoption_listversion)r   _optionsTabler   _RhnCli__versionString	optparseroptionsargs)self r   /usr/lib/python3.6/rhncli.py__init__M   s    zRhnCli.__init__c             C   sB  t t_y | j  tj| j pd W n tk
rZ   tjjt	t
d tjd Y n tjjk
r } zDtjjt	t
dtj d   tjjt	t
d tjd W Y d d }~X n tk
r   tjjt	t
dtj d   tjd Y nB tjk
rh   tj d }|d ks6tt|dkrLtjjt	t
d ntjjt	t
d|  Y n tk
r   tjjt	t
d	tj d   tjd Y n tk
r    Y n tjk
r   tjjt	t
d
tj d   tjd Y nB tjk
r<   tjjt	dttj d   tjd Y nX d S )Nr   z

Aborted.
   zThere was an SSL error: %s
zqA common cause of this error is the system time being incorrect. Verify that the time on this system is correct.
z$An unexpected OS error occurred: %s
z1A connection was attempted with a malformed URI.
z5A connection was attempted with a malformed URI: %s.
z%There was some sort of I/O error: %s
z&There was an authentication error: %s
zXMLRPC ProtocolError: %s
   )exceptionHandlersys
excepthook
initializeexitmainKeyboardInterruptstderrwriter   _requests
exceptionsZSSLErrorexc_infoOSErrorr   ZMalformedURIErrorlenstrIOError
SystemExitr	   ZAuthenticationError	xmlrpclibZProtocolError)r   er   r   r   runT   s<         z
RhnCli.runc             C   sn   | j j \| _| _tj| jj tj dkrRt	dt
jd  }| j| t
jd | jjrb| j  | j  d S )Nr   zYou must be root to run %sr   )r   
parse_argsr   r   r   _RhnCli__setDebugLevelverboseosgeteuidr'   r   argv_warning_dialogr"   debug_initialize_debug_network_logs_RhnCli__updateProxyConfig)r   ZrootWarningMsgr   r   r   r!   x   s    

zRhnCli.initializec             C   s   t d S )N)NotImplementedError)r   r   r   r   r#      s    zRhnCli.mainc             C   sx   ddl }yddlm} W n  tk
r8   ddlm} Y nX d|_|j  |j j|j	 |jd}|j|j	 d|_
dS )zF
        Enables logging of all all https requests to console
        r   N)HTTPConnectionr   zrequests.packages.urllib3T)loggingZhttp.clientr>   ImportErrorZhttplibZ
debuglevelZbasicConfigZ	getLoggerZsetLevelDEBUGZ	propagate)r   r?   r>   Zrequests_logr   r   r   r;      s    
z%RhnCli._initialize_debug_network_logsc             C   s   t | d S )N)print)r   messager   r   r   r9      s    zRhnCli._warning_dialogc             C   sx   t j }| jjr,|jd| jj |jdd | jjrP|jd| jj |jdd | jjrt|jd| jj |jdd dS )zUpdate potential proxy configuration.
        Note: this will _not_ save the info to up2date's configuration file
        A separate call to config.initUp2dateConfig.save() is needed.
        Z	httpProxyZenableProxyr   	proxyUserZenableProxyAuthproxyPasswordN)r   initUp2dateConfigr   proxysetrD   rE   )r   cfgr   r   r   Z__updateProxyConfig   s    zRhnCli.__updateProxyConfigc             C   s   t j }|j  dS )zM
        Saves the current up2date configuration being used to disk.
        N)r   rF   Zsave)r   rI   r   r   r   
saveConfig   s    zRhnCli.saveConfigc              C   s   t dtj  } | S )Nzp%%prog (Spacewalk Client Tools) %s
Copyright (C) 1999--2014 Red Hat, Inc.
Licensed under the terms of the GPLv2.)r'   r   r   )ZversionStringr   r   r   Z__versionString   s    
zRhnCli.__versionStringc             C   s   t j }|d |  |d< d S )Nr:   )r   rF   )levelrI   r   r   r   Z__setDebugLevel   s    zRhnCli.__setDebugLevelN)__name__
__module____qualname__r   r2   r!   r#   r;   r9   r<   rJ   staticmethodr   r4   r   r   r   r   r   K   s   $r   c             C   s   t j }tjjttdd  t|drPtjjt|jd  |j	| || n&tjjtt
| d  |j	| || tjjttdd  d S )NzAn error has occurred:
errmsgz)See /var/log/up2date for more information)r
   ZinitLogr   r%   r&   r   r'   hasattrrQ   Zlog_exceptionr-   )typevaluetblogr   r   r   r      s    
r   )r   r6   Zoptparser   r   Zrequests.exceptionsr(   Zrhnr   Zrhn.i18nr   r0   r@   Zxmlrpc.clientZclientgettextZtranslationtrR   r   r'   Zup2date_clientr   r   r	   r
   r   r   objectr   r   r   r   r   r   <module>"   s@   





z