File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/marathon.cpython-310.pyc
o
�N�g1 � @ s� d Z ddlZddlZddlZddlZddlmZ dgZe� e
�Zdd� Zdd� Z
d d
� Zdd� Zd
d� Zdd� Zdd� Zdd� Zdd� Zddd�ZdS )z�
Module providing a simple management interface to a marathon cluster.
Currently this only works when run through a proxy minion.
.. versionadded:: 2015.8.2
� N)�get_error_messageZmarathonc C s t jj�� rdtv rdS dS )N�proxyT)FzQThe marathon execution module cannot be loaded: this only works on proxy minions.)�salt�utils�platformZis_proxy�__opts__� r r �I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/marathon.py�__virtual__ s r
c C s d} dt v rt d �d| �} | S )z/
Return the proxy configured base url.
zhttp://locahost:8080r �base_url)r �get)r r r r � _base_url s r
c C s | d dkrd| � �} | S )z8
Make sure the app_id is in the correct format.
r �/r )Zapp_idr r r �_app_id) s
r c C s6 t jjjt� � d�ddd�} ddd� | d d D �iS ) z�
Return a list of the currently installed app ids.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.apps
z/v2/apps�jsonT��decode_type�decode�appsc S s g | ]}|d �qS ��idr )�.0�appr r r �
<listcomp>A s zapps.<locals>.<listcomp>�dict�r r �http�queryr
��responser r r r 2 s
�r c C s t | �t� d v S )z�
Return whether the given app id is currently configured.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.has_app my-app
r )r r r r r r �has_appD s
r c C s( t jjjt� � d| � �ddd�}|d S )z�
Return the current server configuration for the specified app.
CLI Example:
.. code-block:: bash
salt marathon-minion-id marathon.app my-app
� /v2/apps/r Tr r r �r r r r r r Q s
�r c
C s� d|vr| |d<