Edit File: rhncli.cpython-36.pyc
3 ��cw$������������������@���sv��d�dl�Z�d�dlZd�dlZd�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�d�dl m Z �d�dlmZ�yd�dl Z W�n�ek r����d�dljZ Y�nX�d�dlZejdd d �Zeed�s�eje_ejZd�dlmZ�d�d lmZ�d�dlmZ�d�dlmZ�d�dlmZ�d�dlmZ�edddd�ed�d�edded�d�edded�d�edded�d�edd ed!�d�gZG�d"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)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���������������@���st���e�Zd�Zdd��Zdd��Zdd��Zdd��Zd d ��Zdd��Zd d��Z dd��Z dd��Zdd��Ze dd���Ze dd���ZdS�)�RhnClic�������������C���s(���t�ttj��d�|�_d�|�_d�|�_d|�_d�S�)N)Zoption_list�versionF)r���� _optionsTabler����_RhnCli__versionString� optparser�options�args�hasGui)�self��r����/usr/lib/python3.6/rhncli.py�__init__Q���s ����zRhnCli.__init__c�������������C���s���t�t_y |�j���tj|�j��pd��W��n��tk rZ���tjjt t d����tjd��Y��n��tk r����tjjt t d�tj��d�����tjd��Y��nR�t jk �r���tj��d�}|d�ks�tt|��dkr�tjjt t d����ntjjt t d�|����Y��n��tk �rB���tjjt t d�tj��d�����tjd��Y��n��tjk �r����tjjt t d�tj��d�����tjjt t d ����tjd��Y��nR�tjtjfk �r����tjjt d ttj��d������tjd��Y��n �tjk �r���tjjt t d�tj��d�����Y�n��tk �r,�����Y�n��tjk �rl���tjjt t d �tj��d�����tjd��Y�n~�tjk �r����tjjt dtj��d�����tjd��Y�nB�tjk �r����tjjt dttj��d������tjd��Y�nX�d�S�)Nr���z 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_infor���ZMalformedURIError�len�str�IOErrorr����ErrorZSysCallError�socket�errorr���� SystemExitr����AuthenticationErrorZRpmError� xmlrpclibZ ProtocolError)r����er���r���r����runZ���sL���� $ z RhnCli.runc�������������C���sn���|�j�j��\|�_|�_tj|�jj��tj��dkrRt d�t jd��}|�j|��t j d��|�jjrb|�j���|�j���d�S�)Nr���zYou 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���ZrootWarningMsgr���r���r���r&�������s���� zRhnCli.initializec�������������C���s���t��d�S�)N)�NotImplementedError)r���r���r���r���r(�������s����zRhnCli.mainc�������������C���sx���ddl�}yddlm}�W�n �tk r8���ddlm}�Y�nX�d|_|j���|j��j|j ��|jd�}|j|j ��d|_ dS�)zF Enables logging of all all https requests to console r���N)�HTTPConnectionr ���zrequests.packages.urllib3T)�loggingZhttp.clientrE����ImportErrorZhttplibZ debuglevelZbasicConfigZ getLoggerZsetLevel�DEBUGZ propagate)r���rF���rE���Zrequests_logr���r���r���rB�������s���� z%RhnCli._initialize_debug_network_logsc�������������C���s����yt�j���dS��tjk r2���ttj��d���dS��tjk rF���dS��tjk rz���t j ��}|jd��|jtj�����dS�X�d�S�)NTr ���Fz4There was a RhnServerException while testing login: ) r ���ZupdateLoginInfor���ZServerCapabilityError�printr$���r.���r6���ZRhnServerExceptionr����initLogZlog_me� log_exception)r����logr���r���r���� _testRhnLogin����s���� zRhnCli._testRhnLoginc���������� ���C���sP���|�j�rDyddlm}�|j|��W�qL���ttd���t|��Y�qLX�nt|��d�S�)Nr���)�guiz'Unable to open gui. Try `up2date --nox`)r����up2date_clientrN����errorWindowrI���r,���)r����messagerN���r���r���r���r@�������s����zRhnCli._warning_dialogc�������������C���sx���t�j��}|�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�setrR���rS���)r����cfgr���r���r���Z__updateProxyConfig����s����zRhnCli.__updateProxyConfigc�������������C���s���t�j��}|j���dS�)zM Saves the current up2date configuration being used to disk. N)r ���rT���Zsave)r���rW���r���r���r���� saveConfig����s����zRhnCli.saveConfigc���������� ���C���sP���|�j�rDyddlm}�|j|��W�qL���ttd���t|��Y�qLX�nt|��d�S�)Nr���)rN���z'Unable to open gui. Try `up2date --nox`)r���rO���rN���rP���rI���r,���)r���ZerrMsgrN���r���r���r���Z__faultError����s����zRhnCli.__faultErrorc��������������C���s���t�d�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 versionStringr���r���r���Z__versionString����s���� zRhnCli.__versionStringc�������������C���s0���t�j��}|d�|��|d<�|d�dkr,tj���d�S�)NrA���r!���)r ���rT���r���ZsetDebugVerbosity)�levelrW���r���r���r���Z__setDebugLevel����s����zRhnCli.__setDebugLevelN)�__name__� __module__�__qualname__r���r9���r&���r(���rB���rM���r@���rC���rX���Z_RhnCli__faultError�staticmethodr���r;���r���r���r���r���r���O���s��� ,r���c�������������C���s����t�j��}tjjttd�d����t|d�rPtjjt|j�d���|j |�||��n&tjjtt |��d����|j |�||��tjjttd�d����d�S�)NzAn error has occurred:� �errmsgz)See /var/log/up2date for more information)r���rJ���r$���r*���r+���r���r,����hasattrr_���rK���r0���)�type�value�tbrL���r���r���r���r#�������s���� r#���)"r$���r=���r3���Zoptparser���r���ZOpenSSLr���r���Zrhnr���Zrhn.i18nr���r7���rG���Z xmlrpc.clientZclient�gettextZtranslation�tr`���r���r,���rO���r ���r ���r���r���r ���r���r����objectr���r#���r���r���r���r����<module>"���sH��� �)