HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.109.1.lve.el8.x86_64 #1 SMP Thu Mar 5 20:23:46 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.30
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/cisconso.cpython-310.pyc
o

�N�gW�@sZdZddlZdgZdZdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�ZdS)z�
Execution module for Cisco Network Services Orchestrator Proxy minions

.. versionadded:: 2016.11.0

For documentation on setting up the cisconso proxy minion look in the documentation
for :mod:`salt.proxy.cisconso<salt.proxy.cisconso>`.
�NZcisconsocCstjj��rtSdS)N)FzNThe cisconso execution module failed to load: only available on proxy minions.)�salt�utils�platformZis_proxy�__virtualname__�rr�I/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/cisconso.py�__virtual__srcC�td�S)z�
    Return system information for grains of the NSO proxy minion

    .. code-block:: bash

        salt '*' cisconso.info
    �info��
_proxy_cmdrrrrr
�r
cCs t|t�r
d�|�}td||�S)a/
    Get the configuration of the device tree at the given path

    :param datastore: The datastore, e.g. running, operational.
        One of the NETCONF store IETF types
    :type  datastore: :class:`DatastoreType` (``str`` enum).

    :param path: The device path to set the value at,
        a list of element names in order, / separated
    :type  path: ``list``, ``str`` OR ``tuple``

    :return: The network configuration at that tree
    :rtype: ``dict``

    .. code-block:: bash

        salt cisco-nso cisconso.get_data running 'devices/ex0'
    �/�get_data��
isinstance�str�splitr)�	datastore�pathrrrr%s

rcCs"t|t�r
d�|�}td|||�S)a|
    Set a data entry in a datastore

    :param datastore: The datastore, e.g. running, operational.
        One of the NETCONF store IETF types
    :type  datastore: :class:`DatastoreType` (``str`` enum).

    :param path: The device path to set the value at,
        a list of element names in order, / separated
    :type  path: ``list``, ``str`` OR ``tuple``

    :param data: The new value at the given path
    :type  data: ``dict``

    :rtype: ``bool``
    :return: ``True`` if successful, otherwise error.

    .. code-block:: bash

        salt cisco-nso cisconso.set_data_value running 'devices/ex0/routes' 10.0.0.20/24
    r�set_data_valuer)rr�datarrrr=s

rcCr	)z
    Get a list of stored configuration rollbacks

    .. code-block:: bash

        salt cisco-nso cisconso.get_rollbacks
    �
get_rollbacksrrrrrrXr
rcCs
td|�S)a
    Get the backup of stored a configuration rollback

    :param name: Typically an ID of the backup
    :type  name: ``str``

    :rtype: ``str``
    :return: the contents of the rollback snapshot

    .. code-block:: bash

        salt cisco-nso cisconso.get_rollback 52
    �get_rollbackr)�namerrrrcs
rcCstd||�S)ad
    Apply a system rollback

    :param datastore: The datastore, e.g. running, operational.
        One of the NETCONF store IETF types
    :type  datastore: :class:`DatastoreType` (``str`` enum).

    :param name: an ID of the rollback to restore
    :type  name: ``str``

    .. code-block:: bash

        salt cisco-nso cisconso.apply_rollback 52
    �apply_rollbackr)rrrrrrtsrcOsVtdd}d�||g�}|tvrdS|D]}|�d�r!|�|�qt||i|��S)a
    run commands from __proxy__
    :mod:`salt.proxy.cisconso<salt.proxy.cisconso>`

    command
        function from `salt.proxy.cisconso` to run

    args
        positional args to pass to `command` function

    kwargs
        key word arguments to pass to `command` function
    �proxyZ	proxytype�.FZ__pub_)Z__opts__�joinZ	__proxy__�
startswith�pop)Zcommand�args�kwargsZproxy_prefixZ	proxy_cmd�krrrr�s

�r)
�__doc__Zsalt.utils.platformrZ__proxyenabled__rrr
rrrrrrrrrr�<module>s