HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/chronos.cpython-310.pyc
o

�N�gy�@s�dZddlZddlZddlZddlZddlmZdgZe�	e
�Zdd�Zdd�Z
d	d
�Zdd�Zd
d�Zdd�Zdd�Zdd�ZdS)z�
Module providing a simple management interface to a chronos cluster.

Currently this only works when run through a proxy minion.

.. versionadded:: 2015.8.2
�N)�get_error_messageZchronoscCstjj��o	dtvS)N�proxy)�salt�utils�platformZis_proxy�__opts__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/chronos.py�__virtual__sr
cCs d}dtvrtd�d|�}|S)z/
    Return the proxy configured base url.
    zhttp://locahost:4400r�base_url)r�get)rrrr	�	_base_urlsr
cCs@tjjjt��d�ddd�}i}|dD]	}|||�d�<q|S)z/
    Return the currently configured jobs.
    z/scheduler/jobs�jsonT)Zdecode_type�decode�dict�name)rr�http�queryr
�pop)�response�jobs�jobrrr	�_jobs#s
�rcCst���}|��d|iS)z�
    Return a list of the currently installed job names.

    CLI Example:

    .. code-block:: bash

        salt chronos-minion-id chronos.jobs
    r)r�keys�sort)Z	job_namesrrr	r2s

rcCs
|t�vS)z�
    Return whether the given job is currently configured.

    CLI Example:

    .. code-block:: bash

        salt chronos-minion-id chronos.has_job my-job
    �r)rrrr	�has_jobAs

rcCst�}||vr
d||iSdS)z�
    Return the current server configuration for the specified job.

    CLI Example:

    .. code-block:: bash

        salt chronos-minion-id chronos.job my-job
    rNr)rrrrr	rNs
rc
Cs�d|vr||d<tjj�|�}ztjjjt��d�d|ddid�}t�d|�dd	iWSt	yM}zt�
d
t|��ddt|�iiWYd
}~Sd
}~ww)z�
    Update the specified job with the given configuration.

    CLI Example:

    .. code-block:: bash

        salt chronos-minion-id chronos.update_job my-job '<config yaml>'
    rz/scheduler/iso8601�POSTzContent-Typezapplication/json)�method�dataZheader_dictzupdate response: %s�successTz unable to update chronos job: %s�	exception�messageN)rrr�dumpsrrr
�log�debug�	Exception�errorr)rZconfigrr�exrrr	�
update_job^s"

�
��r)cCs"tjjjt��d|��dd�}dS)z�
    Remove the specified job from the server.

    CLI Example:

    .. code-block:: bash

        salt chronos-minion-id chronos.rm_job my-job
    z/scheduler/job/ZDELETE)rT)rrrrr
)rrrrr	�rm_jobys

�r*)�__doc__�loggingZsalt.utils.httprZsalt.utils.jsonZsalt.utils.platformZsalt.exceptionsrZ__proxyenabled__�	getLogger�__file__r$r
r
rrrrr)r*rrrr	�<module>s