Module Expr Str ImportFrom alias Import alias Import alias FunctionDef arguments args defaults body Expr Str Return CompareIn Str NameLoad decorator_list FunctionDef arguments args defaults body Expr Str Return Call AttributeLoad AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Index AttributeLoad SubscriptLoad NameLoad Index Str attr attr attr Str NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam NameParam NameParam NameParam defaults Str NameLoad NameLoad NameLoad NameLoad Str kwarg body Expr Str Assign NameStore Dict Str Str Str Str NameLoad Dict NameLoad Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore UnaryOpNot Call NameLoad TupleLoad NameLoad NameLoad If NameLoad body If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad orelse If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad keyword NameLoad keyword NameLoad keyword NameLoad NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str Return NameLoad orelse Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad orelse If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str If BoolOpAnd NameLoad UnaryOpNot NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str Return NameLoad orelse Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad keyword NameLoad NameLoad body If SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad Assign SubscriptStore NameLoad Index Str NameLoad If NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str NameLoad orelse AugAssignAdd SubscriptStore NameLoad Index Str Str Return NameLoad If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad IfExp NameLoad Str Str Assign SubscriptStore SubscriptLoad NameLoad Index Str Index NameLoad Str orelse Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr IfExp NameLoad Str Str NameLoad NameLoad Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad If BoolOpAnd NameLoad UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str NameLoad orelse Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad If SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad Assign SubscriptStore NameLoad Index Str NameLoad If NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str If UnaryOpNot Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad NameLoad NameLoad keyword NameLoad keyword NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad If NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Str Assign SubscriptStore SubscriptLoad NameLoad Index Str Index NameLoad Str orelse Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body AugAssignAdd SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults Str kwarg body Expr Str Assign NameStore Dict Str Str Str Str NameLoad Dict NameLoad Str If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad body If SubscriptLoad NameLoad Index Str body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad Return NameLoad If Call SubscriptLoad NameLoad Index Str NameLoad NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad Assign SubscriptStore SubscriptLoad NameLoad Index Str Index NameLoad Str Return NameLoad orelse Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad orelse Assign NameStore Call NameLoad If CompareIsNot NameLoad NameLoad body Assign SubscriptStore NameLoad Index Str NameLoad Assign SubscriptStore NameLoad Index Str NameLoad Return NameLoad Assign SubscriptStore NameLoad Index Str Call AttributeLoad Str attr NameLoad NameLoad Return NameLoad decorator_list
N/A N/A 
Management of MySQL users
=========================

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

.. code-block:: yaml

    frank:
      mysql_user.present:
        - host: localhost
        - password: bobcat


.. versionadded:: 0.16.2
    Authentication overrides have been added.

The MySQL authentication information specified in the minion config file can be
overridden in states using the following arguments: ``connection_host``,
``connection_port``, ``connection_user``, ``connection_pass``,
``connection_db``, ``connection_unix_socket``, ``connection_default_file`` and
``connection_charset``.

.. code-block:: yaml

    frank:
      mysql_user.present:
        - host: localhost
        - password: "bob@cat"
        - connection_user: someuser
        - connection_pass: somepass
        - connection_charset: utf8
        - saltenv:
          - LC_ALL: "en_US.utf8"


This state is not able to grant permissions for the user. See
:py:mod:`salt.states.mysql_grants` for further instructions.

 __future__ absolute_import N/A sys N/A salt.utils __virtual__ N/A N/A N/A N/A N/A 
    Only load if the mysql module is in __salt__
     N/A N/A mysql.user_create __salt__ N/A _get_mysql_error N/A N/A N/A N/A N/A 
    Look in module context for a MySQL error. Eventually we should make a less
    ugly way of doing this.
     N/A N/A N/A N/A N/A N/A sys modules N/A N/A N/A __salt__ N/A test.ping __module__ __context__ pop mysql.error None N/A present N/A N/A name host password password_hash allow_passwordless unix_socket password_column N/A localhost None None False False Password connection_args N/A N/A 
    Ensure that the named user is present with the specified properties. A
    passwordless user can be configured by omitting ``password`` and
    ``password_hash``, and setting ``allow_passwordless`` to ``True``.

    name
        The name of the user to manage

    host
        Host for which this user/password combo applies

    password
        The password to use for this user. Will take precedence over the
        ``password_hash`` option if both are specified.

    password_hash
        The password in hashed form. Be sure to quote the password because YAML
        doesn't like the ``*``. A password hash can be obtained from the mysql
        command-line client like so::

            mysql> SELECT PASSWORD('mypass');
            +-------------------------------------------+
            | PASSWORD('mypass')                        |
            +-------------------------------------------+
            | *6C8989366EAF75BB670AD8EA7A7FC1176A95CEF4 |
            +-------------------------------------------+
            1 row in set (0.00 sec)

    allow_passwordless
        If ``True``, then ``password`` and ``password_hash`` can be omitted to
        permit a passwordless login.

        .. versionadded:: 0.16.2

    unix_socket
        If ``True`` and allow_passwordless is ``True``, the unix_socket auth
        plugin will be used.
     N/A ret N/A name changes result comment name N/A True N/A N/A User {0}@{1} is already present format name host N/A passwordless N/A N/A any N/A password password_hash N/A passwordless N/A N/A N/A N/A N/A N/A salt utils is_true allow_passwordless N/A N/A N/A ret N/A comment Either password or password_hash must be specified, unless allow_passwordless is True N/A N/A ret N/A result False N/A ret N/A N/A N/A N/A __salt__ N/A mysql.user_exists name host passwordless True unix_socket unix_socket password_column password_column connection_args N/A N/A N/A ret N/A comment  with passwordless login N/A ret N/A N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment err N/A N/A ret N/A result False N/A ret N/A N/A N/A N/A __salt__ N/A mysql.user_exists name host password password_hash unix_socket unix_socket password_column password_column connection_args N/A N/A N/A ret N/A comment  with the desired password N/A N/A password_hash N/A password N/A N/A N/A ret N/A comment  hash N/A ret N/A N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment err N/A N/A ret N/A result False N/A ret N/A N/A N/A __salt__ N/A mysql.user_exists name host unix_socket unix_socket connection_args N/A N/A N/A __opts__ N/A test N/A N/A N/A ret N/A comment N/A N/A Password for user {0}@{1} is set to be  format name host N/A N/A ret N/A result None N/A passwordless N/A N/A N/A ret N/A comment cleared N/A N/A N/A N/A N/A salt utils is_true allow_passwordless N/A N/A N/A ret N/A comment , but allow_passwordless != True N/A N/A ret N/A result False N/A N/A N/A ret N/A comment changed N/A ret N/A N/A N/A __salt__ N/A mysql.user_chpass name host password password_hash allow_passwordless unix_socket connection_args N/A N/A N/A ret N/A comment N/A N/A Password for user {0}@{1} has been {2} format name host N/A passwordless cleared changed N/A N/A N/A ret N/A changes N/A name Updated N/A N/A N/A ret N/A comment N/A N/A Failed to {0} password for user {1}@{2} format N/A passwordless clear change name host N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment N/A N/A  ({0}) format err N/A N/A passwordless N/A N/A N/A N/A salt utils is_true allow_passwordless N/A N/A N/A ret N/A comment . Note: allow_passwordless must be True to permit passwordless login. N/A N/A ret N/A result False N/A N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment err N/A N/A ret N/A result False N/A ret N/A N/A __opts__ N/A test N/A N/A N/A ret N/A comment N/A N/A User {0}@{1} is set to be added format name host N/A N/A ret N/A result None N/A passwordless N/A N/A N/A ret N/A comment  with passwordless login N/A N/A N/A N/A N/A salt utils is_true allow_passwordless N/A N/A N/A ret N/A comment , but allow_passwordless != True N/A N/A ret N/A result False N/A ret N/A N/A N/A __salt__ N/A mysql.user_create name host password password_hash allow_passwordless unix_socket unix_socket password_column password_column connection_args N/A N/A N/A ret N/A comment N/A N/A The user {0}@{1} has been added format name host N/A passwordless N/A N/A N/A ret N/A comment  with passwordless login N/A N/A N/A ret N/A changes N/A name Present N/A N/A N/A ret N/A comment N/A N/A Failed to create user {0}@{1} format name host N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment N/A N/A  ({0}) format err N/A N/A ret N/A result False N/A ret N/A absent N/A N/A name host N/A localhost connection_args N/A N/A 
    Ensure that the named user is absent

    name
        The name of the user to remove
     N/A ret N/A name changes result comment name N/A True N/A N/A N/A __salt__ N/A mysql.user_exists name host connection_args N/A N/A N/A __opts__ N/A test N/A N/A N/A ret N/A result None N/A N/A ret N/A comment N/A N/A User {0}@{1} is set to be removed format name host N/A ret N/A N/A N/A __salt__ N/A mysql.user_remove name host connection_args N/A N/A N/A ret N/A comment N/A N/A User {0}@{1} has been removed format name host N/A N/A N/A ret N/A changes N/A name Absent N/A ret N/A N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment err N/A N/A ret N/A result False N/A ret N/A N/A err N/A _get_mysql_error N/A N/A err None N/A N/A N/A ret N/A comment err N/A N/A ret N/A result False N/A ret N/A N/A ret N/A comment N/A N/A User {0}@{1} is not present, so it cannot be removed format name host N/A ret N/A