B
    `                  @   sj   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 deZd	d
 Zedkrfe  dS )    )absolute_importdivisionprint_functiona_  
---
module: edit_fru
version_added: "0.1.0"
author:
    - WangBaoshan (@ISIB-group)
short_description: Set fru settings.
description:
   - Set fru settings on Inspur server.
options:
    attribute:
        description:
            - Attribute,CP is Chassis Part Number,CS is Chassis Serial,PM is Product Manufacturer,
            - PPN is Product Part Number,PS is Product Serial,PN is Product Name,PV is Product Version,
            - PAT is Product Asset Tag,BM is Board Mfg,BPN is Board Product Name,BS is Board Serial,
            - BP is Board Part Number.
        choices: ['CP', 'CS', 'PM', 'PPN', 'PS', 'PN', 'PV','PAT', 'BM', 'BPN', 'BS', 'BP']
        required: true
        type: str
    value:
        description:
            - Set the value of attribute.
        required: true
        type: str
extends_documentation_fragment:
    - inspur.sm.ism
a>  
- name: Fru test
  hosts: ism
  connection: local
  gather_facts: no
  vars:
    ism:
      host: "{{ ansible_ssh_host }}"
      username: "{{ username }}"
      password: "{{ password }}"

  tasks:

  - name: "Set Fru"
    inspur.sm.edit_fru:
      attribute: "CP"
      value: "Inspur"
      provider: "{{ ism }}"

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)ism_argument_specget_connectionc               @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )UIDc             C   s    || _ d | _|   t | _d S )N)specmoduleinit_moduledictresults)selfargument_spec r   e/home/dcms/DCMS/lib/python3.7/site-packages/ansible_collections/inspur/sm/plugins/modules/edit_fru.py__init__P   s    zUID.__init__c             C   s   t | jdd| _dS )zInit module objectF)r   Zsupports_check_modeN)r   r	   r
   )r   r   r   r   r   V   s    zUID.init_modulec             C   s4   d| j jd< t| j | _| jd dkr0d| jd< d S )NZsetfru
subcommandZStateZSuccessTchanged)r
   paramsr   r   )r   r   r   r   run_command\   s    zUID.run_commandc             C   s   | j jf | j dS )zShow resultN)r
   Z	exit_jsonr   )r   r   r   r   show_resultb   s    zUID.show_resultc             C   s   |    |   dS )ZWorkerN)r   r   )r   r   r   r   workf   s    zUID.workN)__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r   O   s
   r   c              C   sT   t t ddddddddd	d
ddddgdt dddd} | t t| }|  d S )NstrTZCPCSZPMZPPNZPSZPNZPVZPATZBMZBPNZBSZBP)typerequiredchoices)r   r   )	attributevalue)r   updater   r   r   )r   Zuid_objr   r   r   mainl   s    $
r$   __main__N)
__future__r   r   r   r   __metaclass__ZDOCUMENTATIONZEXAMPLESZRETURNZansible.module_utils.basicr   Z6ansible_collections.inspur.sm.plugins.module_utils.ismr   r   objectr   r$   r   r   r   r   r   <module>   s   
