%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/mod_random.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddlZ	ddl
mZddlm
Z
e
jr�dZndZdZd	d
�Zd	d�Zdd
�Zdd�Zddd	d�Zdddd�Zddd�ZdS(ur
Provides access to randomness generators.
=========================================

.. versionadded:: 2014.7.0

i(tabsolute_importtprint_functiontunicode_literalsN(tSaltInvocationError(tsixu
algorithmsualgorithms_guaranteedurandomusha512cC@s:tjr6ttd�r6tt|�r6tdfSntS(u>
    Sanity check for compatibility with Python 2.6 / 2.7
    u
algorithmsuNThe random execution module cannot be loaded: only available in Python >= 2.7.(RtPY2thasattrthashlibtFalset__virtualname__(t	algorithm((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pyt__virtual__s	 
cC@s�tjr-t|tj�r-|jt�}nttt�r||t	tt�kr|tj
|�}|j|�|j�}nFtt|�r�tj
|�}|j|�|j�}nt
d��|S(uM
    .. versionadded:: 2014.7.0

    Encodes a value with the specified encoder.

    value
        The value to be hashed.

    algorithm : sha512
        The algorithm to use. May be any valid algorithm supported by
        hashlib.

    CLI Example:

    .. code-block:: bash

        salt '*' random.hash 'I am a string' md5
    u#You must specify a valid algorithm.(RtPY3t
isinstancetstring_typestencodet__salt_system_encoding__RRtALGORITHMS_ATTR_NAMEtgetattrtnewtupdatet	hexdigestR(tvalueR
thashertout((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pythash.s$

ubase64cC@s#tjr[y|j|�}Wqtk
r;td��qtk
rWtd��qXn�t|tj�r|jt�}n|dkr�y"t	j
|�}|jt�}Wqtk
r�td��qXnOy|j|�}Wn9tk
rtd��ntk
rtd��nX|S(u
    .. versionadded:: 2014.7.0

    value
        The value to be encoded.

    encoder : base64
        The encoder to use on the subsequent string.

    CLI Example:

    .. code-block:: bash

        salt '*' random.str_encode 'I am a new string' base64
    u You must specify a valid encoderu#Value must be an encode-able stringubase64(
RRRtLookupErrorRtAttributeErrorR
RRtbase64t	b64encodetdecodet	TypeError(RtencoderR((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pyt
str_encodeSs,	




icC@stjjj|�S(u�
    .. versionadded:: 2014.7.0

    Returns a random string of the specified length.

    length : 20
        Any valid number of bytes.

    CLI Example:

    .. code-block:: bash

        salt '*' random.get_str 128
    (tsalttutilstpycryptotsecure_password(tlength((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pytget_str}scC@stjjj|||�S(u�
    Generates a salted hash suitable for /etc/shadow.

    crypt_salt : None
        Salt to be used in the generation of the hash. If one is not
        provided, a random salt will be generated.

    password : None
        Value to be salted and hashed. If one is not provided, a random
        password will be generated.

    algorithm : sha512
        Hash algorithm to use.

    CLI Example:

    .. code-block:: bash

        salt '*' random.shadow_hash 'My5alT' 'MyP@asswd' md5
    (R"R#R$tgen_hash(t
crypt_salttpasswordR
((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pytshadow_hash�sii
cC@s,|dk	rtj|�ntj||�S(u�
    Returns a random integer number between the start and end number.

    .. versionadded: 2015.5.3

    start : 1
        Any valid integer number

    end : 10
        Any valid integer number

    seed :
        Optional hashable object

    .. versionchanged:: 2019.2.0
        Added seed argument. Will return the same result when run with the same seed.


    CLI Example:

    .. code-block:: bash

        salt '*' random.rand_int 1 10
    N(tNonetrandomtseedtrandint(tstarttendR.((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pytrand_int�scC@s3|dkrtd}ntj|�tj|�S(uu
    Returns a random number within a range. Optional hash argument can
    be any hashable object. If hash is omitted or None, the id of the minion is used.

    .. versionadded: 2015.8.0

    hash: None
        Any hashable object.

    range: 10
        Any valid integer number

    CLI Example:

    .. code-block:: bash

        salt '*' random.seed 10 hash=None
    uidN(R,t
__grains__R-R.t	randrange(trangeR((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pyR.�s

(t__doc__t
__future__RRRRRR-tsalt.utils.pycryptoR"tsalt.exceptionsRtsalt.extRRRR	RRR!R'R,R+R2R.(((s;/usr/lib/python2.7/site-packages/salt/modules/mod_random.pyt<module>s$		%*

Zerion Mini Shell 1.0