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/states/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

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

;j��@s\dZddlZddlZddlZddlmZddlZe�e�Z	dd�Z
	ddd�Zd
d
d�ZdS)aRESTCONF
State module for  Proxy minions

:codeauthor: Jamie (Bear) Murphy <jamiemurphyit@gmail.com>
:maturity:   new
:platform:   any

About
=====
This state module was designed to manage RESTCONF states.
This module relies on the RESTCONF proxy module to interface with the devices.
�N)�OrderedDictcCsdtvrdSdS)N�restconf.set_dataT)Fz#RESTCONF module could not be loaded)�__salt__�rr�H/opt/saltstack/salt/lib/python3.10/site-packages/salt/states/restconf.py�__virtual__sr�PATCHcCs�ddd�}t|�}t|�}t|�}|dkr d|d<t�d�|S|dkr/d|d<t�d�|S|dkr>d	|d<t�d
�|St|t�sQd|d<t�dt|��|S|didd
�}td||�}t�d�t�|�|dswd|d<d|d<|S|}	|ddkr�i}
|dur�|}	|}|ddkr�|}i|d<t�	t�
|	��}t�dt|d�|d�t�dt|�|�|d|kr�d|d<d|d<|Stddur�d|d<t|d|�|dd<|d|dd<d|d<|Std|d ||�}
|
d!d"v�rd|d<t|d|�|dd<|d|dd<d#|d<|Sd|d<d$|
v�r"|
d$}nd%|
v�r,|
d%}nd}d&�
|
d!||d �|d<t�d't�
|��|S)(aQ
    Ensure a specific value exists at a given path

    name:
        (str) The name for this rule

    path:
        (str) The RESTCONF path to set / get config

    method:
        (str) rest method to use eg GET, PUT, POST, PATCH, DELETE

    config:
        (dict) The new value at the given path

    init_path: (optional)
        (str) Alternative path incase the path doesnt exist on first pass

    init_method: (optional)
        (str) Method to use on alternative path when setting config, default: PATCH

    init_config: (optional)
        (dict) The new value at the given init path.
        This is only needed if you need to supply a different style of data to an init path.

    Examples:

    .. code-block:: yaml

        do_configure_restconf_endpoint:
          restconf.config_manage:
            - name: random_name_here
            - path: restconf/data/Cisco-IOS-XE-native:native/interface/GigabitEthernet=1%2F0%2F3
            - config:
                Cisco-IOS-XE-native:GigabitEthernet:
                  description: interfaceDescription
                  name: "1/0/3"

    F�)�result�commentz CRITICAL: path must not be blankrzpath must not be blankzCRITICAL: name is requiredzname is requiredzCRITICAL: method is requiredzmethod is requiredz,CRITICAL: config must be an OrderedDict typez?config is required, config must be a salt OrderedDict, not a %s)�namer
�changesrzrestconf.path_checkzpath_check:r
z<RESTCONF could not find a working PATH to get initial configZ	path_used�initNZrequest_restponsez"existing path config(type: %s):
%szproposed_config(type: %s):
%sTzConfig is already set�testr
�changedZrest_method_pathzConfig will be addedrZrequest_path�status)������zSuccessfully added config�dict�bodyzLfailed to add / modify config. API Statuscode: {}, API Response: {}, URI: {}zpost_content: %s)�str�log�critical�
isinstancer�typer�debug�json�loads�dumpsZ__opts__�_compare_changes�format)r�path�methodZconfigZ	init_pathZinit_methodZinit_config�retZ
path_checkZuse_conf�existingZrequest_methodZproposed_configZresp�whyrrr�
config_manages�
*



�

�
�)�� �
���



��r'�yamlcCs�tj|dd���}dd�|D�}tj|dd���}dd�|D�}|dkr8tj|ddd���}tj|ddd���}tj||d	d
d�}d�d
d�|D��}t�	d�t�	|�|S)NF)Zdefault_flow_stylecS�g|]}d|�qS�� r��.0�xrrr�
<listcomp>���z$_compare_changes.<locals>.<listcomp>cSr)r*rr,rrrr/�r0r�)�	sort_keys�indent�beforeZafter)�fromfile�tofile�
cSsg|]}|�dd��qS)r7r	)�replacer,rrrr/�sz
resconf_diff:)
r(Z	safe_dump�
splitlinesrr�difflibZunified_diff�joinrr)�old�newZoutput_styleZold_rawZnew_rawZdiffoutZ	diffcleanrrrr �s ��

r )NrN)r()
�__doc__r:r�logging�collectionsrr(�	getLogger�__file__rrr'r rrrr�<module>s


�

Youez - 2016 - github.com/yon3zu
LinuXploit