%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/webutil.pyo |
� ���^c @@ sk d Z d d l m Z m Z m Z d d l Z d Z d � Z d d d e d e d � Z d d d � Z d S( u+ Support for htpasswd module. Requires the apache2-utils package for Debian-based distros. .. versionadded:: 2014.7.0 .. code-block:: yaml username: webutil.user_exists: - password: secr3t - htpasswd_file: /etc/nginx/htpasswd - options: d - force: true i ( t absolute_importt print_functiont unicode_literalsNu webutilc C@ s t j j j d � r t St S( u# depends on webutil module u htpasswd( t saltt utilst patht whicht __virtualname__t False( ( ( s7 /usr/lib/python2.7/site-packages/salt/states/webutil.pyt __virtual__ s u c C@ s� i | d 6i d 6d d 6d d 6} t d | d j | � � d d k } t } | r� | r� | r� t d | | | d | d | �} n | s� | s� | rTt d r� d | d <d j | � | d <i t | 6| d <| St d | | | d | d | �} | d d k r5t | d <| d | d <i t | 6| d <| St | d <| d | d <| Sn t d ru| d rud | d <n t | d <d | d <| S( u Make sure the user is inside the specified htpasswd file name User name password User password htpasswd_file Path to the htpasswd file options See :mod:`salt.modules.htpasswd.useradd` force Touch the file even if user already created runas The system user to run htpasswd command with update Update an existing user's password if it's different from what's in the htpasswd file (unlike force, which updates regardless) u nameu changesu u commentu resultu file.grepu ^{0}:u retcodei u webutil.verifyt optst runasu testu. User '{0}' is set to be added to htpasswd fileu webutil.useraddu stderru User already knownN( t Nonet __salt__t formatR t __opts__t True( t namet passwordt htpasswd_filet optionst forceR t updatet rett existst password_changedt useradd_ret( ( s7 /usr/lib/python2.7/site-packages/salt/states/webutil.pyt user_exists$ s@ c C@ s i | d 6i d 6d d 6d d 6} t d | d j | � � d d k } | s| t d re d | d <n t | d <d | d <n� t d r� d | d <d j | � | d <i t | 6| d <n_ t d | | d | d t �} | d d k | d <| d | d <| d ri t | 6| d <n | S( u� Make sure the user is not in the specified htpasswd file name User name htpasswd_file Path to the htpasswd file runas The system user to run htpasswd command with u nameu changesu u commentu resultu file.grepu ^{0}:u retcodei u testu User already not in fileu2 User '{0}' is set to be removed from htpasswd fileu webutil.userdelR t all_resultsu stderrN( R R R R R ( R R R R R t userdel_ret( ( s7 /usr/lib/python2.7/site-packages/salt/states/webutil.pyt user_absentk s, ( t __doc__t __future__R R R t salt.utils.pathR R R R R R R ( ( ( s7 /usr/lib/python2.7/site-packages/salt/states/webutil.pyt <module> s F