????

Your IP : 3.144.40.238


Current Path : /lib/python3.6/site-packages/up2date_client/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/up2date_client/__pycache__/rhncli.cpython-36.pyc

3

@4�fw$�@svddlZddlZddlZddlmZddlmZddlmZddlmZddl	m
Z
ddlmZyddl
Z
Wnek
r�ddljZ
YnXddlZejdd	d
�Zeed�s�eje_ejZddlmZdd
lmZddlmZddlmZddlmZddlmZedddded�d�edded�d�edded�d�edded�d�edd ed!�d�gZGd"d#�d#e�Z d$d%�Z!dS)&�N)�Option)�OptionParser)�SSL)�crypto)�rpclib)�sstrzrhn-client-toolsT)Zfallback�ugettext)�config)�up2dateAuth)�
up2dateErrors)�
up2dateLog)�up2dateUtils)�pkgUtilsz-vz	--verbose�countzShow additional output)�action�default�helpz--proxyZstorezSpecify an http proxy to use)rrz--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@steZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Ze
dd��Ze
dd��ZdS)�RhnClicCs(tttj�d�|_d|_d|_d|_dS)N)Zoption_list�versionF)r�
_optionsTabler�_RhnCli__versionString�	optparser�options�args�hasGui)�self�r�/usr/lib/python3.6/rhncli.py�__init__Qs
zRhnCli.__init__cCs�tt_y |j�tj|j�pd�W�n�tk
rZtjjt	t
d���tjd�Y�n�tk
r�tjjt	t
d�tj�d��tjd�Y�nRt
jk
�rtj�d}|dks�tt|��dkr�tjjt	t
d���ntjjt	t
d�|��Y�n�tk
�rBtjjt	t
d�tj�d��tjd�Y�n�tjk
�r�tjjt	t
d�tj�d��tjjt	t
d	���tjd�Y�nRtjtjfk
�r�tjjt	d
ttj�d���tjd�Y�n
tjk
�rtjjt	t
d�tj�d��Yn�tk
�r,�Yn�tjk
�rltjjt	t
d
�tj�d��tjd�Yn~tjk
�r�tjjt	dtj�d��tjd�YnBtjk
�r�tjjt	dttj�d���tjd�YnXdS)Nrz

Aborted.
�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
zThere 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.
zOpenSSL.SSL.SysCallError: %s
�z!There was a SSL crypto error: %s
z&There was an authentication error: %s
z%s
zXMLRPC ProtocolError: %s
�)�exceptionHandler�sys�
excepthook�
initialize�exit�main�KeyboardInterrupt�stderr�writer�_�OSError�exc_inforZMalformedURIError�len�str�IOErrorr�ErrorZSysCallError�socket�errorr�
SystemExitr�AuthenticationErrorZRpmError�	xmlrpclibZ
ProtocolError)r�errr�runZsL    $  z
RhnCli.runcCsn|jj�\|_|_tj|jj�tj�dkrRt	d�t
jd}|j|�t
j
d�|jjrb|j�|j�dS)NrzYou must be root to run %sr )r�
parse_argsrrr�_RhnCli__setDebugLevel�verbose�os�geteuidr,r$�argv�_warning_dialogr'�debug�_initialize_debug_network_logs�_RhnCli__updateProxyConfig)rZrootWarningMsgrrrr&�s

zRhnCli.initializecCst�dS)N)�NotImplementedError)rrrrr(�szRhnCli.maincCsxddl}yddlm}Wn tk
r8ddlm}YnXd|_|j�|j�j|j	�|jd�}|j|j	�d|_
dS)zF
        Enables logging of all all https requests to console
        rN)�HTTPConnectionr zrequests.packages.urllib3T)�loggingZhttp.clientrE�ImportErrorZhttplibZ
debuglevelZbasicConfigZ	getLoggerZsetLevel�DEBUGZ	propagate)rrFrEZrequests_logrrrrB�s
z%RhnCli._initialize_debug_network_logscCs�ytj�dStjk
r2ttj�d�dStjk
rFdStjk
rzt	j
�}|jd�|jtj��dSXdS)NTr Fz4There was a RhnServerException while testing login:
)
r
ZupdateLoginInforZServerCapabilityError�printr$r.r6ZRhnServerExceptionr�initLogZlog_me�
log_exception)r�logrrr�
_testRhnLogin�s
zRhnCli._testRhnLoginc	CsP|jrDyddlm}|j|�WqLttd��t|�YqLXnt|�dS)Nr)�guiz'Unable to open gui. Try `up2date --nox`)r�up2date_clientrN�errorWindowrIr,)r�messagerNrrrr@�szRhnCli._warning_dialogcCsxtj�}|jjr,|jd|jj�|jdd�|jjrP|jd|jj�|jdd�|jjrt|jd|jj�|jdd�dS)z�Update 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	httpProxyZenableProxyr �	proxyUserZenableProxyAuth�
proxyPasswordN)r	�initUp2dateConfigr�proxy�setrRrS)r�cfgrrrZ__updateProxyConfig�szRhnCli.__updateProxyConfigcCstj�}|j�dS)zM
        Saves the current up2date configuration being used to disk.
        N)r	rTZsave)rrWrrr�
saveConfig�szRhnCli.saveConfigc	CsP|jrDyddlm}|j|�WqLttd��t|�YqLXnt|�dS)Nr)rNz'Unable to open gui. Try `up2date --nox`)rrOrNrPrIr,)rZerrMsgrNrrrZ__faultError�szRhnCli.__faultErrorcCstd�tj�}|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
versionStringrrrZ__versionString�s
zRhnCli.__versionStringcCs0tj�}|d||d<|ddkr,tj�dS)NrAr!)r	rTrZsetDebugVerbosity)�levelrWrrrZ__setDebugLevel�szRhnCli.__setDebugLevelN)�__name__�
__module__�__qualname__rr9r&r(rBrMr@rCrXZ_RhnCli__faultError�staticmethodrr;rrrrrOs	,rcCs�tj�}tjjttd�d��t|d�rPtjjt|j�d�|j	|||�n&tjjtt
|�d��|j	|||�tjjttd�d��dS)NzAn error has occurred:�
�errmsgz)See /var/log/up2date for more information)rrJr$r*r+rr,�hasattrr_rKr0)�type�value�tbrLrrrr#�s
r#)"r$r=r3ZoptparserrZOpenSSLrrZrhnrZrhn.i18nrr7rGZ
xmlrpc.clientZclient�gettextZtranslation�tr`rr,rOr	r
rrr
rr�objectrr#rrrr�<module>"sH





)