File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/uwsgi.cpython-310.pyc
o
�N�g� � @ s( d Z ddlZddlZdd� Zdd� ZdS )z�
uWSGI stats server https://uwsgi-docs.readthedocs.io/en/latest/StatsServer.html
:maintainer: Peter Baumgartner <pete@lincolnloop.com>
:maturity: new
:platform: all
� Nc C s d} t jj�| �r| S dS )z4
Only load the module if uwsgi is installed
�uwsgi)FzOThe uwsgi execution module failed to load: the uwsgi binary is not in the path.)�salt�utils�path�which)�cmd� r �F/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/uwsgi.py�__virtual__
s r
c C s* dd| � g}t d |dd�}tjj�|�S )a#
Return the data from `uwsgi --connect-and-read` as a dictionary.
socket
The socket the uWSGI stats server is listening on
CLI Example:
.. code-block:: bash
salt '*' uwsgi.stats /var/run/mystatsserver.sock
salt '*' uwsgi.stats 127.0.0.1:5050
r z--connect-and-readzcmd.runF)Zpython_shell)Z__salt__r r �json�loads)�socketr �outr r r �stats s r )�__doc__Zsalt.utils.jsonr Zsalt.utils.pathr
r r r r r �<module> s