B
    `                 @   sr   d dl mZmZmZ eZd dlZd dlZd dlm	Z	 d dl
mZ d dlmZ d dlmZ e ZG dd deZdS )	    )absolute_importdivisionprint_functionN)iosxr_provider_spec)ActionModule)load_provider)Displayc                   s   e Zd Zd fdd	Z  ZS )r   Nc                s  ~| j jdd }|dkr dnd| _|dk}| jjdd }g }| jjdkr2tt| j j}t	
| j}d|_|s|d	 d
krd|_t|d p| jjpd|_n@|d	 dkrd|_t|d p| jjpd|_ndd|d	  dS |d p| jj|_t|d p| jjpd|_|d p$| jj|_|d p8| jj|_| jjjd|tj| j jd}	|	d krd|_|jdd dkrd|_nd|_| jjjd|tj| j jd}	td|j |j |d rt|d n|	d}
|	jd|
id |	 }td| |j |sdd dS ||d!< |d"|j g n|d#kr|rb|dkrbdd$| jj|f dS | j jd%i }t|  rt!d&"| jj | j jd%= ndd'| jj dS t#t$| j|d(}|rd)|kr|d) %| n||d)< |S )*N.)iosxr_configconfigTF)Ziosxr_netconfr   Ziosxr_commandZiosxr_factslocalzcisco.iosxr.iosxr	transportclizansible.netcommon.network_cliport   netconfzansible.netcommon.netconfi>  z.Transport type %s is not valid for this module)failedmsghostusernamepasswordzansible.netcommon.persistent)Z	task_uuidZiosxrnetwork_cli
persistentz&using connection plugin %s (was local)timeoutZpersistent_command_timeout)directzsocket_path: %szzunable to open shell. Please see: https://docs.ansible.com/ansible/network_debug_troubleshooting.html#unable-to-open-shellZansible_socketzmconnection local support for this module is deprecated and will be removed in version 2.14, use connection %s)r   r   z-Connection type %s is not valid for module %sproviderz:provider is unnecessary when using {0} and will be ignoredz/Connection type %s is not valid for this module)	task_varswarnings)&Z_taskactionsplitZ_config_moduleZ_play_context
connectionr   r   argscopydeepcopyZ
network_osintr   Zremote_addrZconnection_userZremote_userr   Z_shared_loader_objZconnection_loadergetsysstdin_uuiddisplayZvvv
get_optionZset_optionsrunZvvvvappendanyvalueswarningformatsuperr   extend)selftmpr   module_nameZ	force_cliZpersistent_connectionr   r   Zpcr!   Zcommand_timeoutZsocket_pathresult)	__class__ c/home/dcms/DCMS/lib/python3.7/site-packages/ansible_collections/cisco/iosxr/plugins/action/iosxr.pyr,   )   s    



zActionModule.run)NN)__name__
__module____qualname__r,   __classcell__r9   r9   )r8   r:   r   (   s   r   )
__future__r   r   r   type__metaclass__r'   r#   ZHansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.iosxrr   Z<ansible_collections.ansible.netcommon.plugins.action.networkr   ZActionNetworkModuleZOansible_collections.ansible.netcommon.plugins.module_utils.network.common.utilsr   Zansible.utils.displayr   r*   r9   r9   r9   r:   <module>   s   