\c@sddlZddlZddlmZmZddljZddlZ ddl Z ddl Zddl Z ddl mZejjZdefdYZdS(iN(t ConfigObjtConfigObjError(tInvalidProfileExceptiontLoadercBseZdZdddddgZdZdZedZed Z d Z d Z d Z d Z dZRS(s Profiles loader. t_profile_locatort_profile_mergert_profile_factoryt_global_configt _variablescCs1||_||_||_||_||_dS(N(RRRRR(tselftprofile_locatortprofile_factorytprofile_mergert global_configt variables((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pyt__init__s     cCstjjj||S(N(ttunedtprofilestprofiletProfile(R t profile_nametconfig((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pyt_create_profilescCstjd|S(Ns^[a-zA-Z0-9_.-]+$(tretmatch(tclsR((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pyt safe_namescCs|jS(N(R(R ((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pyR "scCsGt|tk r!|j}ntt|j|}t|dkrZtdnt|dkrtjddj |ntjd|dg}g}|j |||t|dkr|j j |}n |d}dj ||_ d|jkr6|jj|jdj|jd=n|j||S( Nis.No profile or invalid profiles were specified.isloading profiles: %ss, sloading profile: %st R(ttypetlisttsplittfilterRtlenRtlogtinfotjoint _load_profileRtmergetnametunitsRt add_from_cfgtoptionst_expand_vars_in_devices(R t profile_namesRtprocessed_filest final_profile((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pytload&s(   cCs>x7|jD],}|jj|j|j|j|_q WdS(N(R'Rtexpandtdevices(R Rtunit((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pyR*Csc Csx|D]}|jj||}|dkrYtd|tt|jjfn|j||j|}|j j ||}d|j kr|j j |j jd}|j|g||n|j|qWdS(Ns!Cannot find profile '%s' in '%s'.tinclude(Rt get_configtNoneRRtreversedt_load_directoriestappendt_load_config_dataRtcreateR)RR/tpopR$( R R+RR,R&tfilenameRRt include_name((s9/usr/lib/python2.7/site-packages/tuned/profiles/loader.pyR$Gs  + cCstjd||S(Ns(?s