%PDF- %PDF-
| Direktori : /proc/self/root/proc/3522530/root/lib/python2.7/site-packages/salt/modules/ |
| Current File : //proc/self/root/proc/3522530/root/lib/python2.7/site-packages/salt/modules/webutil.pyc |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z e j e
� Z d Z d � Z
d d d � Z d e d � Z d d d � Z d S(
u
Support for htpasswd command. Requires the apache2-utils package for Debian-based distros.
.. versionadded:: 2014.1.0
The functions here will load inside the webutil module. This allows other
functions that don't use htpasswd to use the webutil module name.
i ( t absolute_importt print_functiont unicode_literalsNu webutilc C@ s# t j j j d � r t St d f S( u7
Only load the module if htpasswd is installed
u htpasswduK The htpasswd execution mdule cannot be loaded: htpasswd binary not in path.( t saltt utilst patht whicht __virtualname__t False( ( ( s8 /usr/lib/python2.7/site-packages/salt/modules/webutil.pyt __virtual__ s u c C@ sW t j j | � s | d 7} n d d j | � | | | g } t d | d | d t �S( uU
Add a user to htpasswd file using the htpasswd command. If the htpasswd
file does not exist, it will be created.
pwfile
Path to htpasswd file
user
User name
password
User password
opts
Valid options that can be passed are:
- `n` Don't update file; display results on stdout.
- `m` Force MD5 encryption of the password (default).
- `d` Force CRYPT encryption of the password.
- `p` Do not encrypt the password (plaintext).
- `s` Force SHA encryption of the password.
runas
The system user to run htpasswd command with
CLI Examples:
.. code-block:: bash
salt '*' webutil.useradd /etc/httpd/htpasswd larry badpassword
salt '*' webutil.useradd /etc/httpd/htpasswd larry badpass opts=ns
u cu htpasswdu -b{0}u cmd.run_allt runast python_shell( t osR t existst formatt __salt__R ( t pwfilet usert passwordt optsR
t cmd( ( s8 /usr/lib/python2.7/site-packages/salt/modules/webutil.pyt useradd! s !
c C@ ss t j j | � s d Sd d | | g } | rM t d | d | d t �} n"