* mysql_user: prevent password getting set for existing users on on_create when plugin is used
* added changelog fragment
* format fix
* added substract_privs, to t list of arguments
* clarify the documetation
* additional documentation to password,plugin,plugin_hash_string,plugin_auth_string options, format fix on changelog
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* linting
* linting
* linting
* linting
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* mysql_role: add examples for "members_must_exist" argument
* mysql_role: fix syntax in example
* Update plugins/modules/mysql_role.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_role.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* mysql_role: add argument "members_must_exist" (boolean, default true)
The assertion that the users supplied in the "members" argument exist is only executed when the new argument "members_must_exist" is true, to allow opt-out.
* mysql_role: add integration tests for argument members_must_exist
* add changelog fragment
* mysql_role: fix behavior of members_must_exist argument
* Update plugins/modules/mysql_role.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update changelogs/fragments/369_mysql_role-add-members_must_exist.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* mysql_role: don't add members to a role when creating the role and "detach_members: true" is set, add integration test
* add changelog fragment
* mysql_role: add author betanummeric
* Update changelogs/fragments/367-mysql_role-fix-deatch-members.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* mysql_role: fix and simplify role membership detection
* add changelog fragment
* Update changelogs/fragments/368-mysql_role-fix-member-detection.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* add option subtract_privs to mysql_role and mysql_user
see https://github.com/ansible-collections/community.mysql/issues/331
* add integration tests for subtract_privs for mysql_role and mysql_user
* add changelog fragment for PR #333
* mysql_role, mysql_user: when subtract_privileges, don't grant unwanted privileges and don't revoke USAGE implicitly
* fix integration tests
* mysql_role, mysql_user: invalid privileges are ignored when subtract_privs is true -> document that and fix integration tests
* fix mysql_role integration tests
* fix mysql_role, mysql_user integration tests
* formatting
make the PEP8 check happy
* mysql_user and mysql_role: fix granting privileges when only the GRANT OPTION needs to be added
* mysql_user and mysql_role: log some updated privileges; explain integration test blind spot
* mysql_user and mysql_role: don't grant too much privileges
If only the grant option needs to be granted, at least one privilege needs to be granted to get valid syntax. USAGE is better for that than the existing privileges, because unwanted privileges would be re-added after revokation.
* mysql_user and mysql_role: fix type error
* Update changelogs/fragments/333-mysql_user-mysql_role-add-subtract_privileges-argument.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_role.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* added flush privileges to write dynamic privs into db
Fixes https://github.com/ansible-collections/community.mysql/issues/120
* added changelog fragment
* Update changelogs/fragments/338-mysql_user_fix_missing_dynamic_privileges.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Clarified error message about missing python modules, and tweak documentation to suggest overriding interpreter.
* Mention mysqlclient as another option
* Correct mysqlclient suggestions from python2 to python3
Co-authored-by: Matthew Exon <git.mexon@spamgourmet.com>
* Add default database "mysql" to mysql_user
Since permissions are stored in the "mysql" database anyway this should not change the behaviour of the module. But replication / binlog filters which rely on the current database will be able to filter the statements correctly afterwards. Prior to this change they were not executed in any database context and could not be filtered in any way by the existing methods in MySQL.
* Added changelog fragment
* Update changelogs/fragments/266-default-database-for-mysql-user
Thanks!
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update mysql_user.py
Make the change a configureable boolean
* Update 266-default-database-for-mysql-user
update changelog fragment
* Update 266-default-database-for-mysql-user
it´s not a bugfix anymore
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* renamed new option to force_context
enhanced description
added tests
* fixed changelog
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update plugins/modules/mysql_user.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* added more tests
* removed first test attempts again (from issue-28.yml)
created new tests for testing with and without replication
* added force_context: no testing
* forgot to add the new part to main.yml
* found a copy&paste issue
* fix include naming
* Made sure the tests work in local testing
* MariaDB handles online replication filters differently
* fix changelog
* Update changelogs/fragments/266-default-database-for-mysql-user.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Update changelogs/fragments/266-default-database-for-mysql-user.yml
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Use vendored version of distutils.version
* Correct fragment
* Update plugins/module_utils/version.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Prepare for distutils.version being removed in Python 3.12
* Update plugins/module_utils/version.py
Co-authored-by: Felix Fontein <felix@fontein.de>
Co-authored-by: Felix Fontein <felix@fontein.de>
* Remove all code related to VALID_PRIVS and get_valid_privs()
* Add tests to update user with invalid privs
* Re-raise InvalidPrivsError when granting privileges
* Fix: compatibility with python2
* More explicit assertions as commented by Andersson007
* Add changelog fragment
The naming rules for MySQL/MariaDB identifiers, when quoted, allow the
`%` character.
However, currently, the use of the `%` character in database names
results in mismatch or missing databases.
- Rewrite query to identify the databases in the catalog using
`information_schema` instead of `SHOW DATABASES LIKE`
- Escape the `%` character in `CREATE DATABASE` query.
Signed-off-by: Nicolas Payart <npayart@gmail.com>
* mysql_user: replace VALID_PRIVS by get_valid_privs() function
* Add EXTRA_PRIVS in case we need to add more privs in the future
* Add changelog fragment
* mysql_replication: add deprecation warning about future replacement of Is_Slave and Is_Master return values, add alternatives
* Add changelog fragment
* add mysql_full_version and suffix return variable
add changelog fragment
* rephrase changelog fragment
* Update plugins/modules/mysql_info.py
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
* Add changes as per PR review
* Add tests for new suffix output parameter
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
Co-authored-by: Jorge-Rodriguez <jorge.rodriguez@futurice.com>
* mysql_user: add proper handling of INSERT, UPDATE, REFERENCES on columns
* Add changelog fragment
* fix sanity
* fix CI
* fix sanity
* fix CI
* make the assertion fairer
* Improve