%PDF- %PDF-
| Direktori : /proc/self/root/proc/thread-self/root/usr/lib/python2.7/site-packages/salt/states/ |
| Current File : //proc/self/root/proc/thread-self/root/usr/lib/python2.7/site-packages/salt/states/netusers.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z e j e � Z d d l m
Z
d d l m Z m
Z
d d l m Z d d l Z d Z d � Z d � Z d
� Z d � Z d � Z d
� Z d � Z d � Z d � Z d d d � Z d S( u�
Network Users
=============
Manage the users configuration on network devices via the NAPALM proxy.
:codeauthor: Mircea Ulinic <mircea@cloudflare.com>
:maturity: new
:depends: napalm
:platform: unix
Dependencies
------------
- :mod:`NAPALM proxy minion <salt.proxy.napalm>`
- :mod:`Users configuration management module <salt.modules.napalm_users>`
.. versionadded:: 2016.11.0
i ( t absolute_importt print_functiont unicode_literalsN( t deepcopy( t loadst dumps( t sixu netusersc C@ s t j j j t t t � S( u_
NAPALM library must be installed for this module to work and run in a (proxy) minion.
( t saltt utilst napalmt virtualt __opts__t __virtualname__t __file__( ( ( s8 /usr/lib/python2.7/site-packages/salt/states/netusers.pyt __virtual__2 s c C@ s t d � S( u Retrieves configured usersu users.config( t __salt__( ( ( s8 /usr/lib/python2.7/site-packages/salt/states/netusers.pyt _retrieve_users= s c C@ s t t | � � S( u .( R R ( t probes( ( s8 /usr/lib/python2.7/site-packages/salt/states/netusers.pyt _ordered_dict_to_dictD s c C@ s t | � } | j | � | S( u6 Creates a longer list of accepted users on the device.( R t update( t device_userst common_userst expected_users( ( s8 /usr/lib/python2.7/site-packages/salt/states/netusers.pyt
_expand_usersK s
c C@ s� d } t } x� t j | � D]� \ } } | sP t } | d j d | � 7} q n t | j d � t � p� d | j d � k o� d k n s | d j d | � 7} q q W| | f S( u1 Checks if the input dictionary of users is valid.u u, Please provide details for username {user}.
t useru leveli i uM Level must be a integer between 0 and 15 for username {user}. Will assume 0.
( t TrueR t iteritemst Falset formatt
isinstancet gett int( t userst messgt validR t user_details( ( s8 /usr/lib/python2.7/site-packages/salt/states/netusers.pyt _check_usersU s =c @ sR i i d 6i d 6i d 6} t � j � � } t � j � � } | | } | | } | | @} t � f d � | D� � } t � f d � | D� � } i }
x� | D]� } � j | � } � j | � }
| |
k r� q� n i |
| <xC t j |
� D]2 \ } } | j | � | k r� | |
| | <q� q� Wq� W| j i | d 6|
d 6| d 6� | S( uJ Computes the differences between the actual config and the expected configu addu updateu removec 3@ s$ | ] } | � j | � f Vq d S( N( R ( t .0t username( t expected( s8 /usr/lib/python2.7/site-packages/salt/states/netusers.pys <genexpr>y s c 3@ s$ | ] } | � j | � f Vq d S( N( R ( R% R&