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__/rallydev.cpython-310.pyc
o

�N�gU�@s�dZddlZddlZddlZddlmZe�e�Z	dd�Z
dd�Z	dd	d
�Zdd�Z
d dd�Zdd�Zd!dd�Zdd�Zdd�Zdd�Zdd�Zd"dd�ZdS)#z�
Support for RallyDev

.. versionadded:: 2015.8.0

Requires a ``username`` and a ``password`` in ``/etc/salt/minion``:

.. code-block:: yaml

    rallydev:
      username: myuser@example.com
      password: 123pass
�N)�SaltInvocationErrorcCs4t�di��dd�sdSt�di��dd�sdSdS)z5
    Only load the module if apache is installed
    �rallydev�usernameN)FzVThe rallydev execution module failed to load: rallydev:username not defined in config.�password)FzVThe rallydev execution module failed to load: rallydev:password not defined in config.T)�__opts__�get�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/rallydev.py�__virtual__s
r
cCsjt�di��dd�}t�di��dd�}d}tjjj|dddd||ddtd�
}d	|vr-dS|d	d
dS)z
    Get an auth token
    rrNrzBhttps://rally1.rallydev.com/slm/webservice/v2.0/security/authorizeT�json)	�decode�decode_type�text�statusrr�cookies�persist_session�opts�dictZOperationResultZ
SecurityToken)rr�salt�utils�http�query)rr�path�resultrrr	�
_get_token+s$�r�GETc
Cst�}t�di��dd�}t�di��dd�}d}	|r|	|7}	|r(|	d|��7}	t�d|	�t|t�s5i}||d<|durAd	d
i}|dkrId
|d<d
}
|dkrQd}
d}tjj	j
|	|||||
dd
d
||d
d
td�}t�d|d�d|vr�t�|d�|d|dgS|d|�di�gS)z&
    Make a web call to RallyDev.
    rrNrz0https://rally1.rallydev.com/slm/webservice/v2.0/�/zRallyDev URL: %s�keyzContent-typezapplication/json�POSTZAcceptTZDELETEFr)�params�data�header_dictrr
rrrrrrrz!RallyDev Response Status Code: %sr�errorr)rrr�log�debug�
isinstancerrrrrr")
�action�command�args�methodr!r �tokenrrrrZreturn_contentrrrr	�_queryDsR
�r+cCst|d�\}}|S)z�
    List items of a particular type

    CLI Examples:

    .. code-block:: bash

        salt myminion rallydev.list_<item name>s
        salt myminion rallydev.list_users
        salt myminion rallydev.list_artifacts
    )r&�r+)�namerrrrr	�
list_itemssr.�RankcCst|||d�d�\}}|S)a�
    Query a type of record for one or more items. Requires a valid query string.
    See https://rally1.rallydev.com/slm/doc/webservice/introduction.jsp for
    information on query syntax.

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.query_<item name> <query string> [<order>]
        salt myminion rallydev.query_task '(Name contains github)'
        salt myminion rallydev.query_task '(Name contains reactor)' Rank
    )r�order)r&r(r,)r-�query_stringr0rrrrr	�
query_item�sr2cCst||d�\}}|S)z}
    Show an item

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.show_<item name> <item id>
    )r&r'r,)r-�id_rrrrr	�	show_item�s
r4cCsV|r|r|r
td��|��||ii}|durtd��t||dtjj�|�d�\}}|S)aC
    Update an item. Either a field and a value, or a chunk of POST data, may be
    used, but not both.

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.update_<item name> <item id> field=<field> value=<value>
        salt myminion rallydev.update_<item name> <item id> postdata=<post data>
    zTEither a field and a value, or a chunk of POST data, may be specified, but not both.NzFEither a field and a value, or a chunk of POST data must be specified.r)r&r'r)r )r�titler+rrr�dumps)r-r3�field�valueZpostdatarrrrr	�update_item�s"
��
�r9cC�
td|�S)z�
    Show an artifact

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.show_artifact <artifact id>
    Zartifact�r4�r3rrr	�
show_artifact��

r=cCstd�S)zo
    List the users

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.list_users
    �user)r.rrrr	�
list_users�s
r@cCr:)zu
    Show a user

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.show_user <user id>
    r?r;r<rrr	�	show_user�r>rAcCstd|||�S)z�
    Update a user

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.update_user <user id> <field> <new value>
    r?)r9)r3r7r8rrr	�update_user�s
rB�UserNamecCstd||�S)z�
    Update a user

    CLI Example:

    .. code-block:: bash

        salt myminion rallydev.query_user '(Name contains Jo)'
    r?)r2)r1r0rrr	�
query_users
rD)NNNrNN)r/)NNN)rC)�__doc__�loggingZsalt.utils.httprZsalt.utils.jsonZsalt.exceptionsr�	getLogger�__name__r#r
rr+r.r2r4r9r=r@rArBrDrrrr	�<module>s&

�;

#