File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/panos.cpython-310.pyc
o
�N�g\� � @ s� d Z ddlZddlZddlZddlZddlmZ e�e �Z
dZdd� Zd�dd�Z
d d
� Zdd� Zd
d� Zdd� Zdd� Zd�dd�Zd�dd�Zdd� Zd�dd�Zd�dd�Zd�dd�Zd�d!d"�Zd�d#d$�Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� Zd/d0� Z d1d2� Z!d3d4� Z"d5d6� Z#d7d8� Z$d9d:� Z%d;d<� Z&d=d>� Z'd?d@� Z(dAdB� Z)dCdD� Z*dEdF� Z+d�dHdI�Z,d�dJdK�Z-d�dLdM�Z.d�dNdO�Z/dPdQ� Z0dRdS� Z1dTdU� Z2dVdW� Z3dXdY� Z4dZd[� Z5d\d]� Z6d^d_� Z7d`da� Z8dbdc� Z9ddde� Z:dfdg� Z;dhdi� Z<djdk� Z=dldm� Z>dndo� Z?d�dpdq�Z@d�drds�ZAd�dtdu�ZBd�dvdw�ZCdxdy� ZDdzd{� ZEd|d}� ZFd~d� ZGd�d�� ZHd�d�� ZId�d�� ZJd�d�d��ZKd�d�� ZLd�d�� ZMd�d�� ZNd�d�d��ZOd�d�d��ZPd�d�d��ZQ d�d�d��ZRd�d�� ZSd�d�d��ZTd�d�� ZUd�d�d��ZVd�d�� ZWd�d�d��ZXd�d�d��ZYd�d�� ZZd�d�d��Z[d�d�d��Z\d�d�d��Z]d�d�d��Z^d�d�d��Z_d�d�d��Z`d�d�d��Zad�d�d��Zbd�d�d��Zc d�d�d��Zdd�d�d��Zed�d�d��Zfd�d�d��Zgd�dÄ Zhd�d�dƄZi d�d�dȄZjd�d�dʄZkdS )�a�
Module to provide Palo Alto compatibility to Salt
:codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>``
:maturity: new
:depends: none
:platform: unix
.. versionadded:: 2018.3.0
Configuration
=============
This module accepts connection configuration details either as
parameters, or as configuration settings in pillar as a Salt proxy.
Options passed into opts will be ignored if options are passed into pillar.
.. seealso::
:py:mod:`Palo Alto Proxy Module <salt.proxy.panos>`
About
=====
This execution module was designed to handle connections to a Palo Alto based
firewall. This module adds support to send connections directly to the device
through the XML API or through a brokered connection to Panorama.
� N)�CommandExecutionError�panosc C sD zt jj�� rtd d dkrtW S W dS W dS ty! Y dS w )z0
Will load for the panos proxy minions.
�proxyZ proxytyper )FzFThe panos execution module can only be loaded for panos proxy minions.)�salt�utils�platformZis_proxyZ__opts__�__virtualname__�KeyError� r
r
�F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/panos.py�__virtual__* s ����r c C s~ | st d��td | �}d|v r=d|d v r=|d d }t|�d d d dkr9t�d� t|�d d d dks(t|�S |S )z�
Executes a query that requires a job for completion. This function will wait for the job to complete
and return the results.
z!Query parameters cannot be empty.�
panos.call�resultZjob�statusZFIN� )r � __proxy__�get_job�time�sleep)�query�response�jidr
r
r �_get_job_results: s
�r c C � ddd�} t d | �S )z�
Prevent other users from changing configuration until the lock is released.
CLI Example:
.. code-block:: bash
salt '*' panos.add_config_lock
�opz9<request><config-lock><add></add></config-lock></request>��type�cmdr
�r �r r
r
r �add_config_lockP � �r c C r )z�
Get anti-virus information from PaloAlto Networks server
CLI Example:
.. code-block:: bash
salt '*' panos.check_antivirus
r zN<request><anti-virus><upgrade><check></check></upgrade></anti-virus></request>r r
r r r
r
r �check_antivirusc r! r"