Current File : //usr/libexec/kcare/python/kcarectl/__pycache__/server_info.cpython-36.pyc
3

��wh��@s�ddlZddlZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddlm
Z
ddlmZddlmZdd
d�Z
ddd
�Zddd�Zdd�ZdS)�N�)�kcare)�platform_utils)�
http_utils)�utils)�	constants)�serveridFcCs�t�}t|ptj��|d<||d<tj�|d<tj�|d<tj�|d<tj�|d<tj�|d<t	j
�}|d|d	<|d
|d<tj�|d<t
jtj�|d
<tj�|d<t	j�|d<t	j�|d<t	j�|d<tj�|d<tjtj��}|d|d<|d|d<|d|d<tj��pd|d<tj�|d<tj�|d<ytj�|d<Wntk
�rXYnXtj�}|�rp||d<tj �}|dk	�r�||d<|�r�t	j!�|d <|S)!N�ts�reason�machine�	processor�release�system�versionr�distror�distro_versionZeuname�
kcare_versionZ	last_stop�node�uptime�virt�proxyzlast-updateZ
ltimestampzpatch-level�patch_levelz
patch-typeZ
patch_type��kmodZcrashreporter_ts�kdump_statusZkdump_ts�	server_id�stateZsecure_boot)"�dict�int�time�platformrrr
rrr�
get_distror�kcare_unamer�strip_version_timestampr�VERSIONZ
get_last_stop�get_hostname�
get_uptime�get_virtr�
proxy_is_used�parse_patch_descriptionZloaded_patch_descriptionZget_current_kmod_versionZ$crashreporter_latest_event_timestamprZkdumps_latest_event_timestamp�	Exceptionr�get_serverid�	get_state�secure_boot_info)r
�nowr-�datar�descriptionrr�r1�1/usr/libexec/kcare/python/kcarectl/server_info.py�server_infosL
r3cCs�t�}t|ptj��|d<||d<||d<tj�}|d|d<|d|d<tj�|d<tjt	j
�|d	<tj�|d
<tj�|d<tj
�|d<d
}tjjd�r�tjjd�}||d<|S)Nr	r
rrrrrrrrrrgz/var/lib/libcare/stop�stop_ts)rrrrr!r rrr#rr$r%r&r'�os�path�exists�getctime)r
rr.r/rr4r1r1r2�server_lib_infoIs"r9cCs"tjtjtjtt||d�����S)N)r-)r�nstr�base64�	b16encode�bstr�strr3)r
r-r1r1r2�based_server_infoasr?cCs.tj|ddd�}tjtjtjtj|d����S)NF�,�:)�ensure_ascii�
separatorszutf-8)r@rA)	�json�dumpsrr:r;�urlsafe_b64encode�zlib�compressr=)�infor/r1r1r2�encode_server_lib_infoesrJ)NF)N)F)rDr;r5rr rGrrrrrrrr3r9r?rJr1r1r1r2�<module>s
2


Page not found – Hello World !