�
�Udac @ s d d l Z d d l m Z d d l m Z m Z d d l m Z m Z i Z d a i e d e
� d 6e � d 6e � d 6Z d � Z d
� Z e
d � Z d d
� Z d � Z d � Z e
e
d � Z d e
d � Z d � Z d � Z d e f d � � YZ d S( i����N( t to_text( t
Connectiont ConnectionError( t to_listt EntityCollectiont keyt commandt promptt answerc C s t r
t St | j � a t S( N( t _CONNECTIONR t _socket_path( t module( ( sJ /usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt get_connection$ s c C s= t | t � s t d � � n t | t � } | | � } | S( Ns argument must be of type <list>( t
isinstancet listt AssertionErrorR t
_COMMAND_SPEC( R t commandst transform( ( sJ /usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt to_commands, s
c C sg t | � } t | t | � � } t � } x6 | D]. } | j | � } | j t | d d �� q1 W| S( Nt errorst surrogate_then_replace( R R R R t gett appendR ( R R t check_rct
connectiont responsest cmdt out( ( sJ /usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyt run_commands5 s
t runningc C s7 t | � } | j | � } t | d d �j � } | S( NR R ( R t
get_configR t strip( R t sourcet connR t cfg( ( sJ /usr/lib/python2.7/site-packages/ansible/module_utils/network/onyx/onyx.pyR C s c C sM y t | � } | j | � Wn) t k
rH } | j d t | � � n Xd S( Nt msg( R t edit_configR t fail_jsonR ( R t configR"