Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/module_utils/network/slxos/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pyc

�
�Udac@ssddlZddlmZddlmZmZddlmZd�Zd�Z	d�Z
d�Zd	�ZdS(
i����N(tto_text(tto_listtComplexList(t
ConnectioncCsmt|d�r|jSt|�}|jd�}|dkrRt|j�|_n|jdd|�|jS(s�Get switch connection

    Creates reusable SSH connection to the switch described in a given module.

    Args:
        module: A valid AnsibleModule instance.

    Returns:
        An instance of `ansible.module_utils.connection.Connection` with a
        connection to the switch described in the provided module.

    Raises:
        AnsibleConnectionFailure: An error occurred connecting to the device
    tslxos_connectiontnetwork_apitcliconftmsgsInvalid connection type %s(thasattrRtget_capabilitiestgetRt_socket_patht	fail_json(tmoduletcapabilitiesR((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pytget_connectionscCsDt|d�r|jSt|j�j�}tj|�|_|jS(s�Get switch capabilities

    Collects and returns a python object with the switch capabilities.

    Args:
        module: A valid AnsibleModule instance.

    Returns:
        A dictionary containing the switch capabilities.
    tslxos_capabilities(RRRRR	tjsontloads(R
R((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pyR	5s
c	Cs�t�}t|�}x�t|�D]�}t|t�rX|d}|d}|d}n|}d}d}|j|||�}yt|dd�}Wn1tk
r�|j	dd|t|�f�nX|j
|�q"W|S(	s.Run command list against connection.

    Get new or previously used connection and send commands to it one at a time,
    collecting response.

    Args:
        module: A valid AnsibleModule instance.
        commands: Iterable of command strings.

    Returns:
        A list of output strings.
    tcommandtprompttanswerterrorstsurrogate_or_strictRu#Failed to decode output from %s: %sN(tlistRRt
isinstancetdicttNoneR
RtUnicodeErrorRtappend(	R
tcommandst	responsest
connectiontcmdRRRtout((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pytrun_commandsHs"
	



$cCsnt|d�si|_n|jikr1|jSt|�}|j�}t|dd�j�}||_|S(s5Get switch configuration

    Gets the described device's current configuration. If a configuration has
    already been retrieved it will return the previously obtained configuration.

    Args:
        module: A valid AnsibleModule instance.

    Returns:
        A string containing the configuration.
    tdevice_configsRtsurrogate_then_replace(RR$Rt
get_configRtstrip(R
R R"tcfg((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pyR&ns	cCst|�}|j|�dS(sApply a list of commands to a device.

    Given a list of commands apply them to the device to modify the
    configuration in bulk.

    Args:
        module: A valid AnsibleModule instance.
        commands: Iterable of command strings.

    Returns:
        None
    N(Rtedit_config(R
RR ((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pytload_config�s
(
Rtansible.module_utils._textRt)ansible.module_utils.network.common.utilsRRtansible.module_utils.connectionRRR	R#R&R*(((sL/usr/lib/python2.7/site-packages/ansible/module_utils/network/slxos/slxos.pyt<module>s			&	

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]