HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/dracr.cpython-310.pyc
o

�N�g0��	@s�dZddlZddlZddlZddlZddlmZe�e	�Z
dgZzedZ
Wneefy<ddlZdejjj
iZYnwdd�Zdd	�Z	ddd
d�Z	dddd
�Zdedd�Zdedd�Zdddd�Z								dfdd�Z	dgdd�Zdddd�Zdddd�Z					dhdd�Zded d!�Zddd"d#�Z 	ddd$d%�Z!					dgd&d'�Z"	ddd(d)�Z#ddd*d+�Z$				ddd,d-�Z%	ddd.d/�Z&ded0d1�Z'	ded2d3�Z(	ddd4d5�Z)ddd6d7�Z*ddd8d9�Z+ddd:d;�Z,ddd<d=�Z-	ddd>d?�Z.ded@dA�Z/dedBdC�Z0dedDdE�Z1dedFdG�Z2dedHdI�Z3dedJdK�Z4dedLdM�Z5dedNdO�Z6dedPdQ�Z7	dedRdS�Z8dedTdU�Z9	dedVdW�Z:dedXdY�Z;				dddZd[�Z<ded\d]�Z=ded^d_�Z>ded`da�Z?	dedbdc�Z@dS)iz/
Manage Dell DRAC.

.. versionadded:: 2015.8.2
�N)�CommandExecutionErrorZfx2�cmd.run_allcCstjj�d�r	dSdS)NZracadmT)FzFThe drac execution module cannot be loaded: racadm binary not in path.)�salt�utils�path�which�rr�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/dracr.py�__virtual__sr
cCs�i}d}|��D]D}|���d�rd|vr|dd�}i||<|��rLd|vrL||vr>||�tdd�|�d�D�g��q|��}||vrL|rLi||<q|S)z 
    Parse Dell DRAC output
    ��:�=r���cSsg|]}|���qSr)�strip)�.0Zproprrr	�
<listcomp>1sz __parse_drac.<locals>.<listcomp>)�
splitlinesr�endswith�rstrip�update�dict�split)�output�drac�section�irrr	�__parse_drac$s&�rcCs�|r|�d�rd||�d�dt|����}nd|��}nd}|s0tdd|�d	|���}ntdd
�|||||�dd�}|d
dkrOt�d|d
�dSdS)�
    Execute rac commands
    ZALL_�-a �_��-m rr�racadm � �racadm -r {} -u {} -p {} {} {}�quiet�Zoutput_loglevel�retcoder�"racadm returned an exit code of %sFT)�
startswith�index�len�lower�__salt__�format�log�warning)�command�host�admin_username�admin_password�module�	modswitch�cmdrrr	�
__execute_cmd:s"
$
��r8c	Cs�|r|dkr	d}nd|��}nd}|s tdd|�d|���}ntdd�|||||�d	d
�}|ddkr?t�d
|d�|Sg}|d��D]+}|�d�rOqG|�d�rVn|�d�r]n|�d�rcqG|��shqG|�|�d|vrrqGqGd�|�|d<|S)rZALLrr!rrr"r#r$r%r&r'rr(�stdoutzSecurity AlertzRAC1168:zRAC1169:zContinuing executionr
�
)	r-r.r/r0rr)r�append�join)	r1r2r3r4r5r6r7Zfmtlines�lrrr	�
__execute_ret\sD
���




�r>cCs td|||d�}t|d�}|S)Nzget iDRAC.NIC.DNSRacName�r2r3r4r9)r>r)r2r3r4�ret�parsedrrr	�get_dns_dracname�s�rBcCstd|��|||d�}|S)Nzset iDRAC.NIC.DNSRacName r?�r>)�namer2r3r4r@rrr	�set_dns_dracname�s�rEcCs>td||||d�}|ddkrt�d|d�|St|d�S)zt
    Return System information

    CLI Example:

    .. code-block:: bash

        salt dell dracr.system_info
    Z
getsysinfo�r2r3r4r5r'rr(r9)r>r/r0r)r2r3r4r5r7rrr	�system_info�s
�rGFc	Cs@d}|r	|d7}n|d|d|d|7}t|||||d�S)Nz
setniccfg z-d z-s r#rF�r8)	�ip�netmask�gatewayZdhcpr2r3r4r5�cmdstrrrr	�
set_niccfg�s
�rMcCs&d}|r||7}t|||||d�}|S)Nz
setniccfg -v rFrH)Zvlanr2r3r4r5rLr@rrr	�set_nicvlan�s�rNcCs�t|||d�}|duri}d|d<d|d<|S||�d�vr5||�d�vr5i}d|d<d	|�d
�|d<|Std||||d�}|dd
krLt�d|d�d|d|d|d<t|d�S)zx
    Return Network Configuration

    CLI Example:

    .. code-block:: bash

        salt dell dracr.network_info
    r?Nrr'z Problem getting switch inventoryr9�switch�serverz
No module z found.Z	getniccfgrFrr(zNetwork:
Device = r:)�	inventory�getr>r/r0r)r2r3r4r5�invr7rrr	�network_info�s0��rTcCsbt|�dkr
t�d�dStdt|�d�D]}td|�d||d��||||d�s.dSqdS)	a5
    Configure the nameservers on the DRAC

    CLI Example:

    .. code-block:: bash

        salt dell dracr.nameservers [NAMESERVERS]
        salt dell dracr.nameservers ns1.example.com ns2.example.com
            admin_username=root admin_password=calvin module=server-1
            host=192.168.1.1
    �z$racadm only supports two nameserversFr z*config -g cfgLanNetworking -o cfgDNSServerr#rFT)r+r/r0�ranger8)�nsr2r3r4r5rrrr	�nameserverss
��	rXTcCs@|rtd|||dd�rtd|��||||d�Std||||d�S)am
    Configure syslog remote logging, by default syslog will automatically be
    enabled if a server is specified. However, if you want to disable syslog
    you will need to specify a server followed by False

    CLI Example:

    .. code-block:: bash

        salt dell dracr.syslog [SYSLOG IP] [ENABLE/DISABLE]
        salt dell dracr.syslog 0.0.0.0 False
    z3config -g cfgRemoteHosts -o cfgRhostsSyslogEnable 1NrFz3config -g cfgRemoteHosts -o cfgRhostsSyslogServer1 z3config -g cfgRemoteHosts -o cfgRhostsSyslogEnable 0rH)rP�enabler2r3r4r5rrr	�syslog2s*���rZcCs|r
td|||d�Std�S)z�
    Enable/Disable email alerts

    CLI Example:

    .. code-block:: bash

        salt dell dracr.email_alerts True
        salt dell dracr.email_alerts False
    z5config -g cfgEmailAlert -o cfgEmailAlertEnable -i 1 1r?z5config -g cfgEmailAlert -o cfgEmailAlertEnable -i 1 0rH)�actionr2r3r4rrr	�email_alerts^s�r\cCs�i}d}tdd�D]P}td|��|||d�}|ddkr$t�d|d�|d	��D].}|�d
�s2q*|�d�\}	}
|	�d�rM|
��}|
rKd
|i||<q*n|rX||�|	|
i�q*q	|S)zm
    List all DRAC users

    CLI Example:

    .. code-block:: bash

        salt dell dracr.list_users
    rr �zgetconfig -g cfgUserAdmin -i r?r'rr(r9Zcfgr
ZcfgUserAdminUserNamer*)	rVr>r/r0rr)rrr)r2r3r4r5�usersZ	_username�idxr7�user�key�valrrr	�
list_usersus0
�

�rccCsF|dur
t�}||d}|rtd|�d�|||d�St�d|�dS)z�
    Delete a user

    CLI Example:

    .. code-block:: bash

        salt dell dracr.delete_user [USERNAME] [UID - optional]
        salt dell dracr.delete_user diana 4
    Nr*�2config -g cfgUserAdmin -o cfgUserAdminUserName -i r#r?zUser '%s' does not existF)rcr8r/r0)�username�uidr2r3r4r`rrr	�delete_user�s

�rgcCsft|�dkr
td��|durt||||d�}||d}|r+td�||�||||d�St�d|�dS)	a�
    Change user's password

    CLI Example:

    .. code-block:: bash

        salt dell dracr.change_password [USERNAME] [PASSWORD] uid=[OPTIONAL]
            host=<remote DRAC> admin_username=<DRAC user>
            admin_password=<DRAC PW>
        salt dell dracr.change_password diana secret

    Note that if only a username is specified then this module will look up
    details for all 16 possible DRAC users.  This is time consuming, but might
    be necessary if one is not sure which user slot contains the one you want.
    Many late-model Dell chassis have 'root' as UID 1, so if you can depend
    on that then setting the password is much quicker.
    Raises an error if the supplied password is greater than 20 chars.
    �z1Supplied password should be 20 characters or lessNrFr*z7config -g cfgUserAdmin -o cfgUserAdminPassword -i {} {}z racadm: user '%s' does not existF)r+rrcr8r.r/r0)re�passwordrfr2r3r4r5r`rrr	�change_password�s,���
rjcCstd|�d|��||||d�S)a�
    Change the QuickDeploy password, used for switches as well

    CLI Example:

    .. code-block:: bash

        salt dell dracr.deploy_password [USERNAME] [PASSWORD]
            host=<remote DRAC> admin_username=<DRAC user>
            admin_password=<DRAC PW>
        salt dell dracr.change_password diana secret

    Note that if only a username is specified then this module will look up
    details for all 16 possible DRAC users.  This is time consuming, but might
    be necessary if one is not sure which user slot contains the one you want.
    Many late-model Dell chassis have 'root' as UID 1, so if you can depend
    on that then setting the password is much quicker.
    z
deploy -u z -p rFrH)rerir2r3r4r5rrr	�deploy_password�s�rkcCstd|�d�||||d�S)aJ
    Change the QuickDeploy SNMP community string, used for switches as well

    CLI Example:

    .. code-block:: bash

        salt dell dracr.deploy_snmp SNMP_STRING
            host=<remote DRAC or CMC> admin_username=<DRAC user>
            admin_password=<DRAC PW>
        salt dell dracr.deploy_password diana secret

    zdeploy -v SNMPv2 z rorFrH)Zsnmpr2r3r4r5rrr	�deploy_snmps
�rlc
Cst�}|dur
t�}||vrt�d|�dS|��D]}|�||d�qttttdd��|�dd��	�}	t
d	|	�d
|��|||d�sLt||	�dSt|||	�s^t�d�t||	�dSt
|||	�spt�d
�t||	�dSt
d|	�d��st||	�dSdS)a�
    Create user accounts

    CLI Example:

    .. code-block:: bash

        salt dell dracr.create_user [USERNAME] [PASSWORD] [PRIVILEGES]
        salt dell dracr.create_user diana secret login,test_alerts,clear_logs

    DRAC Privileges
      * login                   : Login to iDRAC
      * drac                    : Configure iDRAC
      * user_management         : Configure Users
      * clear_logs              : Clear Logs
      * server_control_commands : Execute Server Control Commands
      * console_redirection     : Access Console Redirection
      * virtual_media           : Access Virtual Media
      * test_alerts             : Test Alerts
      * debug_commands          : Execute Debug Commands
    Nz racadm: user '%s' already existsFr*rU�T)�reverserdr#r?zunable to set user permissionszunable to set user passwordz0config -g cfgUserAdmin -o cfgUserAdminEnable -i z 1)�setrcr/r0�keys�add�sorted�listrV�popr8rg�set_permissionsrj)
reri�permissionsr^r2r3r4Z_uidsr_rfrrr	�create_user+s:"�





rwc
Cs�ddddddddd	d
�	}d}|durt�}||d
}|�d�D]}	|	��}
|
|vr3|t||
d�7}q td�||�|||d�S)a�
    Configure users permissions

    CLI Example:

    .. code-block:: bash

        salt dell dracr.set_permissions [USERNAME] [PRIVILEGES]
             [USER INDEX - optional]
        salt dell dracr.set_permissions diana login,test_alerts,clear_logs 4

    DRAC Privileges
      * login                   : Login to iDRAC
      * drac                    : Configure iDRAC
      * user_management         : Configure Users
      * clear_logs              : Clear Logs
      * server_control_commands : Execute Server Control Commands
      * console_redirection     : Access Console Redirection
      * virtual_media           : Access Virtual Media
      * test_alerts             : Test Alerts
      * debug_commands          : Execute Debug Commands
    Z	0x0000001Z	0x0000002Z	0x0000004Z	0x0000008Z	0x0000010Z	0x0000020Z	0x0000040Z	0x0000080Z	0x0000100)	ZloginrZuser_managementZ
clear_logsZserver_control_commandsZconsole_redirectionZ
virtual_mediaZtest_alertsZdebug_commandsrNr*�,�z>config -g cfgUserAdmin -o cfgUserAdminPrivilege -i {} 0x{:08X}r?)rcrr�intr8r.)rervrfr2r3r4Z
privilegesZ
permissionr`r�permrrr	ruus6����rucC�td|��|||d�S)a
    Configure CMC or individual iDRAC SNMP community string.
    Use ``deploy_snmp`` for configuring chassis switch SNMP.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.set_snmp [COMMUNITY]
        salt dell dracr.set_snmp public
    z1config -g cfgOobSnmp -o cfgOobSnmpAgentCommunity r?rH)Z	communityr2r3r4rrr	�set_snmp�s�r}c	Cstdj||||||d��S)ar
    Configure Network on the CMC or individual iDRAC.
    Use ``set_niccfg`` for blade and switch addresses.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.set_network [DRAC IP] [NETMASK] [GATEWAY]
        salt dell dracr.set_network 192.168.0.2 255.255.255.0 192.168.0.1
            admin_username=root admin_password=calvin host=192.168.1.1
    zsetniccfg -s {} {} {}r?)r8r.)rIrJrKr2r3r4rrr	�set_network�s��r~cCstd|��||||d�S)a#
    status
        One of 'powerup', 'powerdown', 'powercycle', 'hardreset',
        'graceshutdown'

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    module
        The element to reboot on the chassis such as a blade. If not provided,
        the chassis will be rebooted.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.server_reboot
        salt dell dracr.server_reboot module=server-1

    z
serveraction rFrH)�statusr2r3r4r5rrr	�server_power�s�r�cC�td||||d�S)a|
    Issues a power-cycle operation on the managed server. This action is
    similar to pressing the power button on the system's front panel to
    power down and then power up the system.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    module
        The element to reboot on the chassis such as a blade. If not provided,
        the chassis will be rebooted.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.server_reboot
        salt dell dracr.server_reboot module=server-1

    zserveraction powercyclerFrHrFrrr	�
server_reboots�r�cCr�)a�
    Powers down the managed server.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    module
        The element to power off on the chassis such as a blade.
        If not provided, the chassis will be powered off.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.server_poweroff
        salt dell dracr.server_poweroff module=server-1
    zserveraction powerdownrFrHrFrrr	�server_poweroff+��r�cCr�)a�
    Powers up the managed server.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    module
        The element to power on located on the chassis such as a blade. If
        not provided, the chassis will be powered on.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.server_poweron
        salt dell dracr.server_poweron module=server-1
    zserveraction poweruprFrHrFrrr	�server_poweronLr�r�cCr�)a
    Performs a reset (reboot) operation on the managed server.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    module
        The element to hard reset on the chassis such as a blade. If
        not provided, the chassis will be reset.

    CLI Example:

    .. code-block:: bash

        salt dell dracr.server_hardreset
        salt dell dracr.server_hardreset module=server-1
    zserveraction hardresetrFrHrFrrr	�server_hardresetmr�r�cCsxtd||||d�}ddi}|ddkrd|d<d	|d
<|ddkr)d|d<d	|d
<|d�d
�r:d|d<|d|d
<|S)z�
    return the power status for the passed module

    CLI Example:

    .. code-block:: bash

        salt dell drac.server_powerstatus
    zserveraction powerstatusrFr'rr9ZONTrzPower is onZcommentZOFFF�ERROR)r>r))r2r3r4r5r@�resultrrr	�server_powerstatus�s$�r�cCs@td|||d�rtd|||d�rtSt�d�dSt�d�dS)z�
    Configure server to PXE perform a one off PXE boot

    CLI Example:

    .. code-block:: bash

        salt dell dracr.server_pxe
    z7config -g cfgServerInfo -o cfgServerFirstBootDevice PXEr?z.config -g cfgServerInfo -o cfgServerBootOnce 1zfailed to set boot orderFzfailed to configure PXE boot)r8r�r/r0r?rrr	�
server_pxe�s"
��

r�cCs�td|||d�}|ddkr|Si}d}|d��D]S}|�d�r$d}q|r'q|��}i||d<|d||dd	<t|�d
krL|d
||dd<nd||dd<t|�d
kre|d
||dd<qd||dd<q|S)a�
    List the names of all slots in the chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt-call --local dracr.list_slotnames host=111.222.333.444
            admin_username=root admin_password=secret

    Zgetslotnamer?r'rTr9�<F�slotr �slotnamerrU�hostname)r>rr)rr+)r2r3r4Zslotraw�slotsZstripheaderr=�fieldsrrr	�list_slotnames�s4�
r�cCs"t|||d�}t|�}||dS)a�
    Get the name of a slot number in the chassis.

    slot
        The number of the slot for which to obtain the name.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt-call --local dracr.get_slotname 0 host=111.222.333.444
           admin_username=root admin_password=secret

    r?r�)r��str)r�r2r3r4r�rrr	�get_slotnames
�r�cCstd|�d|��|||d�S)a�
    Set the name of a slot in a chassis.

    slot
        The slot number to change.

    name
        The name to set. Can only be 15 characters long.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.set_slotname 2 my-slotname host=111.222.333.444
            admin_username=root admin_password=secret

    z,config -g cfgServerInfo -o cfgServerName -i r#r?rH)r�rDr2r3r4rrr	�set_slotname%s�r�cCr|)a�
    Set the name of the chassis.

    name
        The name to be set on the chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.set_chassis_name my-chassis host=111.222.333.444
            admin_username=root admin_password=secret

    zsetsysinfo -c chassisname r?rH)rDr2r3r4rrr	�set_chassis_nameH��r�cCstd|||d�S)as
    Get the name of a chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.get_chassis_name host=111.222.333.444
            admin_username=root admin_password=secret

    Zgetchassisnamer?)�bare_rac_cmdr?rrr	�get_chassis_namehs�r�c
Cs�dd�}i}gd�|d<gd�|d<gd�|d<gd	�|d
<td|||d�}|d
dkr.|Sd}d}d}d}	i}
i|
d<i|
d<i|
d<i|
d
<|d��D]�}|�d�r^d}d}d}d}	qN|�d�rld}d}d}d}	qN|�d�rzd}d}d}d}	qN|�d�r�d}d}d}d}	qN|s�qNt�d|���}|r�dd�t||d|�D�|
d|d<|r�dd�t||d|�D�|
d|d<|r�dd�t||d|�D�|
d|d<|	r�dd�t||d
|�D�|
d
|d<qN|
S)NcSs||iS)Nr)�x�yrrr	�mapit�szinventory.<locals>.mapit)rDZ
idrac_versionZ
blade_type�gen�
updateablerP)rDZ
model_nameZ
hw_version�
fw_versionrO)rDZcmc_versionr�Zcmc)rDr�ZfqddZchassisZ
getversionr?r'rFr9z<Server>Tz<Switch>z<CMC>z<Chassis Infrastructure>z  +cS�$i|]}|��D]\}}||�qqSr��items�r�d�k�vrrr	�
<dictcomp>��
�
�zinventory.<locals>.<dictcomp>cSr�rr�r�rrr	r��r�cSr�rr�r�rrr	r��r�cSr�rr�r�rrr	r��r�)r>rr)�rerr�map)
r2r3r4r�r�ZrawinvZ	in_serverZ	in_switchZin_cmcZ
in_chassisr@r=�linerrr	rQ�s��



�����rQcCr|)a�
    Set the location of the chassis.

    location
        The name of the location to be set on the chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.set_chassis_location location-name host=111.222.333.444
            admin_username=root admin_password=secret

    zsetsysinfo -c chassislocation r?rH��locationr2r3r4rrr	�set_chassis_location�r�r�cCst|||d�ddS)a|
    Get the location of the chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.set_chassis_location host=111.222.333.444
           admin_username=root admin_password=secret

    r?zChassis InformationzChassis Location)rGr?rrr	�get_chassis_location�s���r�cCstdd||||d�S)a�
    Set the location of the chassis.

    location
        The name of the datacenter to be set on the chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.set_chassis_datacenter datacenter-name host=111.222.333.444
            admin_username=root admin_password=secret

    �cfgLocation�cfgLocationDatacenterr?)�set_generalr�rrr	�set_chassis_datacenters�r�cCstdd|||d�S)a~
    Get the datacenter of the chassis.

    host
        The chassis host.

    admin_username
        The username used to access the chassis.

    admin_password
        The password used to access the chassis.

    CLI Example:

    .. code-block:: bash

        salt '*' dracr.set_chassis_location host=111.222.333.444
           admin_username=root admin_password=secret

    r�r�r?)�get_generalr?rrr	�get_chassis_datacenter6s�r�cCs"td|�d|�d|��|||d�S)Nz
config -g � -o r#r?rH)�cfg_sec�cfg_varrbr2r3r4rrr	r�Ts�r�cCs4td|�d|��|||d�}|ddkr|dS|S)Nz
getconfig -g r�r?r'rr9rC)r�r�r2r3r4r@rrr	r�_s�r�c
CsTt||||�}|dur|}n|}|dd}t||d|d�}	|	ddkr(|	dS|	S)	a
    Run a generic racadm command against a particular
    blade in a chassis.  Blades are usually named things like
    'server-1', 'server-2', etc.  If the iDRAC has a different
    password than the CMC, then you can pass it with the
    idrac_password kwarg.

    :param blade_name: Name of the blade to run the command on
    :param command: Command like to pass to racadm
    :param idrac_password: Password for the iDRAC if different from the CMC
    :param host: Chassis hostname
    :param admin_username: CMC username
    :param admin_password: CMC password
    :return: stdout if the retcode is 0, otherwise a standard cmd.run_all dictionary

    CLI Example:

    .. code-block:: bash

        salt fx2 chassis.cmd idrac_general server-1 'get BIOS.SysProfileSettings'

    NZNetworkz
IP Address�rootr?r'rr9)rTr>)
Z
blade_namer1Zidrac_passwordr2r3r4Zmodule_networkriZidrac_ipr@rrr	�
idrac_generalms�r�cCsH|stdd}|stdd}t||||d�}|ddkr"|dS|S)N�proxyr3r4r?r'rr9)Z
__pillar__r>�r7r2r3r4r@rrr	�_update_firmware�s�r�cCs*t|�|||d�}|ddkr|dS|S)Nr?r'rr9rCr�rrr	r��s�r�cCs0tj�|�rtd|��dddd�Std|����)uM
    Updates firmware using local firmware file

    .. code-block:: bash

         salt dell dracr.update_firmware firmware.exe

    This executes the following command on your FX2
    (using username and password stored in the pillar data)

    .. code-block:: bash

         racadm update –f firmware.exe -u user –p pass

    �
update -f Nr?�Unable to find firmware file ��osr�existsr�r)�filenamer2r3r4rrr	�update_firmware�s�r�cCs6tj�|�rtd|�d|��dddd�Std|����)u�
    Executes the following for CIFS
    (using username and password stored in the pillar data)

    .. code-block:: bash

         racadm update -f <updatefile> -u user –p pass -l //IP-Address/share

    Or for NFS
    (using username and password stored in the pillar data)

    .. code-block:: bash

          racadm update -f <updatefile> -u user –p pass -l IP-address:/share


    Salt command for CIFS:

    .. code-block:: bash

         salt dell dracr.update_firmware_nfs_or_cifs          firmware.exe //IP-Address/share


    Salt command for NFS:

    .. code-block:: bash

         salt dell dracr.update_firmware_nfs_or_cifs          firmware.exe IP-address:/share
    r�z -l Nr?r�r�)r��sharer2r3r4rrr	�update_firmware_nfs_or_cifs�s"�r�)NNNN)NNN)NNNFNNNN)NNNNN)TNNNN)A�__doc__�loggingr�r�Zsalt.utils.pathrZsalt.exceptionsr�	getLogger�__name__r/Z__proxyenabled__r-Zrun_all�	NameError�KeyErrorZsalt.modules.cmdmod�modulesZcmdmodr
rr8r>rBrErGrMrNrTrXrZr\rcrgrjrkrlrwrur}r~r�r�r�r�r�r�r�r�r�r�r�r�rQr�r�r�r�r�r�r�r�r�r�r�rrrr	�<module>s�
�

�#
�
0


�
�

) 
�
,
-
�!
�8
�

�K
�
=
�
�
&
$
!
!"
�
"

5
!
#
 

S
 
�
$
�

�
2

�