%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c@@s�dZddlmZmZmZddlZyddlZeZWne	k
r]e
ZnXeje�Z
d�Zdddd�Zd�Zdddd�Zdddd	�Zdddd
�Zdddd�Zdddd�ZdS(
u�
Manage Dell DRAC from the Master

The login credentials need to be configured in the Salt master
configuration file.

.. code-block: yaml

    drac:
      username: admin
      password: secret

i(tabsolute_importtprint_functiontunicode_literalsNcC@str
tStdfS(NuKThe drac runner module cannot be loaded: paramiko package is not installed.(tHAS_PARAMIKOtTruetFalse(((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pyt__virtual__sicC@s�tjd�}d}|sM|d	kr8tj|�tS|jdd	�}n|s�|d	krptj|�tS|jdd	�}ntj�}|jtj	��y#|j
|d|d|d|�Wn'tk
r�}tjd||�tSX|S(
u
    Connect to the DRAC
    udracu�No drac login credentials found. Please add the 'username' and 'password' fields beneath a 'drac' key in the master configuration file. Or you can pass in a username and password as kwargs at the CLI.uusernameupasswordtusernametpasswordttimeoutuUnable to connect to %s: %sN(t__opts__tgettNonetlogterrorRtparamikot	SSHClienttset_missing_host_key_policyt
AutoAddPolicytconnectt	Exception(thostnameR	RRt	drac_credterr_msgtclientte((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pyt	__connect%s(

#cC@s�idd6dd6dd6dd6dd6dd	6}t|tj�r�|jd
�\}}}xQ|j�D]@}|djd�rg|jt|djd
�d�d�SqgWndS(u
    Grab DRAC version
    uCMCi	uiDRAC6ii
iuiDRAC7iiuracadm getconfig -g idRacInfoiu	idRacTypeu=iN(
t
isinstanceRRtexec_commandt	readlinest
startswithRtinttsplitR(Rtversionststdintstdouttstderrti((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pyt	__versionEs

.cC@s�dddg}t||||�}t|tj�r�xEt|d�D]4\}}tjd|�|j|�\}}	}
qFWd|	j�kr�tjd|�q�tj	d|�t
SntS(	u�
    Connect to the Dell DRAC and have the boot order set to PXE
    and power cycle the system to PXE boot

    CLI Example:

    .. code-block:: bash

        salt-run drac.pxe example.com
    u>racadm config -g cfgServerInfo -o cfgServerFirstBootDevice pxeu5racadm config -g cfgServerInfo -o cfgServerBootOnce 1uracadm serveraction powercycleiuExecuting command %su
successfuluExecuting command: %suUnable to execute: %s(RRRRt	enumerateR
tinfoRtreadlineRRR(RR	RRt_cmdsRR%tcmdR"R#R$((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pytpxeZs	cC@s�t||||�}t|tj�ru|jd�\}}}d|j�kratjd�q�tjd�t	Sntjd�t	St
S(u�
    Reboot a server using the Dell DRAC

    CLI Example:

    .. code-block:: bash

        salt-run drac.reboot example.com
    uracadm serveraction powercycleu
successfulupowercycle successfulu powercycle racadm command failedu)client was not of type paramiko.SSHClient(RRRRRR)R
R(RRR(RR	RRRR"R#R$((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pytreboot|s


cC@s�t||||�}t|tj�ru|jd�\}}}d|j�kratjd�q�tjd�t	Sntjd�t	St
S(ur
    Power server off

    CLI Example:

    .. code-block:: bash

        salt-run drac.poweroff example.com
    uracadm serveraction powerdownu
successfulupowerdown successfulupowerdown racadm command failedu)client was not of type paramiko.SSHClient(RRRRRR)R
R(RRR(RR	RRRR"R#R$((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pytpoweroff�s


cC@s�t||||�}t|tj�ru|jd�\}}}d|j�kratjd�q�tjd�t	Sntjd�t	St
S(up
    Power server on

    CLI Example:

    .. code-block:: bash

        salt-run drac.poweron example.com
    uracadm serveraction powerupu
successfulupowerup successfulupowerup racadm command failedu)client was not of type paramiko.SSHClient(RRRRRR)R
R(RRR(RR	RRRR"R#R$((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pytpoweron�s


cC@stt||||��S(u|
    Display the version of DRAC

    CLI Example:

    .. code-block:: bash

        salt-run drac.version example.com
    (R&R(RR	RR((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pytversion�s
(t__doc__t
__future__RRRtloggingRRRtImportErrorRt	getLoggert__name__R
RRRR&R,R-R.R/R0(((s5/usr/lib/python2.7/site-packages/salt/runners/drac.pyt<module>s 


	 	"

Zerion Mini Shell 1.0