Spade

Mini Shell

Directory:~$ /lib/python2.7/site-packages/tuned/admin/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //lib/python2.7/site-packages/tuned/admin/admin.pyo

�
��\c@s�ddlmZddlZddlmZddlmZddl	m
Z
ddlmZddl
jZddlmZddlZddlZddlZddlZddlZddlZd	efd
��YZdS(i����(tprint_functionN(tcommands(tLocatori(tTunedAdminDBusException(tTunedException(tProfileRecommendertAdmincBs�eZeeeejejd�Zd�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd	�Zd
�Zd�Zdd
�Zdd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z
d�Z!d�Z"d�Z#d�Z$d�Z%d�Z&d
�Z'd!�Z(d"�Z)d#�Z*d$ed%�Z+d$ed&�Z,ed'�Z-ed(�Z.RS()cCs||_||_||_||_t|�|_ttj�|_	t
j�|_d|_
t|_d|_d|_d|_||_t�|_|jrtjjtjtjtj|�|_y|jjtj|j�Wqt
k
r}|j!|�t"|_qXndS(Nt(#t_dbust_debugt_asynct_timeoutRt_cmdtprofiles_locatortconststLOAD_DIRECTORIESt_profiles_locatort	threadingtEventt_daemon_action_finishedt_daemon_action_profiletTruet_daemon_action_resultt_daemon_action_errstrtNonet_controllert
_log_tokent
_log_levelRt_profile_recommenderttunedtadmintDBusControllertDBUS_BUStDBUS_INTERFACEtDBUS_OBJECTtset_signal_handlertDBUS_SIGNAL_PROFILE_CHANGEDt_signal_profile_changed_cbRt_errortFalse(tselftdbustdebugtasyncottimeoutt	log_levelte((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt__init__s*											'
cCst|dtj�dS(Ntfile(tprinttsyststderr(R(tmessage((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR&+scCs>|jj�s:||_||_||_|jj�ndS(N(Rtis_setRRRtset(R(tprofile_nametresultterrstr((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR%.s
			cCsiy)tjt|jjtj��d�Wn9tk
rK}|jtj	kSt
tfk
rd}tSXt
S(Ni(tostkilltintRt	read_fileRtPID_FILEtOSErrorterrnotEPERMt
ValueErrortIOErrorR'R(R(R.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_tuned_is_running6s)cOsL|dks|dkrtSd}d}t}yt|d|�}Wntk
rc}t|_nXyt|d|�}Wn;tk
r�}|js�|jt|�d|�tSnX|jr-y<|jj|j	�|jj
|||�|jj�}Wq-tk
r)}|j|�t|_q-Xn|jsH|||�}n|S(NRt
_action_dbus_t_action_s
, action '%s' is not
implemented(
RR'tgetattrtAttributeErrorRR&tstrRtset_on_exit_actiont_log_capture_finisht
set_actiontrunR(R(taction_nametargstkwargstactiontaction_dbustresR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRQ@s6
			

	c	Cs�td�xo|D]g}|ddk	rf|ddkrft|jjd|ddd|d��qtd|d�qWdS(NsAvailable
profiles:iRs-
%sii(R1RRt	align_str(R(t
profile_namestprofile((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profiles^s


 /cCsxy|jj�}Wn;tk
rP}g|jj�D]}|df^q5}nX|j|�|j�|jjt�S(NR(Rt	profiles2RtprofilesRWt_action_dbus_activetexitR(R(RUR.RV((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_list_profilesfs,

cCs$|j|jj��|j�tS(N(RWRtget_known_names_summaryt_action_activeR(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_list_profilesps
cCs8|jj�}|dkr$d}n|jjt�|S(NR(Rtactive_profileRR[R(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_dbus_get_active_profileus
	cCs|jj�\}}|S(N(Rtget_active_profile(R(R7tmanual((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_get_active_profile|scCsD|jj�\}}|dkr0|dk	}n|r=tjStjS(N(RRbRRtACTIVE_PROFILE_MANUALtACTIVE_PROFILE_AUTO(R(RVRc((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_get_profile_mode�scCs�|dtkrjtd�t|d�t�td�t|d�t�td�t|d�tStd|�tSdS(	Nis
Profile
name:isProfile summary:isProfile description:is,Unable to get
information about profile
'%s'(RR1R'(R(RVtprofile_info((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_info�s


RcCsC|dkr|j�}n|jj|j||jj|���S(NR(RaRR[RiRh(R(RV((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_profile_info�scCs�|dkrcy*|j�}|dkr5td�tSWqctk
r_}|jt|��tSXn|j||jj	|t
jt
jgddg��S(NRsNo current active
profile.(
RdRR1R'RR&RIRiRtget_profile_attrsRtPROFILE_ATTR_SUMMARYtPROFILE_ATTR_DESCRIPTION(R(RVR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_profile_info�s
cCs,|dkrtd�tStd|�tS(NsNo current active
profile.sCurrent active profile:
%s(RR1R'R(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_name�s

cCs|jj|j|j���S(N(RR[RoRa(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRZ�scCs|y|j�}Wn'tk
r9}|jt|��tSX|dk	ro|j�rotd�td|�tS|j	|�S(NsKIt
seems that tuned daemon is not running, preset profile is not
activated.sPreset profile: %s(
RdRR&RIR'RRDR1RRo(R(R7R.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR^�s
cCstd|�dS(NsProfile selection mode:
(R1(R(tmode((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_print_profile_mode�scCs[|jj�\}}|j|�|dkrK|j|�|jjt�S|jjt�S(NR(Rtprofile_modeRqR&R[R'R(R(Rpterror((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_profile_mode�s

cCsOy!|j�}|j|�tSWn'tk
rJ}|jt|��tSXdS(N(RgRqRRR&RIR'(R(RpR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_profile_mode�s
cCsP|r?|jj�rL|jj�rL|jd�t}qLn
|j|�|S(NsCannot
enable the tuning.(Rt
is_runningtstartR&R'(R(trettmsg((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_profile_print_status�s


cCs�tj�|j|jkr=td|j�|jjt�S|jj�r�|j	|kr�|j
s�td|j�|jjt�S|jjt�SntS(Ns�Operation timed out
after waiting %d seconds(s), you may try to increase timeout by using
--timeout command line option or using --async.sError changing profile:
%s(
ttimet
_timestampRR1RR[R'RtisSetRRRR(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_wait_profile�s	cCs�|jdks|jdkr"dSyH|jj|j�}d|_t|dddtj�tjj�Wn
tk
r�}|j	d�nXdS(NRtendR0sUError: Failed to stop log capture.
Restart the Tuned daemon to prevent a memory leak.(
RRRtlog_capture_finishR1R2R3tflushRR&(R(tlog_msgsR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRK�s		cCst|�dkr|j�Sdj|�}|dkrG|jjt�S|jj�|jr�|j	dk	r�|jdd}|jj|j	|�|_
n|jj|�\}}|js�|r�|jj|j||��Stj�|_|jj|j|�|j||�S(Nit
Rii(tlent_action_dbus_listtjoinRR[R'RtclearR
RRRtlog_capture_startRtswitch_profileRzR{R|RLR~(R(RYR7R,RxRy((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_profile�s


	cCsRtd�|jjdddg�\}}|dkrDtd�n
td�dS(NsTrying to (re)start tuned...tserviceRtrestartis#Tuned
(re)started, changes applied.sQTuned (re)start failed, you need to
(re)start tuned by hand for changes to
apply.(R1Rtexecute(R(RxRy((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_restart_tuneds

!
cCs�||jj�krty%|jj||�|j�tSWq�tk
rp}|jt|��|jd�t	SXn|jd|�t	SdS(NsUnable to
switch profile.s%Requested profile '%s' doesn't exist.(
Rtget_known_namesRtsave_active_profileR�RRR&RIR'(R(R7RcR.((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_set_profiles

cCsKt|�dkr|j�Sdj|�}|dkr;tS|j|t�S(NiR�R(R�R_R�R'R�R(R(RYR7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_profiles
cCs�|jj�}|jj�|jrd|jdk	rd|jdd}|jj|j|�|_	n|jj
�\}}|js�|r�|jj|j||��St
j
�|_|jj|j|�|j||�S(Nii(Rtrecommend_profileRR�R
RRRR�Rtauto_profileR[RzR{R|RLR~(R(R7R,RxRy((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_auto_profile$s
	cCs|jj�}|j|t�S(N(Rt	recommendR�R'(R(R7((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_auto_profile4scCs#t|jj��|jjt�S(N(R1RR�R[R(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_recommend_profile8scCst|jj��tS(N(R1RR�R(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_recommend_profile<scCs�|r|jj�}n|jj�}|r:td�n<td�td�td�td�td�td�tdtj�|jj|�S(	NsHVerfication
succeeded, current system settings match the preset profile.sLVerification
failed, current system settings differ from the preset profile.s=You can
mostly fix this by restarting the Tuned daemon, e.g.:s  systemctl restart
tunedtors  service tuned restartsNSometimes (if some plugins like
bootloader are used) a reboot may be required.s&See tuned log file
('%s') for
details.(Rtverify_profile_ignore_missingtverify_profileR1RtLOG_FILER[(R(tignore_missingRx((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_verify_profile@s






cCstd�tS(Ns Not supported in no_daemon
mode.(R1R'(R(R�((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_verify_profileQs
cCsVd}|jj|j|�|_|jj�}|sF|jd�n|jj|�S(NiisCannot
disable active
profile.i(RR�RRtoffR&R[(R(R,Rx((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_dbus_offUs	cCstd�tS(Ns
Not supported in no_daemon
mode.(R1R'(R(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_off_s
RYcCs6|dkr|j�S|dkr2|jd|�SdS(sDPrint accessible
profiles or plugins got from tuned dbus api

		Keyword arguments:
		list_choice -- argument from command line deciding what will be listed
		verbose -- if True then list plugin's config options and their hints
			if possible. Functional only with plugin listing, with profiles
			this argument is omitted
		RYtpluginstverboseN(R\t_action_dbus_list_plugins(R(tlist_choiceR�((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR�cs	
cCs6|dkr|j�S|dkr2|jd|�SdS(saPrint accessible
profiles or plugins with no daemon mode

		Keyword arguments:
		list_choice -- argument from command line deciding what will be listed
		verbose -- Plugins cannot be listed in this mode, so verbose argument
			is here only because argparse module always supplies verbose
			option and if verbose was not here it would result in error
		RYR�R�N(R_t_action_list_plugins(R(R�R�((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt_action_listqs	
cCs�|jj�}x�|j�D]�}t|�|st||�dkrOqn|jj|�}xI||D]=}td|�|j|d�}|rltd|�qlqlWqW|jjt	�S(svPrint
accessible plugins

		Keyword arguments:
		verbose -- if is set to True then parameters and hints are printed
		is	%ss		%sN(
Rtget_pluginstkeysR1R�tget_plugin_hintstgetRR[R(R(R�R�tpluginthintst	parameterthint((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR�s
cCstd�tS(Ns Not supported in no_daemon
mode.(R1R'(R(R�((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyR��s
(/t__name__t
__module__RR'Rt
ADMIN_TIMEOUTtloggingtERRORR/R&R%RDRQRWR\R_RaRdRgRiRjRnRoRZR^RqRtRuRzR~RKR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyRsR				
			
																											
	(t
__future__Rttuned.adminRttuned.utils.commandsRttuned.profilesRR
t
exceptionsRttuned.exceptionsRttuned.constsRttuned.utils.profile_recommenderRR:R2R@R{RR�tobjectR(((s5/usr/lib/python2.7/site-packages/tuned/admin/admin.pyt<module>s