Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/dellemc/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/dellemc/idrac_firmware.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
y*dd
lmZddlmZeZWnek
r�eZnXd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: idrac_firmware
short_description: Firmware update from a repository on a network share (CIFS, NFS).
version_added: "2.8"
description:
    - Update the Firmware by connecting to a network share (either CIFS or NFS) that contains a catalog of
        available updates.
    - Network share should contain a valid repository of Update Packages (DUPs) and a catalog file describing the DUPs.
    - All applicable updates contained in the repository are applied to the system.
    - This feature is available only with iDRAC Enterprise License.
options:
    idrac_ip:
        description: iDRAC IP Address.
        type: str
        required: True
    idrac_user:
        description: iDRAC username.
        type: str
        required: True
    idrac_password:
        description: iDRAC user password.
        type: str
        required: True
        aliases: ['idrac_pwd']
    idrac_port:
        description: iDRAC port.
        type: int
        default: 443
    share_name:
        description: CIFS or NFS Network share.
        type: str
        required: True
    share_user:
        description: Network share user in the format 'user@domain' or 'domain\\user' if user is
            part of a domain else 'user'. This option is mandatory for CIFS Network Share.
        type: str
    share_password:
        description: Network share user password. This option is mandatory for CIFS Network Share.
        type: str
        aliases: ['share_pwd']
    share_mnt:
        description: Local mount path of the network share with read-write permission for ansible user.
            This option is mandatory for Network Share.
        type: str
        required: True
    reboot:
        description: Whether to reboots after applying the updates or not.
        type: bool
        default: false
    job_wait:
        description: Whether to wait for job completion or not.
        type: bool
        default: true
    catalog_file_name:
        required: False
        description: Catalog file name relative to the I(share_name).
        type: str
        default: 'Catalog.xml'

requirements:
    - "omsdk"
    - "python >= 2.7.5"
author: "Rajeev Arakkal (@rajeevarakkal)"
s�
---
- name: Update firmware from repository on a Network Share
  idrac_firmware:
       idrac_ip: "192.168.0.1"
       idrac_user: "user_name"
       idrac_password: "user_password"
       share_name: "192.168.0.0:/share"
       share_user: "share_user_name"
       share_password: "share_user_pwd"
       share_mnt: "/mnt/share"
       reboot: True
       job_wait: True
       catalog_file_name: "Catalog.xml"
s
---
msg:
  type: str
  description: Over all firmware update status.
  returned: always
  sample: "Successfully updated the firmware."
update_status:
  type: dict
  description: Firmware Update job and progress details from the iDRAC.
  returned: success
  sample: {
        'InstanceID': 'JID_XXXXXXXXXXXX',
        'JobState': 'Completed',
        'Message': 'Job completed successfully.',
        'MessageId': 'REDXXX',
        'Name': 'Repository Update',
        'JobStartTime': 'NA',
        'Status': 'Success',
    }
(tiDRACConnection(t
AnsibleModule(tUserCredentials(tFileOnSharecC`sC|j�}|s!td��n|jd�s?td��ndS(Ns/catalog_file_name should be a non-empty string.txmls(catalog_file_name should be an XML file.(tlowert
ValueErrortendswith(tcatalog_file_nametnormilized_file_name((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/dellemc/idrac_firmware.pyt_validate_catalog_file�s
cC`sgi}t|d<i|d<y�td|jdd|jdd|jdd	td
t|jd|jd��}t|_d
|jks�d|jkr�t|_nt}|jj|||jd|jd�|d<Wn)t	k
r}|j
dt|��nXd|dkrc|dddkrF|jdr`t|d<q`qc|j
ddd|d�n|S(s@Update firmware from a network share and return the job details.tchangedt
update_statustremotet
share_namet/Rtmount_pointt	share_mnttisFoldertcredst
share_usertshare_passwordt12t13treboottjob_waittmsgtStatustSuccesssFailed to update firmware.(tFalseRtparamsR
tTruetuse_redfishtServerGenerationt
update_mgrtupdate_from_repotRuntimeErrort	fail_jsontstr(tidractmoduleR"t	upd_sharetapply_updatete((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/dellemc/idrac_firmware.pytupdate_firmware�s4

"

	

cC`s�tdiitd6dd6d6itd6dd6d6itd6dd6dgd6td	6d
6itd6dd6d
d6d6itd6dd6d6itd6dd6d6itd6dd6dgd6td	6d6itd6dd6d6itd6dd6dd6d6itd6dd6td6d6itd6dd6td6d6dt�}y<t|jd�t|j��}t||�}WdQXWn2ttt	fk
r�}|j
dt|��nX|jddd|�dS(Nt
argument_spectrequiredR.ttypetidrac_ipt
idrac_usert	idrac_pwdtaliasestno_logtidrac_passwordi�tdefaulttintt
idrac_portRRt	share_pwdRRsCatalog.xmlRtboolR R!tsupports_check_modeR"s"Successfully updated the firmware.R(
R	R'R%RR&RR4tImportErrorRR,R-R.t	exit_json(R0R/RR3((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/dellemc/idrac_firmware.pytmain�s*&&	t__main__N(t
__future__RRRR7t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNt<ansible.module_utils.remote_management.dellemc.dellemc_idracRtansible.module_utils.basicR	tomsdk.sdkcredsR
t
omsdk.sdkfileRR't	HAS_OMSDKRDR%RR4RFt__name__(((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/dellemc/idrac_firmware.pyt<module>
s(


B


		$	 

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]