-P`c@sddlZddlZddlZddlmZmZmZddlmZddl Z ddl Z ddl m Z ddlmZdZdefdYZdS( iN(tLsmErrorterrort ErrorNumber(tcmd_line_wrapper(t SocketEOF(t TransPortcs-dkr|Stfd|DS(s{ This method does not check whether lsm_obj contain requested property. The method caller should do the check. c3s*|] }t|kr|VqdS(N(tgetattr(t.0tlsm_obj(t search_keyt search_value(s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pys #sN(tNonetlist(tlsm_objsR R ((R R s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pytsearch_propertys t PluginRunnercBs/eZdZedZdZdZRS(s] Plug-in side common code which uses the passed in plugin to do meaningful work. cCs+yt|tSWntk r&tSXdS(s4 Returns True if val is an integer. N(tinttTruet ValueErrortFalse(tval((s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pyt _is_number-s   cCst|_t|dkrtj|dryt|d}ttj|tj tj |_ y||_ WnNt k r}tj}|j jdddt|tj|nXWqt k rttjtdtjdqXnt|_t|dS(NiiiisError instantiating plug-in sPlug-in exiting.(RtcmdlinetlenRRRRtsockettfromfdtAF_UNIXt SOCK_STREAMttptplugint Exceptiontsystexc_infot send_errortstrtsixtreraiseRt tracebackt format_exctexitRR(tselfRtargstfdtetec_info((s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pyt__init__8s& %!    c Cs|jr dSt}d}z|yxtry|jj}|d}|d}|d}t|j|r|dkrt|j|}qt|j||d}nt t j d|jj ||dkrt}n|dkrt}|jj PnWq"tk rI}ttj|jj|dt|q"tk r}ttj|jj|d t|q"t k r} |jj|| j| j| jq"Xq"WWntk r|rtd qntjk r/} | jtjkrtd qtd tjnetk rtd tjy,|jj|t jd ttjWqtk rqXnXWd|r|jjtj d nXdS(NitmethodtidtparamssUnsupported operationtplugin_registertplugin_unregisteriDis!Client went away, exiting plug-ins Unhandled exception in plug-in! sUnhandled exception in plug-ini(!RRRRtread_reqthasattrRR RRRt NO_SUPPORTt send_resptcloseRRR%R&R!R"tAttributeErrortcodetmsgtdatat _SocketEOFRterrnotEPIPERt PLUGIN_BUGR2RR'( R(t need_shutdowntmsg_idR:R.R0tresulttvetaetlsm_errtse((s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pytrunTsl                  (t__name__t __module__t__doc__t staticmethodRR-RG(((s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pyR's (RR%RtlsmRRRt lsm.lsmcliRR#R=t lsm._commonRR<tlsm._transportRRtobjectR(((s5/usr/lib/python2.7/site-packages/lsm/_pluginrunner.pyts