404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@18.222.167.85: ~ $
3

%T�f�6�@sfddlmZddlmZddlmZmZddlZddlZddlZddl	Z	ddl
Z
ddlZddlmZddl
mZddlZddlZddlZddlZddlmZddlmZd	Zed
�Zed�Zed�Zed
�Zed�Zed�Zed�Zed�Zed�Z ed�Z!ed�Z"ed�Z#ed�Z$Gdd�dej%�Z&Gdd�dej'j(�Z)dd�Z*Gdd�de+�Z,dd �Z-d!d"�Z.dS)#�)�absolute_import)�unicode_literals)�_�loggerN)�copy)�PRIO_PLUGINCONFIG)�ustr)�
up2dateErrorsz_spacewalk.jsonz7CloudLinux Network based repositories will be disabled.z4CloudLinux Network channel support will be disabled.z@There was an error communicating with CloudLinux Network server.z=This system is not registered with CloudLinux Network server.z.This system is not subscribed to any channels.zSystemId could not be acquired.z%You can use rhn_register to register.z@This system is receiving updates from CloudLinux Network server.z�For security reasons packages from CloudLinux Network based repositories can be verified only with locally installed gpg keys. GPG key '%s' has been rejected.z.Package profile information could not be sent.z=Missing required login information for CloudLinux Network: %sz'Leapp upgrade is running - using cache.z>Spacewalk plugin has to be run under with the root privileges.csZeZdZdZ�fdd�Zdd�Zdd�Zdd	d
�Zdd�Zd
d�Z	dd�Z
dd�Z�ZS)�	SpacewalkZ	spacewalkcs�tt|�j||�||_||_tjj|jjj	t
�|_d|_i|_
t|jj�|_|j|j�|_d|jj�kr�|jjd�}x |D]\}}|jj||t�q|Wtjj�s�tjt�d|j_|jjs�dStjd�|j�dS)NF�mainzinitialized Spacewalk plugin)�superr
�__init__�base�cli�os�path�join�confZ
persistdir�STORED_CHANNELS_NAME�stored_channels_path�connected_to_spacewalk�up2date_cfgrZread_config�parser�sections�items�
_set_valuer�dnf�utilZ	am_i_rootr�warning�MUST_BE_ROOT�enabled�debug�activate_channels)�selfrr�options�key�value)�	__class__��/usr/lib/python3.6/spacewalk.pyr
;s(


zSpacewalk.__init__cCs|jjsdSd|jj_dS)NT)rr rZdemandsZ	root_user)r#r(r(r)�configRszSpacewalk.configcCstjd�dS)Nz$/usr/sbin/clnreg_ks --strict-edition)r�system)r#r(r(r)�clnregWszSpacewalk.clnregTcCs�i}d}d}d}d}|j�}|s(|}�n�tjjd�rFtjt�|}�n�tjj	�|_
t|j
�}|j
df}d}xl|s�ytjj
|jjd�}d}Wqntjk
r�}	z*|dkr�|j�d}wntjdtt|	�dSd}	~	XqnXqnW|�s�tjdtt�|ji�dSytjj|jjd�}
Wn�tjk
�rF}	ztjdtt|	�dSd}	~	XnXtjk
�rttjdtt�|ji�dStjk
�r�tjd	ttt t�dSXd|_!tj"t#�x,|
D]$}|d
�r�t$|j%��||d<�q�W|j|�|j&j'}x�|j%�D]�\}
}|j(|
�}d}|�r|j(d
�}t)|j�}|
|j*j+�k�rf|j*j%|
�}x |D]\}}|j,||t-��qJWt.||j&j||j|||||j/|j0d�	�}|j1|��q�Wtj2|�dS)
Nrz/etc/cln_leapp_in_progressZuseNoSSLForPackagesF)�timeoutTz%s
%s
%sz%s
%sz%s %s
%s
%s�version�label)	r�proxyr-�	sslcacert�
force_http�cached_version�
login_info�gpgcheckr )3�_read_channels_filerr�isfilerr�LEAPP_IN_PROGRESS�up2date_clientr*ZinitUp2dateConfigr�get_ssl_ca_certZup2dateAuthZgetLoginInforr-r	�RhnServerExceptionr,�error�COMMUNICATION_ERROR�RHN_DISABLED�NOT_REGISTERED_ERROR�_write_channels_fileZ
rhnChannelZgetChannelDetailsZCommunicationErrorZNoChannelsError�NOT_SUBSCRIBED_ERROR�CHANNELS_DISABLEDZNoSystemIdError�NO_SYSTEM_ID_ERROR�USE_RHNREGISTERr�info�UPDATES_FROM_SPACEWALK�dictrr�repos�getrrrrr�
SpacewalkRepor5r �addr!)r#Z
networkingZenabled_channelsr1r2Z	proxy_urlr4Zcached_channelsZclnreg_tried�eZsvrChannels�channelrHZ
channel_idZchannel_dictZcached_channelr3rr$r%r&�repor(r(r)r"Zs�











zSpacewalk.activate_channelscCs�|jjsdS|jsdS|jddkr8|j�}tjj|�ytjj|jj	d�Wn4t
jk
r�}ztj
dtt|�WYdd}~XnXdS)z, Update system's profile after transaction. NZwriteChangesToLog�)r-z%s
%s
%s)rr rr�_make_package_deltar9ZrhnPackageInfoZlogDeltaPackagesZupdatePackageProfiler-r	r;rr<r=�PROFILE_NOT_SENT)r#�deltarLr(r(r)�transaction�szSpacewalk.transactioncCs�y.t|jd��}|j�}tj|�}|SQRXWnXttfk
rb}z|jtjkrR�WYdd}~Xn&tj	j
k
r�}zWYdd}~XnXiS)N�r)�openr�read�json�loads�FileNotFoundError�IOError�errno�ENOENT�decoderZJSONDecodeError)r#�
channels_fileZcontentZchannelsrLr(r(r)r6�s
zSpacewalk._read_channels_filecCsfy,t|jd��}tj||dd�WdQRXWn4ttfk
r`}z|jtjkrP�WYdd}~XnXdS)N�w�)�indent)rUrrW�dumprYrZr[r\)r#�varr^rLr(r(r)r@�szSpacewalk._write_channels_filecCs.dd�|jjjD�dd�|jjjD�d�}|S)NcSs$g|]}|j|j|j|j|jf�qSr()�namer.�release�epoch�arch)�.0�pr(r(r)�
<listcomp>�sz1Spacewalk._make_package_delta.<locals>.<listcomp>cSs$g|]}|j|j|j|j|jf�qSr()rdr.rerfrg)rhrir(r(r)rj�s)ZaddedZremoved)rrSZinstall_setZ
remove_set)r#rRr(r(r)rP�s
zSpacewalk._make_package_delta)T)
�__name__�
__module__�__qualname__rdr
r*r,r"rSr6r@rP�
__classcell__r(r()r'r)r
7s
Yr
csDeZdZdZdddddgZ�fdd�Zd	d
�Zd�fdd
�	Z�ZS)rJzB
    Repository object for Spacewalk. Uses up2date libraries.
    zX-RHN-Server-IdzX-RHN-Auth-User-Idz
X-RHN-AuthzX-RHN-Auth-Server-TimezX-RHN-Auth-Expire-OffsetcsTtt��jt|d�|jd��t|d��_�fdd�|dD��_|jd��_|jd��_yt	|d	��_
Wn<tk
r�}z tj
ttjj|��g�_
WYdd}~XnX|d
|jd�kr�d�_|jd
��_d�_d�_d�_d�_|jd��_|jd��_|jd��_|jd��r$�j�n�j�t�d��rP�j�}|�rP�j|�dS)Nr/rrdcsg|]}|d�j�qS)z	/GET-REQ/)�id)rh�url)r#r(r)rj�sz*SpacewalkRepo.__init__.<locals>.<listcomp>rpr1r0Zgpg_key_urlr.r3rOr4rr-r5r2r �set_http_headers) rrJr
rrIrdZbaseurlr1r0�get_gpg_key_urlsZgpgkey�InvalidGpgKeyLocationrr�GPG_KEY_REJECTEDrZi18nZucdZmetadata_expirer4Z	keepaliveZ	bandwidthZretriesZthrottler-r5r2�enable�disable�hasattr�create_http_headersrq)r#rMZoptsrL�http_headers)r')r#r)r
�s8
zSpacewalkRepo.__init__cCs�g}|js|Sxb|jD]X}||jkr8t|}tjj|��|j|dkrV|jd|�q|jd||j|f�qW|js�|jd�|S)N�z*%s: 
X-libcurl-Empty-Header-Workaround: *z%s: %sz.X-RHN-Transport-Capability: follow-redirects=3)Nrz)r4�needed_headers�MISSING_HEADERr�ErrorZ	RepoError�appendr2)r#ry�headerr<r(r(r)rxs

z!SpacewalkRepo.create_http_headersTcs0tt|�j||�}|j�}|r,|jtj|�|S)N)rrJ�_handle_new_remoterxZsetopt�librepoZLRO_HTTPHEADER)r#ZdestdirZmirror_setupZhandlery)r'r(r)r�&s
z SpacewalkRepo._handle_new_remote)T)	rkrlrm�__doc__r{r
rxr�rnr(r()r'r)rJ�s%rJcCs*|j�}x|D]}t|�st|��qW|S)a
    Parse the key urls and validate them.

    key_url_string is a space seperated list of gpg key urls that must be
    located in /etc/pkg/rpm-gpg/.
    Return a list of strings containing the key urls.
    Raises InvalidGpgKeyLocation if any of the key urls are invalid.
    )�split�is_valid_gpg_key_urlrs)Zkey_url_stringZkey_urls�key_urlr(r(r)rr2s
	
rrc@seZdZdS)rsN)rkrlrmr(r(r(r)rsAsrscCsP|jd�}t|�dkrdS|\}}|j�dkr2dStjj|�}|jd�sLdSdS)Nz://�F�filez/etc/pki/rpm-gpg/T)r��len�lowerrr�normpath�
startswith)r�Zproto_split�protorr(r(r)r�Ds

r�cCs4d|ko|dst�|d}t|�tkr0|dS|S)NZ	sslCACertr)ZBadSslCaCertConfig�type�list)rZca_certsr(r(r)r:Rsr:)/Z
__future__rrZdnfpluginscorerrrZdnf.exceptionsr[rWr�rrZdnf.conf.configrZup2date_client.up2dateAuthr9Zup2date_client.configZup2date_client.rhnChannelZup2date_client.rhnPackageInfoZrhn.i18nrr	rr>rBr=r?rArCrDrFrtrQr|r8rZPluginr
rNZReporJrr�	Exceptionrsr�r:r(r(r(r)�<module>sJ-O

Filemanager

Name Type Size Permission Actions
builddep.cpython-36.opt-1.pyc File 7.27 KB 0644
builddep.cpython-36.pyc File 7.27 KB 0644
changelog.cpython-36.opt-1.pyc File 4.08 KB 0644
changelog.cpython-36.pyc File 4.08 KB 0644
config_manager.cpython-36.opt-1.pyc File 7.09 KB 0644
config_manager.cpython-36.pyc File 7.09 KB 0644
copr.cpython-36.opt-1.pyc File 20.2 KB 0644
copr.cpython-36.pyc File 20.2 KB 0644
debug.cpython-36.opt-1.pyc File 10.56 KB 0644
debug.cpython-36.pyc File 10.56 KB 0644
debuginfo-install.cpython-36.opt-1.pyc File 5.93 KB 0644
debuginfo-install.cpython-36.pyc File 5.93 KB 0644
download.cpython-36.opt-1.pyc File 9.29 KB 0644
download.cpython-36.pyc File 9.29 KB 0644
generate_completion_cache.cpython-36.opt-1.pyc File 3 KB 0644
generate_completion_cache.cpython-36.pyc File 3 KB 0644
groups_manager.cpython-36.opt-1.pyc File 8.45 KB 0644
groups_manager.cpython-36.pyc File 8.45 KB 0644
needs_restarting.cpython-36.opt-1.pyc File 9.88 KB 0644
needs_restarting.cpython-36.pyc File 9.88 KB 0644
repoclosure.cpython-36.opt-1.pyc File 4.31 KB 0644
repoclosure.cpython-36.pyc File 4.31 KB 0644
repodiff.cpython-36.opt-1.pyc File 7.55 KB 0644
repodiff.cpython-36.pyc File 7.55 KB 0644
repograph.cpython-36.opt-1.pyc File 2.72 KB 0644
repograph.cpython-36.pyc File 2.72 KB 0644
repomanage.cpython-36.opt-1.pyc File 6.37 KB 0644
repomanage.cpython-36.pyc File 6.37 KB 0644
reposync.cpython-36.opt-1.pyc File 10.19 KB 0644
reposync.cpython-36.pyc File 10.19 KB 0644
spacewalk.cpython-36.opt-1.pyc File 9.79 KB 0644
spacewalk.cpython-36.pyc File 9.79 KB 0644
system_upgrade.cpython-36.opt-1.pyc File 22.48 KB 0644
system_upgrade.cpython-36.pyc File 22.48 KB 0644
universal_hooks.cpython-36.opt-1.pyc File 5.86 KB 0644
universal_hooks.cpython-36.pyc File 5.86 KB 0644