�
�Udac @` st d d l m Z m Z m Z e Z i d d 6d d 6d g d 6Z d Z d Z d
Z d d l
Z
d d l m Z d d
l
m Z m Z m Z y d d l m Z Wn e k
r� n Xd Z d Z d Z d � Z d � Z d � Z d � Z i e d 6e d 6e d 6Z e d e d d d d d d g � d e d d � d e d d � � Z d � Z d � Z e! d k rpe � n d S(! i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont communityt supported_byt previewt statuss�
---
version_added: "2.8"
author:
- Naval Patel (@navalkp)
- Prashant Bhosale (@prabhosa)
module: lxca_cmms
short_description: Custom module for lxca cmms inventory utility
description:
- This module returns/displays a inventory details of cmms
options:
uuid:
description:
uuid of device, this is string with length greater than 16.
command_options:
description:
options to filter nodes information
default: cmms
choices:
- cmms
- cmms_by_uuid
- cmms_by_chassis_uuid
chassis:
description:
uuid of chassis, this is string with length greater than 16.
extends_documentation_fragment:
- lxca_common
s�
# get all cmms info
- name: get nodes data from LXCA
lxca_cmms:
login_user: USERID
login_password: Password
auth_url: "https://10.243.15.168"
# get specific cmms info by uuid
- name: get nodes data from LXCA
lxca_cmms:
login_user: USERID
login_password: Password
auth_url: "https://10.243.15.168"
uuid: "3C737AA5E31640CE949B10C129A8B01F"
command_options: cmms_by_uuid
# get specific cmms info by chassis uuid
- name: get nodes data from LXCA
lxca_cmms:
login_user: USERID
login_password: Password
auth_url: "https://10.243.15.168"
chassis: "3C737AA5E31640CE949B10C129A8B01F"
command_options: cmms_by_chassis_uuid
s�
result:
description: cmms detail from lxca
returned: success
type: dict
sample:
cmmList:
- machineType: ''
model: ''
type: 'CMM'
uuid: '118D2C88C8FD11E4947B6EAE8B4BDCDF'
# bunch of properties
- machineType: ''
model: ''
type: 'CMM'
uuid: '223D2C88C8FD11E4947B6EAE8B4BDCDF'
# bunch of properties
# Multiple cmms details
N( t
AnsibleModule( t LXCA_COMMON_ARGSt
has_pylxcat connection_object( t cmmss4 UUID of device is required for cmms_by_uuid command.s= UUID of chassis is required for cmms_by_chassis_uuid command.s Success %s resultc C` s
t | � S( N( R ( t modulet lxca_con( ( sT /usr/lib/python2.7/site-packages/ansible/modules/remote_management/lxca/lxca_cmms.pyt _cmmso s c C` s4 | j d s | j d t � n t | | j d � S( Nt uuidt msg( t paramst fail_jsont
UUID_REQUIREDR ( R
R ( ( sT /usr/lib/python2.7/site-packages/ansible/modules/remote_management/lxca/lxca_cmms.pyt
_cmms_by_uuids s
c C` s7 | j d s | j d t � n t | d | j d �S( Nt chassisR ( R R t CHASSIS_UUID_REQUIREDR ( R
R ( ( sT /usr/lib/python2.7/site-packages/ansible/modules/remote_management/lxca/lxca_cmms.pyt _cmms_by_chassis_uuidy s
c C` s2 t t � } | j t � t d | d t � } | S( sY
this function merge argument spec and create ansible module object
:return:
t
argument_spect supports_check_mode( t dictR t updatet INPUT_ARG_SPECR t False( t args_specR
( ( sT /usr/lib/python2.7/site-packages/ansible/modules/remote_management/lxca/lxca_cmms.pyt setup_module_object s
R t cmms_by_uuidt cmms_by_chassis_uuidt command_optionst defaultt choicesR R c C` s� yZ t | � �H } t | j d | | � } | j d t d t | j d d | � Wd QXWnK t k
r� } d j d � | j D� � } | j d | d t
j � � n Xd S( sP
This function invoke commands
:param module: Ansible module object
R# t changedR t resultNs ; c s` s | ] } | Vq d S( N( ( t .0t e( ( sT /usr/lib/python2.7/site-packages/ansible/modules/remote_management/lxca/lxca_cmms.pys <genexpr>� s t exception( R t FUNC_DICTR t exit_jsonR t SUCCESS_MSGt Exceptiont joint argsR t tracebackt
format_exc( R
R R'