Anons79 Mini Shell

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

�
�Udac@s�dZddlZddlmZyddlZeZWnek
rQeZnXyddl	m
Z
eZWnek
r�eZnXddlm
Z
ed�Zd�Zeed�Zd	�Zd
�ZdS(s/
This module adds shared support for Apstra AOS modules

In order to use this module, include it as part of your module

from ansible.module_utils.network.aos.aos import (check_aos_version, get_aos_session, find_collection_item,
                                      content_to_dict, do_load_resource)

i����N(tLooseVersion(tSession(t	to_nativecCsmts|jdd�nP|riddl}|jj}t|�t|�kri|jdd|�qintS(sy
    Check if the library aos-pyez is present.
    If provided, also check if the minimum version requirement is met
    tmsgsWaos-pyez is not installed.  Please see details here: https://github.com/Apstra/aos-pyezi����Ns*aos-pyez >= %s is required for this module(tHAS_AOS_PYEZt	fail_jsontapstra.aosomtaosomt__version__RtTrue(tmoduletmintapstratAOS_PYEZ_VERSION((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aos/aos.pytcheck_aos_version;scCs t|�t�}||_|S(s'
    Resume an existing session and return an AOS object.

    Args:
        auth (dict): An AOS session as obtained by aos_login module blocks::

            dict( token=<token>,
                  server=<ip>,
                  port=<port>
                )

    Return:
        Aos object
    (RRtsession(R
tauthtaos((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aos/aos.pytget_aos_sessionNs
		cCsXd}|r!|jd|�}n|r<|jd|�}n|dkrP|dS|SdS(s�
    Find collection_item based on name or id from a collection object
    Both Collection_item and Collection Objects are provided by aos-pyez library

    Return
        collection_item: object corresponding to the collection type
    tlabeltuidtN(tNonetfind(t
collectiont	item_nametitem_idtmy_dict((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aos/aos.pytfind_collection_itemfscCs{d}y@tj|�}t|t�s3t��n|sEt��nWn!tk
ri|jdd�nX||jd<|S(sH
    Convert 'content' into a Python Dict based on 'content_format'
    Rs<Unable to convert 'content' to a dict, please check if validtcontentN(Rtyamlt	safe_loadt
isinstancetdictt	ExceptionRtparams(R
Rtcontent_dict((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aos/aos.pytcontent_to_dict{s	

c	Cs�yt||d�}Wn!tk
r9|jdd�nX|jrq|jdtd|jd|jd|j�n|j	s�y|j
d|_|j�Wq�tk
r�}|jdd	t
|��q�Xn|jdtd|jd|jd|j�d
S(sS
    Create a new object (collection.item) by loading a datastructure directly
    RRs6An error occurred while running 'find_collection_item'tchangedtnametidtvalueRs!Unable to write item content : %rN(RR"Rtexistst	exit_jsontFalseR'R(R)t
check_modeR#tdatumtwriteRR	(R
RR'titemte((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aos/aos.pytdo_load_resource�s
	.	!(t__doc__tjsontdistutils.versionRRR	tHAS_YAMLtImportErrorR,tapstra.aosom.sessionRRtansible.module_utils._textRRRRR%R2(((sH/usr/lib/python2.7/site-packages/ansible/module_utils/network/aos/aos.pyt<module>&s$





		$

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