3 `g@sddlmZddlmZddlmZddlmZddlmZddlZejddd Ze ed sdeje_ ej Z Gd d d Z Gd ddZ dddZgZdadddZddZddZddZdS)) up2dateAuth) up2dateLog) up2dateErrors)config) rhnserverNzrhn-client-toolsT)Zfallbackugettextc@sDeZdZddZddZddZddZd d Zd d Zd dZ dS) rhnChannelcKs*i|_x|jD]}|||j|<qWdS)N)dictkeys)selfkwargskwr /usr/lib/python3.6/rhnChannel.py__init__szrhnChannel.__init__cCs |j|S)N)r )r itemrrr __getitem__szrhnChannel.__getitem__cCs||j|<dS)N)r )r rvaluerrr __setitem__szrhnChannel.__setitem__cCs|jd|jdkS)Nname)r )r otherrrr__lt__!szrhnChannel.__lt__cCs |jjS)N)r r )r rrrr $szrhnChannel.keyscCs |jjS)N)r values)r rrrr'szrhnChannel.valuescCs |jjS)N)r items)r rrrr*szrhnChannel.itemsN) __name__ __module__ __qualname__rrrrr rrrrrrrsrc@s<eZdZddZddZddZddZd d Zd d Zd S)rhnChannelListcCs g|_dS)N)list)r rrrr.szrhnChannelList.__init__cCs|jj|dS)N)rappend)r channelrrr addChannel3szrhnChannelList.addChannelcCs|jS)N)r)r rrrchannels7szrhnChannelList.channelscCs$x|jD]}|d|kr|SqWdS)Nlabel)r)r channelnamer rrr getByLabel:s  zrhnChannelList.getByLabelcCs |j|S)N)r%)r r$rrr getByName>szrhnChannelList.getByNamecCs.g}x$|jD]}|d|kr |j|q W|S)Ntype)rr)r r'r"r rrr getByTypeAs   zrhnChannelList.getByTypeN) rrrrr!r"r%r&r(rrrrr-s rcCsdg}t|d}xP|jD]D}|ddkrR|d|d<d|d|d|df|d<|j|qW|S) N)timeoutr'up2dater#rz%s channel %s from %surl description) getChannelsr"r)r)r"ZsourceChannelsZ sourceChannelrrrgetChannelDetailsKs   r.c Cs:tj}tj}t o| rtatj|d}tj sFt j t d|j jtj }x|D]}|rr|d|krrq\tdtjd}x2|jD]&} | dkr|d|d<q|| || <qW|dr |d|d <|d<|d <|d <|jd |d |jd |jdtj|q\Wttjdkr6t jt dtS)zG return rhnChannelList containing list of channel we are subscribed to )r)zUnable to Locate SystemIdr#r*)r'r+Z last_modifiedversionZchannelOverriderr,Zsummaryz'WARNING: Channel overridden locally: %sz=-------: If you see this warning outside of the leapp processz$-------: contact CloudLinux support.rzEThis system may not be updated until it is associated with a channel.)rZinitUp2dateConfigrZinitLogselected_channelsrr RhnServerr getSystemIdrZNoSystemIdError_r*Z listChannelsrZgetServerlURLFromMirrorr Zlog_mer!lenrZNoChannelsError) forcelabel_whitelistr)ZcfglogsZup2dateChannelsZchanr keyrrrr-^s2   $  r-cCs dattdd|}t|dS)NcSs|dfS)Nr)xrrrszsetChannels..)r6)r0r mapr-)Z tempchannelsZ whitelistrrr setChannelssr>cCstj}|jjtj|||S)N)rr1r*subscribeChannelsrr2)r"usernamepasswdr8rrrr?sr?cCstj}|jjtj|||S)N)rr1r*unsubscribeChannelsrr2)r"r@rAr8rrrrBsrB)N)NNN)Zup2date_clientrrrrrgettextZ translationthasattrrr3rrr.Z cmdline_pkgsr0r-r>r?rBrrrrs$        (