PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /usr/libexec/kcare/python/kcarectl/
Server: Linux host100322.itwesthosting.com 3.10.0-1160.144.1.el7.tuxcare.els4.x86_64 #1 SMP Tue Apr 7 08:40:40 UTC 2026 x86_64
IP: 144.91.64.173
Choose File :

Url:
Dir : //usr/libexec/kcare/python/kcarectl/kcare.pyo

�
S�ic@sBddlZddlZddlZddlZddlZddlZddlZddlZddlm	Z	m
Z
mZmZm
Z
ddlmZddlmZer�ddlmZmZmZndZd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zdefd��YZ de fd��YZ!de fd��YZ"d�Z#d�Z$d�Z%d�Z&d�Z'd�Z(d�Z)d�Z*e
j+d��Z,e
j+d��Z-e
j+d��Z.d �Z/d!�Z0d"�Z1d#�Z2d$�Z3d%�Z4e
j+d&��Z5d'�Z6d(�Z7d)�Z8d*�Z9dS(+i����Ni(tconfigt	constantst	log_utilst
process_utilstutils(tSafeExceptionWrapper(tjson_loads_nstr(tListtOptionaltTuplesuname: cCstj|�p|dkS(Ns.-_+(tstrtisalnum(tc((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt
is_uname_charscCs�t�}tt||tj�d�}zPxI|j�D];}|jt�r7djt	t
|tt�j���Sq7WWd|j
�XdS(Ntrt(tget_kernel_hashtopentget_cache_pathRt
PATCH_INFOt	readlinest
startswithtUNAME_LABELtjointfilterR
tlentstriptclose(tpatch_leveltkhashtftline((s+/usr/libexec/kcare/python/kcarectl/kcare.pytparse_unames	.cCsatjjtj�r]y1ttjd�}|j|�|j�tSWq]t	k
rYq]Xnt
S(Ntw(tostpathtexistsRtKCARE_UNAME_FILERtwriteRtTruet	ExceptiontFalse(tnew_versionR((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkcare_update_effective_version(s


cCsAttjd�}ztj|j��j�SWd|j�XdS(Ntrb(RRtKERNEL_VERSION_FILEthashlibtsha1treadt	hexdigestR(R((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR4sc	Cs�tjjtjd�}tjj|�r�t|d��i}|j�j�}yt	|�Wn;t
k
r�tt	tjj|���St
k
r�dSX|SWdQXndS(s:Returns timestamp from PATCH_CACHE/stoped.at if its exsitss
stopped.atRterrorNs-1(R"R#RRtPATCH_CACHER$RR0trstriptintt
ValueErrorR
tgetctimeR((tstopped_at_filenametfhtvalue((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt
get_last_stop?s


cCswtjpd}tjpd}dj||t|�|g�}tjd|f}|rg||f7}ntjj|�S(Ntnonetdefaultt-tpatches(	RtPREFIXt
PATCH_TYPERR
RR3R"R#(Rtpleveltfnametprefixtptypet	patch_dirtresult((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRPs!cGstjtj|�S(N(Rtget_patch_server_urlRR@(tparts((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_kernel_prefixed_urlZstBaseKernelPatchLevelcBseZd�Zd�ZRS(cGst|jt|�|�S(N(RRR
(tselfRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt
cache_path_scCs,i|jd6|jd6|jd6|jd6S(NtlevelRtbaseurltrelease(RNRRORP(RL((s+/usr/libexec/kcare/python/kcarectl/kcare.pytas_dictbs



(t__name__t
__module__RMRQ(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRK^s	tKernelPatchLevelcBs2eZdd�Zdd�Zd�Zd�ZRS(cCst||�j||�S(N(tsupert__new__(tclsRRNRORP((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRVlscCs(||_||_||_||_dS(N(RNRRORP(RLRRNRORP((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt__init__os			cGstj|j|j|�S(N(RRHROR(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkmod_urluscGs"tj|j|jt|�|�S(N(RRHRORR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pytfile_urlxsN(RRRStNoneRVRXRYRZ(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRTks	tLegacyKernelPatchLevelcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsCyt||�j||�SWntk
r>}t|��nXdS(N(RURVR6R(RWRRNtexc((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRV}scCs(||_||_d|_d|_dS(N(RNRR[RORP(RLRRN((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRX�s			cGs8dtjkr(t|jt|�|�St|j|�S(Nspatches.kernelcare.com(RtPATCH_SERVERRJRR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRY�scGst|jt|�|�S(N(RJRR
(RLRI((s+/usr/libexec/kcare/python/kcarectl/kcare.pyRZ�scCst|jt|�|�S(N(RTRR5(RLRO((s+/usr/libexec/kcare/python/kcarectl/kcare.pytupgrade�s(RRRSRVRXRYRZR_(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR\|s
				cCsoyDttjjtjd�d��}tj|j�|�WdQXWn$t	k
rjt
jddt�nXdS(Nskernel_patch_level.jsonR!s!failed to dump kernel patch levelt	print_msg(
RR"R#RRR3tjsontdumpRQR(RtlogexcR)(tkernel_patch_levelR((s+/usr/libexec/kcare/python/kcarectl/kcare.pytdump_kernel_patch_level�s
$ 
cCsfy;ttjjtjd���}t|j��SWdQXWn$tk
rat	j
ddt�nXdS(Nskernel_patch_level.jsons(failed to read dumped kernel patch levelR`(RR"R#RRR3RR0R(RRcR)(R((s+/usr/libexec/kcare/python/kcarectl/kcare.pytread_dumped_kernel_patch_level�s
!
cCs>tg|D]}|tjj|�f^q
dd�dt�S(NtkeycSs|dS(Ni((tpair((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt<lambda>�streverse(tsortedR"R#R7R'(t
files_listtit((s+/usr/libexec/kcare/python/kcarectl/kcare.pytsort_files_by_ctime�s+	cCs|d}tjjd�s|Std��N}xD|D]<}|j�}|jd�r2|jdd�\}}q2q2WWdQX|S(Ns
/var/crashs/etc/kdump.confspath i(R"R#tisfileRRRtsplitR[(t
kdump_patht
kdump_confRt_((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_kdump_root�s
%cCs;t�}tjj|�sgStjtjj|d��S(Ns*/vmcore(RtR"R#tisdirtglobR(t
kdump_root((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_kdump_vcore_files�s	cCs;t�}tjj|�sgStjtjj|d��S(Ns*/*.txt(RtR"R#RuRvR(Rw((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_kdump_txt_files�s	cCs8tjjtj�sgStjtjjtjd��S(Ns*.log(R"R#RuRt
KDUMPS_DIRRvR(((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_crashreporter_log_files�scCsNtjjtj�sgSgtjtj�D]}tjjtj|�^q,S(N(R"R#RuRRztlistdirR(Rm((s+/usr/libexec/kcare/python/kcarectl/kcare.pytlist_crashreporter_artifacts�scCs%t�}|sdSt|�ddS(Nii(RxR[Rn(tkdumps((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkdumps_latest_event_timestamp�s	cCs\tjstjjtj�rXtjtjddgdtdt�\}}}|j	�SdS(Ns	is-activetkdumptcatch_stdouttcatch_stderrssystemd-absent(
RtSKIP_SYSTEMCTL_CHECKR"R#Rot	SYSTEMCTLRtrun_commandR'R(Rststdout((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkdump_status�s0
cCs%t�}|sdSt|�ddS(Nii(R}R[Rn(t	artifacts((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt$crashreporter_latest_event_timestamp�s	cCsJd}tjj|�sdSt|d��}|j�j�}WdQX|S(Ns/sys/module/kcare/versionR(R"R#R$RR0R(tkmod_version_fileRtversion((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_current_kmod_version�scCsMt�}|stStjdddt||tj�g�j�}||kS(Ns
/sbin/modinfos-FR�(R�R'Rtcheck_outputRRtKMOD_BINR(RRBtold_versionR*((s+/usr/libexec/kcare/python/kcarectl/kcare.pytis_kmod_version_changed�s	*cCs#t�}|stj�St|�S(N(tloaded_patch_leveltplatformRPR (R((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkcare_uname_su
s	
cCs<tjjtj�r1ttjd�j�j�St�SdS(NR(	R"R#R$RR%RR0RR�(((s+/usr/libexec/kcare/python/kcarectl/kcare.pytkcare_unamescCsftt��d}|rbyt|�Wn(tk
rQ}t|dt���nXtt�|�SdS(Nspatch-levelsUnexpected patch state(tparse_patch_descriptiontloaded_patch_descriptionR5R6Rt_patch_infoR\R(tplte((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�scCsVy tjtjdgdt�SWn/tjk
rQ}|jtj	krM�ndSXdS(NtinfotcheckR(
RR�Rt
KPATCH_CTLR't
subprocesstCalledProcessErrort
returncodeterrnotEBUSY(R�((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�$s cCsiy+gtd�D]}|j�d^qSWn7ttfk
rd}tjdt|�dt�gSXdS(Ns
/proc/modulesis#Error getting loaded modules list: R`(RRptOSErrortIOErrorRtlogerrorR
R)(Rtex((s+/usr/libexec/kcare/python/kcarectl/kcare.pytget_loaded_modules-s
+cCs#dt�krdStt�d�S(Ntkcareskpatch-description(R�R[tget_patch_valueR�(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�6scCstj|�j|�S(N(Rtdata_as_dicttget(R�tlabel((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�>sc	Cs�idd6dd6dd6dd6}|s,|S|jd�\}}}|jd�\}}}|jd	�\}}}|p}d|d<|p�d|d<||d<||d<|S(
Nspatch-levelR=s
patch-typeRslast-updateskernel-versiont;t:R>(R[t	partition(	tdescRGtlevel_type_timestampRstkernelt
level_typet	timestampRt
patch_type((s+/usr/libexec/kcare/python/kcarectl/kcare.pyR�Bs"

c
Cs�tjjtjd�}tjj|�r�t|d��G}y|j�}tj	|�SWn t
ttt
tfk
r{nXWdQXndS(Nskcare.stateR(R"R#RRR3R$RR0tasttliteral_evaltSyntaxErrorR�R6t	TypeErrortUnicodeDecodeError(t
state_fileRtstate((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt	get_stateVs(:R�R�RvR.RaR"R�R�RRRRRRterrorsRtpy23RR)ttypingRRR	RR
R R+RR;RRJR5RKRTR\ReRfRnRtRxRyR{R}tcachedRR�R�R�R�R�R�R�R�R�R�R�R�R�(((s+/usr/libexec/kcare/python/kcarectl/kcare.pyt<module>sZ(