%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/proxy/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/proxy/ssh_sample.pyo

�
���^c@@sdZddlmZmZmZddlZddlZddlm	Z	ddl
mZdgZiZ
eje�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z dS(u
    This is a simple proxy-minion designed to connect to and communicate with
    a server that exposes functionality via SSH.
    This can be used as an option when the device does not provide
    an api over HTTP and doesn't have the python stack to run a minion.
i(tabsolute_importtprint_functiontunicode_literalsN(t
SSHConnection(tTerminalExceptionu
ssh_samplecC@stjd�tS(u6
    Only return if all the modules are available
    u(ssh_sample proxy __virtual__() called...(tlogtinfotTrue(((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pyt__virtual__s
cC@s�y^tdtdddtdddtdd�td<tdjd	�\}}ttd
<Wn!tk
r�}tj|�tSXdS(uH
    Required.
    Can be used to initialize the server connection.
    thostuproxyuhosttusernameuusernametpasswordupassworduserveruhelpuinitializedN(	Rt__opts__tDETAILStsendlineRRRterrortFalse(toptstoutterrte((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytinit&s
cC@stjdt�S(u�
    Since grains are loaded in many different places and some of those
    places occur before the proxy can be initialized, return whether
    our init() function has been called
    uinitialized(R
tgetR(((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytinitialized7scC@sLtjdi�sDd}tdj|�\}}t|�td<ntdS(u0
    Get the grains from the proxied device
    ugrains_cacheuinfouserver(R
RRtparse(tcmdRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytgrains@s
cC@sdtd<t�S(u4
    Refresh the grains from the proxied device
    ugrains_cacheN(tNoneR
R(((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytgrains_refreshQs
cC@sidd6S(NuaThis key is here because a function in grains/ssh_sample.py called fns() here in the proxymodule.udetails((((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytfnsYscC@sIy!tdjd�\}}tSWn!tk
rD}tj|�tSXdS(uJ
    Required.
    Ping the device on the other end of the connection
    userveruhelpN(R
RRRRRR(RRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytping^s
cC@stdj�dS(u
    Disconnect
    userverN(R
tclose_connection(R((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytshutdownkscC@s�g}t}xW|jd�D]F}d|kr7t}n|rM|j|�nd|krt}qqWtjjjdj|��S(uw
    Extract json from out.

    Parameter
        out: Type string. The data returned by the
        ssh command.
    u
u{u}(	RtsplitRtappendtsalttutilstjsontloadstjoin(Rtjsonrettin_jsontln_((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pyRrs	
cC@s#tdjd�\}}t|�S(u�
    List "packages" by executing a command via ssh
    This function is called in response to the salt command

    ..code-block::bash
        salt target_minion pkg.list_pkgs

    userveru	pkg_list
(R
RR(RR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytpackage_list�s
cK@sTd|}|jdt�r1|d|d7}ntdj|�\}}t|�S(u/
    Install a "package" on the ssh server
    upkg_install uversionu userver(RRR
RR(tnametkwargsRRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytpackage_install�s

cC@s-d|}tdj|�\}}t|�S(u.
    Remove a "package" on the ssh server
    upkg_remove userver(R
RR(R,RRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytpackage_remove�s
cC@s)d}tdj|�\}}t|�S(uM
    Start a "service" on the ssh server

    .. versionadded:: 2015.8.2
    upsuserver(R
RR(RRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytservice_list�scC@s-d|}tdj|�\}}t|�S(uM
    Start a "service" on the ssh server

    .. versionadded:: 2015.8.2
    ustart userver(R
RR(R,RRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pyt
service_start�s
cC@s-d|}tdj|�\}}t|�S(uL
    Stop a "service" on the ssh server

    .. versionadded:: 2015.8.2
    ustop userver(R
RR(R,RRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytservice_stop�s
cC@s-d|}tdj|�\}}t|�S(uO
    Restart a "service" on the ssh server

    .. versionadded:: 2015.8.2
    urestart userver(R
RR(R,RRR((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pytservice_restart�s
(!t__doc__t
__future__RRRtloggingtsalt.utils.jsonR#tsalt.utils.vt_helperRt
salt.utils.vtRt__proxyenabled__R
t	getLoggert__file__RRRRRRRRR RR+R.R/R0R1R2R3(((s9/usr/lib/python2.7/site-packages/salt/proxy/ssh_sample.pyt<module>s0										
					
			

Zerion Mini Shell 1.0