403Webshell
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/runners/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__/asam.cpython-310.pyc
o

;j�,�@s�dZddlZdZzddlZddlZdZGdd�dejj�ZWn	e	y'Ynwe�
e�Zdd�Z
dd
d�Zddd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) a
Novell ASAM Runner
==================

.. versionadded:: 2015.8.0

Runner to interact with Novell ASAM Fan-Out Driver

:codeauthor: Nitin Madhok <nmadhok@g.clemson.edu>

To use this runner, set up the Novell Fan-Out Driver URL, username and password in the
master configuration at ``/etc/salt/master`` or ``/etc/salt/master.d/asam.conf``:

.. code-block:: yaml

    asam:
      prov1.domain.com
        username: "testuser"
        password: "verybadpass"
        verify_ssl: true
      prov2.domain.com
        username: "testuser"
        password: "verybadpass"
        verify_ssl: true

.. note::

    Optionally, ``protocol`` and ``port`` can be specified if the Fan-Out Driver server
    is not using the defaults. Default is ``protocol: https`` and ``port: 3451``.

�NFTc@seZdZdd�Zdd�ZdS)�ASAMHTMLParsercCstjj�|�g|_dS)N)�html�parser�
HTMLParser�__init__�data)�self�r	�E/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/asam.pyr.s
zASAMHTMLParser.__init__cCs<|dkrdS|D]}|ddkrdS|j�|d�qdS)N�arZhref�)r�append)r�tag�attrs�attrr	r	r
�handle_starttag2s�zASAMHTMLParser.handle_starttagN)�__name__�
__module__�__qualname__rrr	r	r	r
r-srcCstsdSt�durdSdS)z�
    Check for ASAM Fan-Out driver configuration in master config file
    or directory and load runner only if it is specified
    FT)�HAS_LIBS�_get_asam_configurationr	r	r	r
�__virtual__Cs

r�c
Cs.dtvrtdnd}|r�ze|��D]^\}}|�dd�}|�dd�}|�dd�}|�dd�}|�d	�}|dur8d
}|r<|sFt�d|�WdSd
�|||�d�|||�d�|||�d�|||�|||d�}	|rj||kro|	WSqWnty�}
z
t�d|
�WYd}
~
dSd}
~
ww|r�t�d|�dSdS)z[
    Return the configuration read from the master configuration
    file or directory
    ZasamN�username�password�protocol�https�porti{
�
verify_sslTzNUsername or Password has not been specified in the master configuration for %sFz#{}://{}:{}/config/PlatformEdit.htmlz%{}://{}:{}/config/PlatformConfig.htmlz&{}://{}:{}/config/PlatformSetEdit.htmlz({}://{}:{}/config/PlatformSetConfig.html)�platform_edit_url�platform_config_urlZplatformset_edit_url�platformset_config_urlrrrzException encountered: %szGConfiguration for %s has not been specified in the master configuration)Z__opts__�items�get�log�error�format�	Exception)Z
driver_urlZasam_configZasam_serverZservice_configrrrrr�ret�excr	r	r
rPsb
������
��,���rcCs:tj||||dd�}|jtjjkr|��dS|j�d�S)N�x)r�auth�verify�timeout�
)�requestsZpostZstatus_codeZcodes�okZraise_for_status�text�split)�urlrr+r,�rr	r	r
�_make_post_request�sr5cCs4t�}|D]}|�d�r|�|�q|�|�q|S)Nz<META)r�
startswith�remove�feed)�html_contentr�liner	r	r
�_parse_html_content�s
r;cCsT|D]%}||vr'|�d�r'|�d�}|D]}|�d�r&|�d�dSqqdS)N�PlatformEdit.html?�&�platformSetName�=r)r6r2)rZ
platform_name�item�parameter_list�	parameterr	r	r
�_get_platformset_name�s

��rCcCsZg}|D]&}|�d�r*|�dd�d�d�}|D]}|�d�r)|�|�d�d�qq|S)Nr<rr=�platformNamer?)r6r2r
)r�
platform_listr@rArBr	r	r
�_get_platforms�s

�rFcCsbg}|D]*}|�d�r.|�dd�d�d�}|D]}|�d�r-|�|�d�d�dd��qq|S)NzPlatformSetEdit.html?rr=r>r?z%20� )r6r2r
�replace)r�platform_set_listr@rArBr	r	r
�_get_platform_sets�s

��rJc
Cstt|�}|sdS|d}ddi}|d|df}zt||||dd�}Wn"tyF}zd	|��}t�d
||�||iWYd}~Sd}~wwt|�}	t|	j|�}
|
r�t�|
�||d<t	|
�|d
<d|d<d|d<zt||||dd�}Wn"ty�}zd|��}t�d
||�||iWYd}~Sd}~wwt|�}	t|	j|�}
|
r�|d|��iS|d|��iS|d|��iS)z�
    To remove specified ASAM platform from the Novell Fan-Out Driver

    CLI Example:

    .. code-block:: bash

        salt-run asam.remove_platform my-test-vm prov1.domain.com
    Fr �manual�falserrr�r,z(Failed to look up existing platforms on �%s:
%sNrDr>ZplatformRemove�postTypeZYes�SubmitzFailed to delete platform from z#Successfully deleted platform from z*Specified platform name does not exist on )
rr5r'r$r%r;rCr�debug�str)�name�
server_url�configr3rr+r9r)�err_msgrZplatformset_namer	r	r
�remove_platform�sN
�
��

�
��rWc

C�t|�}|sdS|d}ddi}|d|df}zt||||dd�}WntyC}zd	}t�d
||�||iWYd}~Sd}~wwt|�}t|j�}	|	rS||	iS|diS)
z�
    To list all ASAM platforms present on the Novell Fan-Out Driver

    CLI Example:

    .. code-block:: bash

        salt-run asam.list_platforms prov1.domain.com
    Fr rKrLrrrrMz$Failed to look up existing platformsrNNzNo existing platforms found)rr5r'r$r%r;rFr)
rTrUr3rr+r9r)rVrrEr	r	r
�list_platforms�(
���
rYc

CrX)
z�
    To list all ASAM platform sets present on the Novell Fan-Out Driver

    CLI Example:

    .. code-block:: bash

        salt-run asam.list_platform_sets prov1.domain.com
    Fr!rKrLrrrrMz(Failed to look up existing platform setsrNNzNo existing platform sets found)rr5r'r$r%r;rJr)
rTrUr3rr+r9r)rVrrIr	r	r
�list_platform_sets+rZr[c
Cst|�}|sdSt|�}|||vr|d|��iSt|�}|||vr*|d|��iS|d}||ddddd	�}|d
|df}zt||||dd
�}	Wn"tym}
zd|��}t�d||
�||iWYd}
~
Sd}
~
wwt|�}|||vr|d|��iS|d|��iS)z�
    To add an ASAM platform using the specified ASAM platform set on the Novell
    Fan-Out Driver

    CLI Example:

    .. code-block:: bash

        salt-run asam.add_platform my-test-vm test-platform-set prov1.domain.com
    Fz%Specified platform already exists on z)Specified platform set does not exist on rrLz/config/platformAdd.htmlZPlatformAddZApply)rDr>rKZpreviousURLrOrPrrrrMzFailed to add platform on rNNzSuccessfully added platform on )rrYr[r5r'r$r%)rSZplatform_setrTrUZ	platformsZ
platform_setsr3rr+r9r)rVr	r	r
�add_platformQs<�	
��r\)r)T)�__doc__�loggingrZhtml.parserrr/rrr�ImportError�	getLoggerrr$rrr5r;rCrFrJrWrYr[r\r	r	r	r
�<module>s. �


D9&&

Youez - 2016 - github.com/yon3zu
LinuXploit