509318396
Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­Â�Â­
<!DOCTYPE html>
<html>
3
UˆŠZz!  ã               @   sf  d dl Z d dlZd dl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
 d dlmZ yd dlZW n ek
rŠ   d dljZY nX d dlZejdd	d
�Zeedƒs´e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 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�gZG dd „ d eƒZ d!d"„ Z!dS )#é    N)ÚOption)ÚOptionParser)ÚSSL)Úcrypto)Úrpclib)Ússtrzrhn-client-toolsT)ZfallbackÚugettext)Úconfig)Úup2dateAuth)Úup2dateErrors)Ú
up2dateLog)Úup2dateUtils)ÚpkgUtilsz-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 proxyc               @   sl   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
dd„ Zedd„ ƒZedd„ ƒZdS )ÚRhnClic             C   s(   t ttjƒ d�| _d | _d | _d| _d S )N)Zoption_listÚversionF)r   Ú_optionsTabler   Ú_RhnCli__versionStringÚ	optparserÚoptionsÚargsÚhasGui)Úself© r   ú/usr/lib/python3.6/rhncli.pyÚ__init__O   s
    zRhnCli.__init__c             C   sî  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k
r˜   tjjt	t
dƒtjƒ d  ƒƒ tjdƒ Y �nR tjk
�r   tjƒ d }|d ksÎtt|ƒƒdkrätjjt	t
dƒƒƒ ntjjt	t
dƒ| ƒƒ Y �nè tk
�rB   tjjt	t
dƒtjƒ d  ƒƒ tjdƒ Y �n¨ tjk
�r˜   tjjt	t
dƒtjƒ d  ƒƒ tjjt	t
d	ƒƒƒ tjdƒ Y �nR tjtjfk
�rà   tjjt	d
ttjƒ d ƒ ƒƒ tjdƒ Y �n
 tjk
�r   tjjt	t
dƒtjƒ d  ƒƒ Y nÔ tk
�r,   ‚ Y n¾ tjk
�rl   tjjt	t
dƒtjƒ d  ƒƒ tjdƒ Y n~ tjk
�r¨   tjj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$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 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OpenSSL.SSL.SysCallError: %s
é   z!There was a SSL crypto error: %s
z&There was an authentication error: %s
z%s
zXMLRPC ProtocolError: %s
é   )ÚexceptionHandlerÚsysÚ
excepthookÚ
initializeÚexitÚmainÚKeyboardInterruptÚstderrÚwriter   Ú_ÚOSErrorÚexc_infor   ZMalformedURIErrorÚlenÚstrÚIOErrorr   ÚErrorZSysCallErrorÚsocketÚerrorr   Ú
SystemExitr   ÚAuthenticationErrorZRpmErrorÚ	xmlrpclibZProtocolError)r   Úer   r   r   ÚrunX   sL        $  z
RhnCli.runc             C   s^   | j jƒ \| _| _tj| jjƒ tjƒ dkrRt	dƒt
jd  }| j|ƒ t
jdƒ | 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&   Ú_RhnCli__updateProxyConfig)r   ZrootWarningMsgr   r   r   r%   „   s    

zRhnCli.initializec             C   s   t ‚d S )N)ÚNotImplementedError)r   r   r   r   r'   ‘   s    zRhnCli.mainc             C   s€   yt jƒ  dS  tjk
r2   ttjƒ d ƒ dS  tjk
rF   dS  tjk
rz   t	j
ƒ }|jdƒ |jtjƒ Ž  dS X d S )NTr   Fz4There was a RhnServerException while testing login:
)r
   ZupdateLoginInfor   ZServerCapabilityErrorÚprintr#   r-   r5   ZRhnServerExceptionr   ÚinitLogZlog_meÚlog_exception)r   Úlogr   r   r   Ú_testRhnLogin”   s    
zRhnCli._testRhnLoginc          	   C   sP   | j rDyddlm} |j|ƒ W qL   ttdƒƒ t|ƒ Y qLX nt|ƒ d S )Nr   )Úguiz'Unable to open gui. Try `up2date --nox`)r   Úup2date_clientrG   ÚerrorWindowrB   r+   )r   ÚmessagerG   r   r   r   r?   £   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 )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	httpProxyZenableProxyr   Ú	proxyUserZenableProxyAuthÚproxyPasswordN)r	   ÚinitUp2dateConfigr   ÚproxyÚsetrK   rL   )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	   rM   Zsave)r   rP   r   r   r   Ú
saveConfig¿   s    zRhnCli.saveConfigc          	   C   sP   | j rDyddlm} |j|ƒ W qL   ttdƒƒ t|ƒ Y qLX nt|ƒ d S )Nr   )rG   z'Unable to open gui. Try `up2date --nox`)r   rH   rG   rI   rB   r+   )r   ZerrMsgrG   r   r   r   Z__faultErrorÆ   s    zRhnCli.__faultErrorc              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   s0   t jƒ }|d |  |d< |d dkr,tjƒ  d S )NÚdebugr    )r	   rM   r   ZsetDebugVerbosity)ÚlevelrP   r   r   r   Z__setDebugLevelØ   s    zRhnCli.__setDebugLevelN)Ú__name__Ú
__module__Ú__qualname__r   r8   r%   r'   rF   r?   r@   rQ   Z_RhnCli__faultErrorÚstaticmethodr   r:   r   r   r   r   r   M   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   rC   r#   r)   r*   r   r+   ÚhasattrrY   rD   r/   )ÚtypeÚvalueÚtbrE   r   r   r   r"   à   s    
r"   )"r#   r<   r2   Zoptparser   r   ZOpenSSLr   r   Zrhnr   Zrhn.i18nr   r6   ÚImportErrorZxmlrpc.clientZclientÚgettextZtranslationÚtrZ   r   r+   rH   r	   r
   r   r   r   r   r   Úobjectr   r"   r   r   r   r   Ú<module>"   sD   




 