| Server IP : 198.38.94.13 / Your IP : 216.73.217.33 Web Server : Apache System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64 User : revivere ( 1140) PHP Version : 8.2.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/ |
Upload File : |
o
;jU � @ sr d Z ddlZddlZddlZe�e�ZdZdd� Z ddd�Z
d d
� Zdd� Zd
d� Z
dd� Zdd� Zddd�ZdS )z�
Support for Varnish
.. versionadded:: 2014.7.0
.. note::
These functions are designed to work with all implementations of Varnish
from 3.x onwards
� NZvarnishc C s$ t jj�d�rt jj�d�rtS dS )z6
Only load the module if varnish is installed
�varnishd�
varnishadm)Fz^The varnish execution module failed to load: either varnishd or varnishadm is not in the path.)�salt�utils�path�which�__virtualname__� r r �H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/varnish.py�__virtual__ s r r c K sF d| g} | � dd� |D �� t�dd�| �� td | fddi|��S ) a
Execute varnishadm command
return the output of the command
cmd
The command to run in varnishadm
params
Any additional args to add to the command line
kwargs
Additional options to pass to the salt cmd.run_all function
r c S s g | ]}|d ur|�qS �Nr )�.0�paramr r r
�
<listcomp>3 s z#_run_varnishadm.<locals>.<listcomp>z
Executing: %s� zcmd.run_all�python_shellF)�extend�log�debug�join�__salt__)�cmd�params�kwargsr r r
�_run_varnishadm$ s r c C s. ddg} t d | dd�}t�d|��d�}|S )z~
Return server version from varnishd -V
CLI Example:
.. code-block:: bash
salt '*' varnish.version
r z-Vzcmd.runF)r z\(varnish-([^\)]+)\)� )r �re�search�group)r �out�retr r r
�version8 s
r! c C s t d| g�d dkS )z
Add ban to the varnish cache
CLI Example:
.. code-block:: bash
salt '*' varnish.ban ban_expression
�ban�retcoder )r )Zban_expressionr r r
r"