ok

Mini Shell

Direktori : /proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/tuned/plugins/
Upload File :
Current File : //proc/thread-self/root/proc/self/root/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyc

�
��*cc@s�ddlZddlmZddlTddlZddlTddlmZddl	j
Z
ddlZddlZej
j�ZddgZdd	gZd
ejfd��YZd�Zd
�Zd�Zd�Zd�Zed�ZdS(i����Ni(tbase(t*(tcommandstbase_reachable_timetretrans_times
/run/sysctl.ds
/etc/sysctl.dtSysctlPlugincBsGeZdZd�Zd�Zd�Zd�Zd�Zed�Z	RS(s.
	Plugin for applying custom sysctl options.
	cOs2tt|�j||�t|_t�|_dS(N(tsuperRt__init__tTruet_has_dynamic_optionsRt_cmd(tselftargstkwargs((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRs	cCs�t|_t|_|j|j�}|jj|i�|_t	|j�dkr�t
jd�|j|�i|_|jj
|�n|j|_dS(Nis0recovering old sysctl settings from previous run(tFalset_has_dynamic_tuningRt_has_static_tuningt_storage_keytnamet_storagetgett_sysctl_originaltlentlogtinfot_instance_unapply_statictunsettoptionst_sysctl(Rtinstancetstorage_key((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_inits		

	cCs&|j|j�}|jj|�dS(N(RRRR(RRR((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_cleanup+scCs	x�t|jj��D]�\}}t|�}|dkrNtjd|�q|jj|j	j
|��}|j||�}|dk	r||j|<t
||�qqW|j|j�}|jj||j�|jjtjtj�rtjd�t�ndS(NsDsysctl option %s will not be set, failed to read the original value.sreapplying system sysctl(tlistRtitemst_read_sysctltNoneRterrort
_variablestexpandR
tunquotet_process_assignment_modifiersRt
_write_sysctlRRRtsett_global_cfgtget_booltconststCFG_REAPPLY_SYSCTLtCFG_DEF_REAPPLY_SYSCTLRt_apply_system_sysctl(RRtoptiontvaluetoriginal_valuet	new_valueR((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_apply_static/s""		

cCs�t}t}x�t|jj��D]�\}}t|�}|j|jj|�|�}|dk	r"|j	||j
j|�|j
j|�|�tkr�t}q�q"q"W|S(N(
RR!RR"R#R)R&R'R$t
_verify_valueR
t	remove_wsR(RRtignore_missingtdevicestretR2R3tcurr_val((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_instance_verify_staticEs"6cCs7x0t|jj��D]\}}t||�qWdS(N(R!RR"R*(RRt
full_rollbackR2R3((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRQs"(
t__name__t
__module__t__doc__RRR R6R=RR(((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRs					cCs�i}xmtD]e}ytj|�}Wn
q
nXx<|D]4}|jd�sUq:n||kr:|||<q:q:Wq
Wx>t|j��D]*}||}d||f}t|�q�Wtd�dS(Ns.confs%s/%ss/etc/sysctl.conf(tSYSCTL_CONFIG_DIRStostlistdirtendswithtsortedtkeyst_apply_sysctl_config_file(tfilestdtflisttfnametpath((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyR1Vs 


c	Cs�tjd|�y]t|d��7}x-t|d�D]\}}t|||�q6WWdQXtjd|�WnKttfk
r�}|jtjkr�tj	d|t
|�f�q�nXdS(Ns%Applying sysctl settings from file %stris.Finished applying sysctl settings from file %ss.Error reading sysctl settings from file %s: %s(Rtdebugtopent	enumeratet_apply_sysctl_config_linetOSErrortIOErrorterrnotENOENTR%tstr(RMtftlinenotlinete((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRHis		cCs�|j�}t|�dks>|ddks>|ddkrBdS|jdd�}t|�dkr�tjd||f�dS|\}}|j�}t|�dkr�tjd||f�dS|j�}t||dt�dS(	Nit#t;t=iis Syntax error in file %s, line %dR9(tstripRtsplitRR%R*R(RMRYRZttmpR2R3((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyRRvs 2		cCsd|jdd�S(Ns/proc/sys/%st.t/(treplace(R2((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt_get_sysctl_path�scCs�t|�}y�t|d��W}d}x;t|�D]-\}}|dkr4tjd|�dSq4W|j�}WdQXtjd||f�|SWn]tt	fk
r�}|j
t
jkr�tjd|�ntjd|t|�f�dSXdS(NRNtisGFailed to read sysctl parameter '%s', multi-line values are unsupporteds&Value of sysctl parameter '%s' is '%s'sBFailed to read sysctl parameter '%s', the parameter does not exists(Failed to read sysctl parameter '%s': %s(
ReRPRQRR%R$R_RORSRTRURVRW(R2RMRXRZtiR3R[((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyR#�s(				cCs�t|�}tjj|�tkr9tjd|�tSyDtjd||f�t	|d��}|j
|�WdQXtSWn{tt
fk
r�}|jtjkr�|r�tjntj}|d||f�n tjd||t|�f�tSXdS(Ns+Refusing to set deprecated sysctl option %ss%Setting sysctl parameter '%s' to '%s'twsIFailed to set sysctl parameter '%s' to '%s', the parameter does not exists/Failed to set sysctl parameter '%s' to '%s': %s(ReRCRMtbasenametDEPRECATED_SYSCTL_OPTIONSRR%RRORPtwriteRRSRTRURVRW(R2R3R9RMRXR[tlog_func((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyR*�s&			(treRfRt
decoratorst
tuned.logsttunedt
subprocessttuned.utils.commandsRttuned.constsR.RURCtlogsRRRjRBtPluginRR1RHRRReR#RR*(((s?/usr/lib/python2.7/site-packages/tuned/plugins/plugin_sysctl.pyt<module>s&

	E		
			

Zerion Mini Shell 1.0