%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/states/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/states/postgres_user.pyo

�
���^c@@s�dZddlmZmZmZddlZddlZddlmZddl	m
Z
eje�Z
d�Zddddddddddddddddddd�Zddddddd�ZdS(	u�
Management of PostgreSQL users (roles)
======================================

The postgres_users module is used to create and manage Postgres users.

.. code-block:: yaml

    frank:
      postgres_user.present
i(tabsolute_importtunicode_literalstprint_functionN(tpostgres(tsixcC@sdtkrtdfStS(u5
    Only load if the postgres module is present
    upostgres.user_existsuFUnable to load postgres module.  Make sure `postgres.bins_dir` is set.(t__salt__tFalsetTrue(((s=/usr/lib/python2.7/site-packages/salt/states/postgres_user.pyt__virtual__s
c#C@s�i|d6id6td6dj|�d6}|tk	rCtj}ntj||d|�}|	d6k	r�tj||	d|�}	ni|d6|
d6|d	6|d
6|d6|d6}d
}td|d|
|�}|d6k	r�d}nd6}i}|dkrT|jdg�}|d6k	r:|d|kr:||d<n|d6k	rc|d|krc||d<n|d6k	r�|d|kr�||d<n|d6k	r�|d|kr�||d<n|d6k	r�|d|kr�||d<n|d6k	r|d|kr||d<n|d6k	r6|
s)|d|kr6t|d<n|d6k	r�tddj|j	dd��|�d d!}yt
j
j|d"�}Wntk
r�d6}nX||d#kr�||d$<q�n|d6k	rT|}t
|tjtjf�r|jd%�}nt
|t�rQg|D]}||kr|^q}|rN||d<qNqQqTn|d
kru|d6kru|	}n|d
ks�|dkr6|r6td&r�|r�||d|<nd6|d<d'j||�|d<|Std(j|�d)|d*|d+|d|d,|d-|d.|d/|d0|d1|d2||�}nd6}|r�d3j||�|d<|ro||d|<q�d4|d|<n6|d6k	r�d5j|�|d<t|d<n
t|d<|S(7u�
    Ensure that the named user is present with the specified privileges
    Please note that the user/group notion in postgresql is just abstract, we
    have roles, where users can be seens as roles with the LOGIN privilege
    and groups the others.

    name
        The name of the system user to manage.

    createdb
        Is the user allowed to create databases?

    createroles
        Is the user allowed to create other users?

    encrypted
        Should the password be encrypted in the system catalog?

    login
        Should the group have login perm

    inherit
        Should the group inherit permissions

    superuser
        Should the new user be a "superuser"

    replication
        Should the new user be allowed to initiate streaming replication

    password
        The system user's password. It can be either a plain string or a
        md5 postgresql hashed password::

            'md5{MD5OF({password}{role}}'

        If encrypted is None or True, the password will be automatically
        encrypted to the previous
        format if it is not already done.

    default_password
        The password used only when creating the user, unless password is set.

        .. versionadded:: 2016.3.0

    refresh_password
        Password refresh flag

        Boolean attribute to specify whether to password comparison check
        should be performed.

        If refresh_password is ``True``, the password will be automatically
        updated without extra password change check.

        This behaviour makes it possible to execute in environments without
        superuser access available, e.g. Amazon RDS for PostgreSQL

    valid_until
        A date and time after which the role's password is no longer valid.

    groups
        A string of comma separated groups the user should be in

    user
        System user all operations should be performed on behalf of

        .. versionadded:: 0.17.0

    db_user
        Postgres database username, if different from config or default.

    db_password
        Postgres user's password, if any password, for a specified db_user.

    db_host
        Postgres database host, if different from config or default.

    db_port
        Postgres database port, if different from config or default.
    unameuchangesuresultuUser {0} is already presentucommentt	encryptedumaintenance_dburunasuhostuuseruportupassworducreateupostgres.role_gettreturn_passworduupdateugroupsucan create databasesucreatedbuinherits privilegesuinheritu	can loginuloginucan create rolesucreaterolesureplicationu	superuserupostgres.psql_queryu!SELECT '{0}'::timestamp(0) as dt;u'u''iudtu%Y-%m-%d %H:%M:%Suexpiry timeuvalid_untilu,utestuUser {0} is set to be {1}dupostgres.user_{0}tusernametcreatedbtcreaterolest	superusertlogintinherittreplicationtrolepasswordtvalid_untiltgroupsuThe user {0} has been {1}duPresentuFailed to create user {0}N(RtformatRRt_DEFAULT_PASSWORDS_ENCRYPTIONt_maybe_encrypt_passwordtNoneRtgettreplacetdatetimetstrptimet
ValueErrort
isinstanceRtstring_typest	text_typetsplittlistt__opts__(tnameRR
R	RRRRtpasswordtdefault_passwordtrefresh_passwordRRtusertmaintenance_dbtdb_passwordtdb_hosttdb_porttdb_usertrettdb_argstmodet	user_attrtcrettupdatetuser_groupstvalid_until_dttlgroupstatmissing_groups((s=/usr/lib/python2.7/site-packages/salt/states/postgres_user.pytpresent%s�c
			
	





"
	

%	



c	C@si|d6id6td6dd6}i|d6|d6|d6|d	6|d
6|d6}td||�r�td
r�d|d<dj|�|d<|Std||�r�dj|�|d<d|d|<|St|d<dj|�|d<|Sndj|�|d<|S(u�
    Ensure that the named user is absent

    name
        The username of the user to remove

    user
        System user all operations should be performed on behalf of

        .. versionadded:: 0.17.0

    db_user
        database username if different from config or default

    db_password
        user password if any password for a specified user

    db_host
        Database host if different from config or default

    db_port
        Database port if different from config or default
    unameuchangesuresultuucommentumaintenance_dburunasuhostuuseruportupasswordupostgres.user_existsutestuUser {0} is set to be removedupostgres.user_removeuUser {0} has been removeduAbsentuUser {0} failed to be removedu0User {0} is not present, so it cannot be removedN(RRR#RRR(	R$R(R)R*R+R,R-R.R/((s=/usr/lib/python2.7/site-packages/salt/states/postgres_user.pytabsents4






(t__doc__t
__future__RRRRtloggingtsalt.modulesRtsalt.extRt	getLoggert__name__tlogRRR9R:(((s=/usr/lib/python2.7/site-packages/salt/states/postgres_user.pyt<module>s>	
�

Zerion Mini Shell 1.0