AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 18.116.43.47
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python2.7/site-packages/ansible/plugins/connection/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyo
�
��\c@`s%ddlmZmZmZeZdZddlmZddl	m
Z
ddlmZm
Z
ddlmZddlmZmZddlmZdd	lmZdd
lmZmZddlmZyddlmZWn*ek
r
dd
lm Z e �ZnXdefd��YZ!dS(i(tabsolute_importtdivisiontprint_functions�
---
author: Ansible Networking Team
connection: httpapi
short_description: Use httpapi to run command on network appliances
description:
  - This connection plugin provides a connection to remote devices over a
    HTTP(S)-based api.
version_added: "2.6"
options:
  host:
    description:
      - Specifies the remote device FQDN or IP address to establish the HTTP(S)
        connection to.
    default: inventory_hostname
    vars:
      - name: ansible_host
  port:
    type: int
    description:
      - Specifies the port on the remote device to listening for connections
        when establishing the HTTP(S) connection.
        When unspecified, will pick 80 or 443 based on the value of use_ssl
    ini:
      - section: defaults
        key: remote_port
    env:
      - name: ANSIBLE_REMOTE_PORT
    vars:
      - name: ansible_httpapi_port
  network_os:
    description:
      - Configures the device platform network operating system.  This value is
        used to load the correct httpapi and cliconf plugins to communicate
        with the remote device
    vars:
      - name: ansible_network_os
  remote_user:
    description:
      - The username used to authenticate to the remote device when the API
        connection is first established.  If the remote_user is not specified,
        the connection will use the username of the logged in user.
      - Can be configured form the CLI via the C(--user) or C(-u) options
    ini:
      - section: defaults
        key: remote_user
    env:
      - name: ANSIBLE_REMOTE_USER
    vars:
      - name: ansible_user
  password:
    description:
      - Secret used to authenticate
    vars:
      - name: ansible_password
      - name: ansible_httpapi_pass
  use_ssl:
    type: boolean
    description:
      - Whether to connect using SSL (HTTPS) or not (HTTP)
    default: False
    vars:
      - name: ansible_httpapi_use_ssl
  validate_certs:
    type: boolean
    version_added: '2.7'
    description:
      - Whether to validate SSL certificates
    default: True
    vars:
      - name: ansible_httpapi_validate_certs
  timeout:
    type: int
    description:
      - Sets the connection time, in seconds, for the communicating with the
        remote device.  This timeout is used as the default timeout value for
        commands when issuing a command to the network CLI.  If the command
        does not return in timeout seconds, the an error is generated.
    default: 120
  become:
    type: boolean
    description:
      - The become option will instruct the CLI session to attempt privilege
        escalation on platforms that support it.  Normally this means
        transitioning from user mode to C(enable) mode in the CLI session.
        If become is set to True and the remote device does not support
        privilege escalation or the privilege has already been elevated, then
        this option is silently ignored
      - Can be configured form the CLI via the C(--become) or C(-b) options
    default: False
    ini:
      section: privilege_escalation
      key: become
    env:
      - name: ANSIBLE_BECOME
    vars:
      - name: ansible_become
  become_method:
    description:
      - This option allows the become method to be specified in for handling
        privilege escalation.  Typically the become_method value is set to
        C(enable) but could be defined as other values.
    default: sudo
    ini:
      section: privilege_escalation
      key: become_method
    env:
      - name: ANSIBLE_BECOME_METHOD
    vars:
      - name: ansible_become_method
  persistent_connect_timeout:
    type: int
    description:
      - Configures, in seconds, the amount of time to wait when trying to
        initially establish a persistent connection.  If this value expires
        before the connection to the remote device is completed, the connection
        will fail
    default: 30
    ini:
      - section: persistent_connection
        key: connect_timeout
    env:
      - name: ANSIBLE_PERSISTENT_CONNECT_TIMEOUT
    vars:
      - name: ansible_connect_timeout
  persistent_command_timeout:
    type: int
    description:
      - Configures, in seconds, the amount of time to wait for a command to
        return from the remote device.  If this timer is exceeded before the
        command returns, the connection plugin will raise an exception and
        close
    default: 10
    ini:
      - section: persistent_connection
        key: command_timeout
    env:
      - name: ANSIBLE_PERSISTENT_COMMAND_TIMEOUT
(tAnsibleConnectionFailure(tto_bytes(tPY3tBytesIO(tcPickle(t	HTTPErrortURLError(topen_url(tPlayContext(tcliconf_loaderthttpapi_loader(tNetworkConnectionBase(tdisplay(tDisplayt
ConnectioncB`sGeZdZdZeZd�Zd�Zd�Zd�Z	d�Z
RS(sNetwork API connectionthttpapicO`sgtt|�j||||�d|_d|_|jsItd��ntjd|jdt	�dS(NssUnable to automatically determine host network os. Please manually configure ansible_network_os value for this hostsnetwork_os is set to %stlog_only(
tsuperRt__init__tNonet_urlt_autht_network_osRRtTrue(tselftplay_contextt	new_stdintargstkwargs((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyR�s			cC`s�t|�}tr*tj|dd�}ntj|�}t�}|j|�dg}|jj|jAr�|j|�|jt	kr�|j
d�q�|j
d�n||_|S(s7Updates the play context information for the connectiontencodingtbytess$updating play_context for connectionsauthorizing connectionsdeauthorizing connection(RRRtloadsRtdeserializet
_play_contexttbecomet
set_becomeRtappend(Rtpc_dataRtmessages((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pytupdate_play_context�s	
	
	cC`s||jsx|jd�rdnd}|jd�}|jd�pW|dkrTdnd}d|||f|_tj|j|�}|r�tjd	|jd|�|jj	|�nt
d
|j��tj|j|�}|rtjd|jd|�|jj	|�ntjd|j�tt
|�j�|j|j�|j|jd
�|jd��t|_ndS(Ntuse_sslthttpsthttpthosttporti�iPs
%s://%s:%ss#loaded API plugin for network_os %ss+unable to load API plugin for network_os %ss'loaded cliconf plugin for network_os %ss(unable to load cliconf for network_os %stremote_usertpassword(t	connectedt
get_optionRR
tgetRRtvvvvt_implementation_pluginsR'RRRRt_connectR&R$tloginRt
_connected(RtprotocolR.R/Rtcliconf((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyR7�s&	'"cC`sF|jr/tjdd|jj�|j�ntt|�j�dS(s8
        Close the active session to the device
        s$closing http(s) connection to deviceR.N(	R9RR5R$tremote_addrtlogoutRRtclose(R((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyR>�s	
c
K`s�td|jd�d|jd�di�}|j|�|jrxt|jdi��}|j|j�||d<n&|jd�|d<|jd�|d<y t|j|d||�}Wn�tk
r5}|j|�}|t	kr�|j
|||�S|tkr/td	j
|j||j���qj�n5tk
ri}td	j
|j||j���nXt�}	|	j|j��|j||	�p�|j|_||	fS(
s:
        Sends the command to the device over api
        ttimeouttvalidate_certstheadersR0turl_usernameR1turl_passwordtdatasCould not connect to {0}: {1}(tdictR3tupdateRR4R
RRthandle_httperrorRtsendtFalseRtformattreasonR	Rtwritetreadtupdate_auth(
RtpathRDRt
url_kwargsRAtresponsetexct
is_handledtresponse_buffer((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyRH�s2	
	
 %&	(t__name__t
__module__t__doc__t	transportRthas_pipeliningRR*R7R>RH(((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyR�s	
			N("t
__future__RRRttypet
__metaclass__t
DOCUMENTATIONtansible.errorsRtansible.module_utils._textRtansible.module_utils.sixRRtansible.module_utils.six.movesRt+ansible.module_utils.six.moves.urllib.errorRR	tansible.module_utils.urlsR
tansible.playbook.play_contextRtansible.plugins.loaderRR
tansible.plugins.connectionRt__main__RtImportErrortansible.utils.displayRR(((sF/usr/lib/python2.7/site-packages/ansible/plugins/connection/httpapi.pyt<module>s"�



Anon7 - 2022
AnonSec Team