%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //lib/python2.7/site-packages/salt/modules/webutil.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZej	e
�ZdZd�Z
ddd�Zded�Zddd	�ZdS(
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(tabsolute_importtprint_functiontunicode_literalsNuwebutilcC@s#tjjjd�rtStdfS(u7
    Only load the module if htpasswd is installed
    uhtpasswduKThe htpasswd execution mdule cannot be loaded: htpasswd binary not in path.(tsalttutilstpathtwhicht__virtualname__tFalse(((s8/usr/lib/python2.7/site-packages/salt/modules/webutil.pyt__virtual__sucC@sWtjj|�s|d7}nddj|�|||g}td|d|dt�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
    ucuhtpasswdu-b{0}ucmd.run_alltrunastpython_shell(tosRtexiststformatt__salt__R(tpwfiletusertpasswordtoptsR
tcmd((s8/usr/lib/python2.7/site-packages/salt/modules/webutil.pytuseradd!s!
cC@sstjj|�sdSdd||g}|rMtd|d|dt�}n"td|d|dt�j�}|S(uu
    Delete a user from the specified htpasswd file.

    pwfile
        Path to htpasswd file

    user
        User name

    runas
        The system user to run htpasswd command with

    all_results
        Return stdout, stderr, and retcode, not just stdout

    CLI Examples:

    .. code-block:: bash

        salt '*' webutil.userdel /etc/httpd/htpasswd larry
    u1Error: The specified htpasswd file does not existuhtpasswdu-Ducmd.run_allR
Rucmd.run(RRR
RRt
splitlines(RRR
tall_resultsRtout((s8/usr/lib/python2.7/site-packages/salt/modules/webutil.pytuserdelIscC@sqtjj|�stSddj|�|||g}td|d|dt�}tjd||�|ddkS(	u
    Return True if the htpasswd file exists, the user has an entry, and their
    password matches.

    pwfile
        Fully qualified path to htpasswd file

    user
        User name

    password
        User password

    opts
        Valid options that can be passed are:

            - `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.verify /etc/httpd/htpasswd larry maybepassword
        salt '*' webutil.verify /etc/httpd/htpasswd larry maybepassword opts=ns
    uhtpasswdu-bv{0}ucmd.run_allR
Ru,Result of verifying htpasswd for user %s: %suretcodei(RRR
RRRtlogtdebug(RRRRR
Rtret((s8/usr/lib/python2.7/site-packages/salt/modules/webutil.pytverifyms (t__doc__t
__future__RRRRtloggingtsalt.utils.pathRt	getLoggert__name__RRR	tNoneRRRR(((s8/usr/lib/python2.7/site-packages/salt/modules/webutil.pyt<module>	s		($

Zerion Mini Shell 1.0