%PDF- %PDF-
Mini Shell

Mini Shell

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

�
���^c	@@s�dZddlmZmZmZddlZd�Zd�Zdddde	e
e	e	d�Zdddde	e
d�ZdS(	uy
Management of MySQL grants (user permissions)
=============================================

:depends:   - MySQLdb Python module
:configuration: See :py:mod:`salt.modules.mysql` for setup instructions.

The mysql_grants module is used to grant and revoke MySQL permissions.

The ``name`` you pass in purely symbolic and does not have anything to do
with the grant itself.

The ``database`` parameter needs to specify a 'priv_level' in the same
specification as defined in the MySQL documentation:

* \*
* \*.\*
* db_name.\*
* db_name.tbl_name
* etc...

This state is not able to set password for the permission from the
specified host. See :py:mod:`salt.states.mysql_user` for further
instructions.

.. code-block:: yaml

   frank_exampledb:
      mysql_grants.present:
       - grant: select,insert,update
       - database: exampledb.*
       - user: frank
       - host: localhost

   frank_otherdb:
     mysql_grants.present:
       - grant: all privileges
       - database: otherdb.*
       - user: frank

   restricted_singletable:
     mysql_grants.present:
       - grant: select
       - database: somedb.sometable
       - user: joe
i(tabsolute_importtprint_functiontunicode_literalsNcC@s
dtkS(u4
    Only load if the mysql module is available
    umysql.grant_exists(t__salt__(((s</usr/lib/python2.7/site-packages/salt/states/mysql_grants.pyt__virtual__5scC@s!tjtdjjjdd�S(up
    Look in module context for a MySQL error. Eventually we should make a less
    ugly way of doing this.
    u	test.pingumysql.errorN(tsystmodulesRt
__module__t__context__tpoptNone(((s</usr/lib/python2.7/site-packages/salt/states/mysql_grants.pyt_get_mysql_error<su	localhostc	K@s�d}
i|d6id6td6|
j||||�d6}td|||||||	�r`|St�}|dk	r�||d<t|d<|S|r�tdr�td|||	�}
|
s�g}
nx�|
D]�}td	|�}|jd
�}|d}|d}td
||dk�}td
|�}|d|kr�dj|d�j	d�}tdd|d|d|d|d|d||	�q�q�Wntdr�d|d<dj|�|d<|Std||||||||	�rd|d<|dj||||�|d<d|d|<ned|d<|dj||||�|d<t�}|dk	rz|dcdj|�7<nt|d<|S( u	
    Ensure that the grant is present with the specified properties

    name
        The name (key) of the grant to add

    grant
        The grant priv_type (i.e. select,insert,update OR all privileges)

    database
        The database priv_level (i.e. db.tbl OR db.*)

    user
        The user to apply the grant to

    host
        The network/host that the grant should apply to

    grant_option
        Adds the WITH GRANT OPTION to the defined grant. Default is ``False``

    escape
        Defines if the database value gets escaped or not. Default is ``True``

    revoke_first
        By default, MySQL will not do anything if you issue a command to grant
        privileges that are more restrictive than what's already in place. This
        effectively means that you cannot downgrade permissions without first
        revoking permissions applied to a db.table/user pair first.

        To have Salt forcibly revoke perms before applying a new grant, enable
        the 'revoke_first options.

        WARNING: This will *remove* permissions for a database before attempting
        to apply new permissions. There is no guarantee that new permissions
        will be applied correctly which can leave your database security in an
        unknown and potentially dangerous state.
        Use with caution!

        Default is ``False``

    ssl_option
        Adds the specified ssl options for the connecting user as requirements for
        this grant. Value is a list of single-element dicts corresponding to the
        list of ssl options to use.

        Possible key/value pairings for the dicts in the value:

        .. code-block:: text

            - SSL: True
            - X509: True
            - SUBJECT: <subject>
            - ISSUER: <issuer>
            - CIPHER: <cipher>

        The non-boolean ssl options take a string as their values, which should
        be an appropriate value as specified by the MySQL documentation for these
        options.

        Default is ``False`` (no ssl options will be used)
    u.Grant {0} on {1} to {2}@{3} is already presentunameuchangesuresultucommentumysql.grant_existsutestumysql.user_grantsumysql.tokenize_grantu.iiumysql.quote_identifieru*udatabaseu,ugrantumysql.grant_revoketgranttdatabasetuserthosttgrant_optiontescapeu$MySQL grant {0} is set to be createdumysql.grant_addu*Grant {0} on {1} to {2}@{3} has been addeduPresentu0Failed to execute: "GRANT {0} ON {1} TO {2}@{3}"u ({0})N(
tTruetformatRRR
tFalset__opts__t
rpartitiontjointrstrip(tnameRR
RRRRtrevoke_firstt
ssl_optiontconnection_argstcommenttretterrtuser_grantst
user_grantttoken_grantstdb_parttmy_dbtmy_tabletgrant_to_revoke((s</usr/lib/python2.7/site-packages/salt/states/mysql_grants.pytpresentFsdH
	

	






 
 	
c
K@sci|d6id6td6dd6}td|||||||�rtdrod|d<dj|�|d<|Std	||||||�r�d
j||||�|d<d|d|<|St�}	|	dk	rCdj|||||	�|d<t|d<|SnBt�}	|	dk	rCd
j|||||	�|d<t|d<|Sdj||||�|d<|S(uj
    Ensure that the grant is absent

    name
        The name (key) of the grant to add

    grant
        The grant priv_type (i.e. select,insert,update OR all privileges)

    database
        The database priv_level (i.e. db.tbl OR db.*)

    user
        The user to apply the grant to

    host
        The network/host that the grant should apply to
    unameuchangesuresultuucommentumysql.grant_existsutestu$MySQL grant {0} is set to be revokedumysql.grant_revokeu-Grant {0} on {1} for {2}@{3} has been revokeduAbsentu3Unable to revoke grant {0} on {1} for {2}@{3} ({4})u@Unable to determine if grant {0} on {1} for {2}@{3} exists ({4})uCGrant {0} on {1} to {2}@{3} is not present, so it cannot be revokedN(RRRR
RRR(
RRR
RRRRRRR((s</usr/lib/python2.7/site-packages/salt/states/mysql_grants.pytabsent�s^

	


		
	

(
t__doc__t
__future__RRRRRRR
RRR'R((((s</usr/lib/python2.7/site-packages/salt/states/mysql_grants.pyt<module>/s$		�

Zerion Mini Shell 1.0