Anons79 Mini Shell

Directory : /proc/self/root/lib/python2.7/site-packages/ansible/plugins/httpapi/
Upload File :
Current File : //proc/self/root/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyo

�
�Udac@`s�ddlmZmZmZeZdZddlZddlm	Z	ddl
mZddlm
Z
ddlmZidd	gd
6ddd
dgd6dddgd6dd	gd6Zdefd��YZd�Zdd�ZdS(i(tabsolute_importtdivisiontprint_functions
---
author: Ansible Networking Team
httpapi: eos
short_description: Use eAPI to run command on eos platform
description:
  - This eos plugin provides low level abstraction api's for
    sending and receiving CLI commands with eos network devices.
version_added: "2.6"
options:
  eos_use_sessions:
    type: int
    default: 1
    description:
      - Specifies if sessions should be used on remote host or not
    env:
      - name: ANSIBLE_EOS_USE_SESSIONS
    vars:
      - name: ansible_eos_use_sessions
        version_added: '2.8'
N(tto_text(tConnectionError(tto_list(tHttpApiBasettexttjsontformattlinetstricttexacttnonet
diff_matchtblocktconfigtdiff_replacetoutputtHttpApicB`s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cO`s/tt|�j||�d|_d|_dS(N(tsuperRt__init__tNonet_device_infot_session_support(tselftargstkwargs((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyR.s	cC`s�|jd�}yt|�}Wntk
r2nXt|�sKt|_n.|jr[|jS|jd�}d|k|_|jS(Nteos_use_sessionssshow configuration sessionsterror(t
get_optiontintt
ValueErrortbooltFalseRtsend_request(Rtuse_sessiontresponse((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pytsupports_sessions3s
	c
K`s=t|�}|j}|rR|jjdd�|jdidd6|jd6�n|jdd�}t||�}id	d
6}|jjd|d|d
d�\}}yt	j
t|j���}Wn2t
k
r�tdjt|j�����nXt|�}	|r|	d}	nt|	�dkr9|	d}	n|	S(Ntvvvvsfiring event: on_becomeitenabletcmdtinputRRsapplication/json-rpcsContent-Types/command-apitheaderstmethodtPOSTs$Response was not valid JSON, got {0}i(Rt_becomet
connectiont
queue_messagetinsertt_become_passtgettrequest_buildertsendRtloadsRtgetvalueR RR	thandle_responsetlen(
Rtdatatmessage_kwargstbecomeRtrequestR+R%t
response_datatresults((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyR#Es(	$
'
	

cC`s�|jr|jSi}d|d<|jddd�}tj|�}|d|d<|d|d	<|jd
�}tj|�}|d|d<||_|jS(
Nteost
network_ossshow versionRRtversiontnetwork_os_versiont	modelNametnetwork_os_modelsshow hostname | jsonthostnametnetwork_os_hostname(RR#RR6(Rtdevice_infotreplyR:((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pytget_device_infobs	
	cC`s�itd6t|j��d6td6td6t|j��d6td6td6td6td	6t|j��d
6t|j��d6S(Ntsupports_diff_replacetsupports_committsupports_rollbacktsupports_defaultstsupports_onbox_difftsupports_commit_commenttsupports_multiline_delimitertsupports_diff_matchtsupports_diff_ignore_linestsupports_generate_difftsupports_replace(tTrueR!R&R"(R((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pytget_device_operationswscC`sTi}g|d<|j�|d<|j�|d<|jt�d|d<tj|�S(NtrpcRHtdevice_operationsteapitnetwork_api(RJRWtupdatetOPTIONSRtdumps(Rtresult((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pytget_capabilities�s


(t__name__t
__module__RR&R#RJRWR`(((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyR-s					cC`s�d|kr||d}g}x+|dD]}|j|jdg��q'Wdj|�p`|d}t|d|d��ng}xr|dD]f}d|kr�|j|dd	�q�d
|kr�|j|d
j��q�|jtj|��q�W|S(NRR:terrorss
tmessagetcodeR_tmessagesiR(textendR3tjoinRtappendtstripRR^(R%Rt
error_textR:R?R_((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyR8�s
c
C`sCtddd|d|�}tjtddd|dd	d
|��S(NRBitcmdsR	tjsonrpcs2.0tidR,trunCmdstparams(tdictRR^(tcommandsRtreqidRp((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyR4�s(t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONRtansible.module_utils._textRtansible.module_utils.connectionRt)ansible.module_utils.network.common.utilsRtansible.plugins.httpapiRR]RR8RR4(((s?/usr/lib/python2.7/site-packages/ansible/plugins/httpapi/eos.pyt<module>s
d	

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