
    Vh]                     z    d dl mZmZmZ eZdZdZdZd dl	m
Z
 d dlmZmZ  G d de      Zd	 Zed
k(  r e        yy)    )absolute_importdivisionprint_functiona  
---
module: update_cpld
version_added: "1.0.0"
author:
    - WangBaoshan (@ieisystem)
short_description: Update CPLD
description:
   - Update CPLD on ieisystem Server.
notes:
   - Does not support C(check_mode).
options:
    list:
        description:
            - Get cpld list.
            - Only the M5 model supports this parameter.
        choices: [True, False]
        default: False
        type: bool
    id:
        description:
            - CPLD id.
            - Required when I(list=False).
            - Only the M5 model supports this parameter.
        type: int
    file_url:
        description:
            - CPLD image file path.
            - Required when I(list=False).
        type: str
extends_documentation_fragment:
    - ieisystem.inmanage.inmanage
a  
- name: CPLD test
  hosts: inmanage
  connection: local
  gather_facts: false
  vars:
    inmanage:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Get cpld list"
    ieisystem.inmanage.update_cpld:
      list: True
      provider: "{{ inmanage }}"

  - name: "Update cpld"
    update_cpld:
      id: 1
      file_url: "home/wbs/raw.bin"
      provider: "{{ inmanage }}"
a1  
message:
    description: Messages returned after module execution.
    returned: always
    type: str
state:
    description: Status after module execution.
    returned: always
    type: str
changed:
    description: Check to see if a change was made on the device.
    returned: always
    type: bool
)AnsibleModule)inmanage_argument_specget_connectionc                   *    e Zd Zd Zd Zd Zd Zd Zy)CPLDc                 ^    || _         d | _        | j                          t               | _        y )N)specmoduleinit_moduledictresults)selfargument_specs     r/home/dcms/DCMS/lib/python3.12/site-packages/ansible_collections/ieisystem/inmanage/plugins/modules/update_cpld.py__init__zCPLD.__init__Z   s%    !	v    c                 <    t        | j                  d      | _        y)zInit module objectF)r   supports_check_modeN)r   r   r   r   s    r   r   zCPLD.init_module`   s     $))@r   c                     d| j                   j                  d<   t        | j                         | _        | j                  d   dk(  rd| j                  d<   y y )N
updatecpld
subcommandStateSuccessTchanged)r   paramsr   r   r   s    r   run_commandzCPLD.run_commandf   sJ    +7<(%dkk2<< I-&*DLL# .r   c                 P     | j                   j                  di | j                   y)zShow resultN )r   	exit_jsonr   r   s    r   show_resultzCPLD.show_resultl   s    --r   c                 D    | j                          | j                          y)WorkerN)r    r$   r   s    r   workz	CPLD.workp   s    r   N)__name__
__module____qualname__r   r   r    r$   r'   r"   r   r   r
   r
   Y   s    @+.r   r
   c                      t        t        ddddg      t        dd      t        dd            } | j                  t               t        |       }|j	                          y )	NboolFT)typedefaultchoicesint)r-   requiredstr)listidfile_url)r   updater   r
   r'   )r   cpld_objs     r   mainr8   v   sT    vutUmDUU+551M
 /0M"HMMOr   __main__N)
__future__r   r   r   r-   __metaclass__DOCUMENTATIONEXAMPLESRETURNansible.module_utils.basicr   Dansible_collections.ieisystem.inmanage.plugins.module_utils.inmanager   r   objectr
   r8   r(   r"   r   r   <module>rB      sV    C B D2
 5 y6 : zF r   