??????????????
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 173
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 174
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 175
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 176
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 177
Warning: Cannot modify header information - headers already sent by (output started at /home/mybf1/public_html/mentol.bf1.my/SS1.php:4) in /home/mybf1/public_html/mentol.bf1.my/SS1.php on line 178
ó
àUdac @` sŠ d d l m Z m Z m Z e Z d Z d d l m Z d d l m
Z
d d l m Z d d l
Z
d d l Z d e f d „ ƒ YZ d S( i ( t absolute_importt divisiont print_functions
---
author:
- Miguel Angel Munoz (@magonzalez)
httpapi : fortios
short_description: HttpApi Plugin for Fortinet FortiOS Appliance or VM
description:
- This HttpApi plugin provides methods to connect to Fortinet FortiOS Appliance or VM via REST API
version_added: "2.9"
( t HttpApiBase( t to_text( t urllibNt HttpApic B` sG e Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( c C` s# t t | ƒ j | ƒ d | _ d S( Nt ( t superR t __init__t _ccsrftoken( t selft
connection( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyR 4 s c C` s d S( sŒ
Elevation is not required on Fortinet devices - Skipped
:param become_context: Unused input.
:return: None
N( t None( R t become_context( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyt
set_become9 s c C` su d t j j | ƒ d t j j | ƒ d } | j d d d | d d ƒ \ } } | d d
k rq t d ƒ ‚ n d S(
sA Call a defined login endpoint to receive an authentication token.s username=s &secretkey=s &ajax=1t urls /logincheckt datat methodt POSTi t 1s Wrong credentials. Please checkN( R t parset quotet send_requestt Exception( R t usernamet passwordR t dummyt result_data( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyt loginA s .$c C` s | j d d d d ƒ d S( s" Call to implement session logout.R s /logoutR R N( R ( R ( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyt logoutI s c
C` s? i } g } t | j d ƒ r- | j j } n) g | j D] } | | j | f ^ q7 } xÕ | D]Í \ } } | j ƒ d k rÜ d | k rÜ | | d <| j d ƒ } | d k r*| | t d ƒ j d ƒ d } | | _ q*q] | j ƒ d k r] d | k r] t j d | ƒ } | r*| j
d ƒ | _ q*q] q] W| j | d
<| S( sð
Get cookies and obtain value for csrftoken that will be used on next requests
:param response: Response given by the server.
:param response_text Unused_input.
:return: Dictionary containing headers
t _headerss
set-cookiet
APSCOOKIE_t Cookies ccsrftoken=iÿÿÿÿs "i s "(.*)"s x-csrftoken( t hasattrt headersR t lowert findt lent splitR
t ret searcht group(
R t responset
response_textR# t resp_raw_headerst attrt valt x_ccsrftoken_positiont token_stringt csrftoken_search( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyt update_authN s$ )
!
c C` s | S( ss
Not required on Fortinet devices - Skipped
:param exc: Unused input.
:return: exc
( ( R t exc( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyt handle_httperrorn s c K` sÄ | j d d ƒ } | j d d ƒ } | j d d ƒ } yh | j j | | d | ƒ\ } } d } t | d ƒ r{ | j } n | j j } | t | j ƒ ƒ f SWn t k
r¿ } t | ƒ ‚ n Xd S( sñ
Responsible for actual sending of data to the connection httpapi base plugin.
:param message_kwargs: A formatted dictionary containing request info: url, data, method
:return: Status code and response data.
R t /R R R t GETt statusN(
t getR t sendR
R" R8 R# R t getvalueR ( R t message_kwargsR R R R+ t
response_datat response_statust err( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyR v s !( t __name__t
__module__R R R R R3 R5 R ( ( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyR 3 s ( t
__future__R R R t typet
__metaclass__t
DOCUMENTATIONt ansible.plugins.httpapiR t ansible.module_utils.basicR t ansible.module_utils.six.movesR t jsonR( R ( ( ( sC /usr/lib/python2.7/site-packages/ansible/plugins/httpapi/fortios.pyt s