Commit graph

56 commits

Author SHA1 Message Date
Markus Bergholz
b34c23d07d
Fix revoke only grant (#503)
* fix

* test

* changelog
2023-02-08 09:24:35 +01:00
Laurent Indermühle
a5f3296d73
mysql_info - Add connector_name and connector_version to returned value (#497)
* Add methods to retrieve connector name and version
* Document that mysqlclient is also named MySQLdb
* Document version_added
* Add connector name and version in the returned block
* Cut condition to display any name that is return

In case of MySQLdb is renamed in mysqlclient. In that case, the
integration tests will catch this the day we update the connector
version.

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2023-01-30 13:35:24 +01:00
Jorge Rodriguez (A.K.A. Tiriel)
00fa058a18
491-CI-fix-tarball-download (#491)
* Fix mariadb test setup

* Update mysql src URL

* Add changelog fragment

* Update 491_fix_download_url.yaml

Sanity test failed because minor_changes in not an element of a list.

* Fix casing

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2023-01-24 19:12:35 +02:00
Andrew Klychkov
930a5a5d49
mysql_user: add session_vars argument (#489)
* mysql_user: add session_vars argument

* Update tests/integration/targets/test_mysql_user/tasks/main.yml

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
2023-01-24 14:53:29 +01:00
Diego Gullo
6ac89ca1f6
Display a more informative error when InvalidPrivsError is raised (#465) (#466)
* Display a more informative error when InvalidPrivsError is raised (Issue #465)

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2022-12-06 13:12:01 +01:00
R.Sicart
2d75bc19b8
Fix privilege changing everytime (#438)
* Compare privileges from before and after manipulation

* Add unit tests

* Fix FIXME integration tests related to this issue

* Fix sanity check

* Fix assertion when appending privs in mysql_role_initial integration tests

* Fix pylint

* [ci-skip] Add changelog fragment

* Fix: missing fragment file extension

* Replace privileges_equal() by a comparison

* Fix: sanity pylint

* Fix: forgot to remove privileges_equal import from unit tests
2022-09-08 18:26:58 +02:00
R.Sicart
cc5cf98368
Fix: grant revoked priv (#434)
* Fix: exclude mysql 8 from test_mysql_user's 'Assert that priv did not change' test

* Add tests to verify that GRANT permission is present after user modification

* Fix: do not revoke GRANT permission when it's already allowed and present in priv parameter

* Deduplicate tests name

Easier to debug this way

* Fix assertions named 'GRANT permission is present'

* Only revoke grant option if it exists and absence is requested

* Fix assertion comments

* Fix: Only revoke grant option if it exists and absence is requested

* Avoid pointless revocations when ALL are granted

* Assert that priv did not change on mariadb also

* Fix: sanity and unity tests

* Format long lines

* Add changelog fragment

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2022-09-02 13:40:06 +02:00
Laurent Indermühle
0a68bb270f
Is changed (#427)
* Refactor tests to use "is" and "is not" changed

* Refactor tests to use is succeeded or is failed

* Reformat indentation

* Add filter "bool" to prevent issues
2022-08-23 09:11:55 +02:00
Laurent Indermühle
61586ae4cc
Port stable 1 ci changes (#423)
* Add changes from stable-1 integrations tests (PR 418)

* Refactor to use connectors' info declared in setup_mysql

* Fix 2nd replication stop marked changed by mysqlclient
2022-08-16 09:15:50 +02:00
Laurent Indermühle
5108ca5e66
Fix mysqldump ignoring errors (#403)
* Add schema and tables for the tests

* Add tests for full dump with and without compression

* Add test for distinct dump with and without compression

* Fix sh not seeing errors for command before the pipe

sh is missing the pipefail flag. We must use bash for this.

* Add cleanup to prevent the following tests from failing

* Fix fqcn in module_defaults

* Add changelog fragment

* Add check to the error message to ensure we captured the right one

* Add option to activate the fix on systems with bash

* Fix errors when data schema is already absent

* Update changelogs/fragments/fix-256-mysql_dump-errors.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Add markup for commands in the documentation string

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Add markup and next release version in the documentation string

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Fix missing dependency for MySQL 8

* Add pipefail to tests of uncompressed dumps to enure it still works

* Fix "bash command not found" if pipefail is used for uncompressed dump

* Fix sanity pep8

* Document example of dump with pipefail

* Add dedpulication to command construct

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-06-30 06:54:26 +02:00
Andrew Klychkov
b62a59cf5a
Update mariadb to 10.6.8 in test matrix (#370)
* Update mariadb to 10.6.8 in test matrix

* try 10.8.3

* change tarball path

* Change tarball name

* Add mariadb 10.8

* Fix

* Fix

* Fix
2022-06-24 13:50:19 +02:00
Andrew Klychkov
04aa13f6d6
mysql_replication: set MASTER_SSL=0 when primary_ssl is set to no (#397)
* mysql_replication: set MASTER_SSL=0 when primary_ssl is set to no

* Improve doc
2022-06-13 08:13:58 +02:00
Andrew Klychkov
8e79690a02
mysql_db: add chdir argument (#396) 2022-06-13 08:11:18 +02:00
betanummeric
ed3935abec
mysql_user: add "update_password: on_new_username" argument, "password_changed" result field (#365)
* mysql_user: add value 'on_new_username' to argument 'update_password'

* mysql_user: return "password_changed" boolean (true if the user got a new password)

* mysql_user: optimize queries for existing passwords

* mysql_user: add integration tests for update_password argument

* mysql_user: add description for "update_password: on_new_username" argument

* add changelog fragment

* formatting (PEP8)

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>

* Update plugins/modules/mysql_user.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/365-mysql_user-add-on_new_username-and-password_changed.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Felix Hamme <felix.hamme@ionos.com>
Co-authored-by: Benjamin MALYNOVYTCH <bmalynovytch@users.noreply.github.com>
Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-31 16:00:24 +02:00
betanummeric
bf5086d19d
mysql_role: add argument "members_must_exist" (#369)
* 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>
2022-05-27 12:11:17 +02:00
Andrew Klychkov
647461010d
mysql_query: fix false change reports when IF NOT EXISTS clause is used (#322)
* mysql_query: fix false change reports when IF NOT EXISTS clause is used

* Fix

* Fix doc, add fragment

* Improve doc
2022-05-25 16:19:31 +02:00
betanummeric
ceda7662d0
mysql_role: don't add members to a role when creating the role and "detach_members: true" is set (#367)
* 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>
2022-05-25 11:47:39 +02:00
Andrew Klychkov
8d114c7e39
mysql_user: fix parsing privs when a user has roles assigned to it (#341)
* mysql_user: fix parsing errors when a user has roles assigned

* Add a changelog fragment

* Fix a typo

* Fix CI
2022-05-12 09:36:21 +02:00
betanummeric
ba4fea67b1
mysql_user, mysql_role: add argument subtract_privs to revoke privileges explicitly (#333)
* 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>
2022-05-09 09:50:49 +02:00
Andrew Klychkov
450cb19027
mysql_replication: fix failing when using primary_use_gtid with replica_ or slave_pos (#336) 2022-04-21 17:43:08 +02:00
R.Sicart
82cedf8510
Fix role integration tests for mariadb (#291)
* Fix: test_mysql_role : Check that the user have no active roles assertion

* Fix: test_mysql_role : Check in DB assertion

* Fix: test_mysql_role : Check in DB, if not granted, the query will fail for mariadb

* Fix: test_mysql_role : Check that the role is active assertion

* test_mysql_role : create checks for mariadb

* Make 'when' conditions uniform

* Fix: test_mysql_role : admin option tests

* test_mysql_role : create checks for mariadb

* Fix: add fixme on test which create role in check mode 'again'

It changes only on mariadb 10.2
(doesn't change on mysql 8 or mariadb 10.5)

* Fix: add fixme on test which create role 'again'

* Simplify test without checking Host part

* Fix 'show grant' checks for mariadb

* Enable mariadb tests for test_mysql_role target

* Add tests to verify role grants for roles

* Add FIXME comments for tests which do not pass on mariadb 10.2

* Fix FIXME tests related to mariadb 10.2

* Exclude mysqlclient==2.0.1 with mariadb from integration tests
2022-03-04 10:52:43 +01:00
Andrew Klychkov
c273ee36a7
Enable and fix integration tests for devel (#290)
* Enable and fix integration tests for devel

* Update repo targets

* Remove useless directive

* default container -> ubuntu1804

* revert last commit

* 10.2 does not support 20.04 focal; increase to 10.3
2022-03-01 17:57:20 +01:00
Daniel Rupp
f5e8fbb3f5
Add default database "mysql" to mysql_user (#266)
* 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>
2022-01-10 16:03:25 +01:00
R.Sicart
1b061131dd
Feature/mariadb integration ci (#246)
* Replace matrix.mysql by matrix.db_engine_version

* Specify db flavor

* Upgrade dbdeployer to 1.56.0

See https://github.com/datacharmer/dbdeployer/issues/120

* Fix: github workflow syntax

* Fix: mysql version file for mariadb engine

* Do not test mysql_variables modes persist and persist_only on mariadb

Those modes do not exist on mariadb. See https://mariadb.com/kb/en/set/

* Exclude integration tests for mariadb_10.5.4 with pymysql==0.7.10

* TLS on mariadb is disabled by default

* Configure mariadb supported versions in matrix

As discussed in https://github.com/ansible-collections/community.mysql/discussions/141#discussioncomment-643657

* Fix: test_mysql_db : assert that databases does not exist

"assertion": "database1 not in mysql_result.stdout"

* Fix: assertion mysql_version in result.version.full

* Fix: test_mysql_user : Check that the module made a change and that the expected plugin type is set

'mysql_native_password' in show_create_user.stdout

* Fix: test_mysql_replication : Create user for replication

ERROR 1064 (42000) at line 1: You have an error in your SQL syntax;
check the manual that corresponds to your MariaDB server version for the
right syntax to use near 'BY 'replication_pass'' at line 1

https://dev.mysql.com/doc/mysql-replication-excerpt/5.7/en/replication-howto-repuser.html
https://dev.mysql.com/doc/mysql-replication-excerpt/8.0/en/replication-howto-repuser.html
https://mariadb.com/kb/en/setting-up-replication/#example-enabling-replication-for-mariadb

Create user syntax compatible with auth plugin and password on both
mysql and mariadb.

https://dev.mysql.com/doc/refman/8.0/en/create-user.html
https://mariadb.com/kb/en/create-user/

* Fix: test_mysql_replication: replica_status 'dict object' has no attribute 'Source_Host'

* Do not test mysql_replication_channel.yml on mariadb

* Do not test target 'test_mysql_role' with mariadb, too much errors to fix

* Setup mysql_version_parts depending on install type (mysql or mariadb)

* Install mariadb-client when install_type is mariadb

To use the same client tools as the database engine.

And to use a more updated mysqldump version, in order to fix this error:

ERROR 1556 (HY000) at line 776: You can't use locks with log tables

* Fix: mysql auth plugin is set on mariadb >10.2

* Fix: skip assertion on mariadb 10.2

* Do not execute test_user_plugin_auth.yml tests on mariadb, create/update useer sql syntax not compatible

* Fix: test_mysql_user : assert user1 TLS requirements

Remove test for oldd versions

* Fix: typo

* Fix: test_mysql_user : Test idempotency (expect ok) ignore mariadb 10.5

* [ci skip] Add changelog fragment

* Delete changelog fragment
2021-12-14 09:30:46 +01:00
Andrew Klychkov
1f796d9e81
mysql_replication: remove mode values and ret values containing master / slave (#252)
* mysql_replication: remove mode values containing master / slave

* Add tests
2021-12-01 07:56:53 +01:00
Jorge Rodriguez (A.K.A. Tiriel)
dd4700989f
Remove support for REQUIRESSL privilege (#244)
* Remove support for REQUIRESSL privilege

* Fix error search string
2021-12-01 07:56:04 +01:00
R.Sicart
727b638d13
Get rid of privs comparison (#243)
* 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
2021-11-20 09:28:40 +01:00
Nicolas PAYART
e4de13aabe
mysql_db: Improve tests (#240)
- Define variables "db_names" and "db_formats" in defaults
- Use of the "vars" option in includes instead of default parameters
  that might be overridden by a previous task
- Use of the "loop" option in includes instead of duplicating include
  tasks
- Use a nested loop on db_names and db_formats in state_dump_import test

Signed-off-by: Nicolas Payart <npayart@gmail.com>
2021-11-08 09:52:54 +01:00
Nicolas PAYART
5522e45284
mysql_db: Fix assert in tests suite (#239)
Signed-off-by: Nicolas Payart <npayart@gmail.com>
2021-10-25 09:35:44 +02:00
Nicolas PAYART
6b12435b2b
Allow the "%" character in database name (#227)
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>
2021-10-21 08:38:46 +02:00
Andrew Klychkov
f47d4635f1
integration tests: remove superfluous debug task (#228)
* integration tests: remove superfluous debug task

* Turn off integration tests against devel
2021-10-12 13:05:07 +02:00
Andrew Klychkov
fc984b28aa
CI matrix update (#226)
* CI matrix update

* Fix test_mysql_user

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix CI
2021-10-12 11:24:28 +02:00
Andrew Klychkov
a1f419d541
mysql_info: fix TypeError failure when there are databases that do not contain tables (#205)
* mysql_info: fix TypeError failure when there are databases that do not contain tables

* Add changelog fragment
2021-08-20 08:17:34 +02:00
Andrew Klychkov
ce2b269f84
mysql_role: new module (#189)
* mysql_role: new module

* fixes

* fixes

* Add the role class

* Check if role exists

* role.add()

* role.__get_members

* tmp

* tmp

* Change tests

* Fix

* Fix

* add_members()

* get_privs()

* tmp

* __extract_grants() filler version

* Before big work

* tmp

* drop()

* tmp

* tmp

* Big changes

* Fix

* append_members, detach_members, append_privs

* tmp

* admin option

* Add tests

* Add tests

* Fix tests

* Remove debug warning

* Fix tests

* Add documentation

* Fix MariaDB case

* Fix MariaDB

* Fix MariaDB

* Fix MariaDB

* Fix MariaDB

* Fix MariaDB

* Fix

* Fix

* Remove debug warning

* Add try-except block

* tmp

* tmp

* tmp

* Fix

* Add err handling

* Add user check

* Check admin in db

* Fix CI

* Fix CI

* Fix CI

* Fix CI

* Fix

* Add mutually exclusive options

* Small refactoring, documenting

* Documenting, refactoring

* Change docs

* Refactoring

* Refactoring

* Refactoring

* Add unit tests

* Update README.md
2021-08-10 13:30:34 +02:00
Tong He
9055bb4c8c
mysql_query: correctly reflect changed status in replace statements (#193)
* mysql_query: correctly reflect changed status in replace statements.

* Fix the wrong indent.
2021-07-28 09:18:00 +02:00
Andrew Klychkov
c8f9b1cd3f
mysql_replication: Add aliases to "master" options, add alternatives to "master" state options, add announcement (#150)
* mysql_replication: Add aliases, add alternatives for the state option, announce major changes

* Change tests

* Add changelog fragment

* Fix changelog

* Update plugins/modules/mysql_replication.py

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@tiriel.eu>

* Update plugins/modules/mysql_replication.py

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@tiriel.eu>

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@tiriel.eu>
2021-04-20 15:58:21 +02:00
Andrew Klychkov
853db5a2a4
mysql_replication: add deprecation warning about future replacement of Is_Slave and Is_Master return values, add alternatives (#147)
* mysql_replication: add deprecation warning about future replacement of Is_Slave and Is_Master return values, add alternatives

* Add changelog fragment
2021-04-16 06:34:35 +02:00
Jorge Rodriguez (A.K.A. Tiriel)
dc522cc5d3
Deprecate REQUIRESSL privilege (#132)
* Deprecate REQUIRESSL privilege

* Add missing whitespace

* Fix according to PR review

* Fix conditional check

* Fix privilege string parsing

* Add unit tests for the new function

* Add integration tests

* Fix parentheses indentation

* Cover alternative error message

* Fix privileges

* Limit verification of access denied to pymysql connector

* Fix REQUIRE SSL verification tests
2021-04-10 07:01:15 +02:00
Sebastian Gumprich
a5ee4b3d1a
add mysql_full_version and suffix return variable (#115)
* 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>
2021-03-16 09:10:52 +02:00
Andrew Klychkov
979588e2cd
mysql_user: add proper handling of INSERT, UPDATE, REFERENCES on columns (#107)
* 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
2021-03-08 17:18:04 +01:00
Andrew Klychkov
2694464ffb
mysql_user: when grant select on columns, the module always report the state has changed (#100)
* mysql_user: fix the module is not idempotent when there is SELECT on columns granted

* add changelog fragment

* fix

* Add unit tests for has_select_on_col function

* Add unit tests for sort_column_order function

* Add unit tests for handle_select_on_col function

* Update a comment
2021-03-03 10:58:57 +01:00
Andrew Klychkov
e8dc2f2476
mysql_replication: deprecation of slave related options, adding alternatives (#97)
* mysql_replication: deprecation of slave related options, adding alternatives

* Add changelog fragment

* Integration tests getslave -> getreplica

* Change the rest of offending choices/comments

* Add announcement about replacing SLAVE to REPLICA in messages

* Deprecate offending values
2021-03-01 10:45:35 +01:00
Steve Teahan
06907715d7
mysql_user: fixed encrypted option for MySQL 8.0 and test coverage (#79)
* mysql_user: fixed encrypted option for MySQL 8.0 and test coverage

The purpose of this change was originally to expand test coverage to
unblock #76, but an issue was detected with the encrypted parameter on
MySQL 8.0 in the process of writing the tests. Additionally,
user_password_update_test.yml had been disabled at some point, so I
opted to replace it with two new files that will focus on the password
and plugin auth paths.

* Updated tests to cover a couple of missing branches

* Skip tests that rely on sha256_password if pymysql < 0.9

* Cover the case where pymysql isn't installed for plugin tests

* Added better plugin auth checking to tests and other minor changes

* Fixed version detection to explicitly handle MariaDB

* Removed unneeded import from previous change

* Remove whitespace that was introduced by change that was removed

* Added unit tests for missing coverage
2021-01-14 08:27:05 +03:00
Andrew Klychkov
ebe503823a
mysql_replication: fix crashes caused by deprecated terminology (#71)
* mysql_replication: fix crashes caused by deprecated terminology

* Fix unrelated sanity errors

* Tests: mysql 8.0.21 -> 8.022

* Adjust integration tests

* Add version check to the tests

* Add debug statement

* Adjust mysql version

* Fix tests

* Add unit tests

* Add changelog fragment

* Improve code and coverage

* Get rid of extra blank line

* Improve coverage

* Change suggested
2020-12-18 11:17:18 +03:00
steveteahan
20f9699199
mysql_user: Fixed change detection with append_privs (#69) (#72)
* mysql_user: Fixed change detection with append_privs (#69)

Prior to this change, mysql_user with append_privs would attempt to make
a change even if the current privileges were a superset of the new
privileges (shouldn't require any action).

* Fixed unrelated mysql_replication doc causing failures in CI

* Added fragments and check_mode tests

* Expanded priv append tests to cover additional case
2020-12-16 08:22:00 +03:00
Andrew Klychkov
2dcbd7846f
mysql_query, mysql_user: simple refactoring of type checks (#58)
* mysql_query: simple refactoring of query type check

* do the same for mysql_user

* Improve integration test coverage
2020-11-06 13:12:07 +03:00
Andrew Klychkov
ae9c0a1751
mysql_query: fix failing when single-row query contains commas (#53)
* mysql_query: fix failing when single-row query contains commas

* add changelog fragment

* Improve documentation and tests

* Fix typo

* Improve test coverage

* Fix

* Remove the irrelevant note

* change suggested
2020-11-03 15:04:39 +03:00
Andrew Klychkov
82ad06e072
mysql modules: fix failing when \!include_dir is in config file (#47)
* mysql modules: fix failing when \!include_dir is in .my.cnf

* Add changelog fragment

* fix CI

* fix CI

* Fix CI

* Fix CI

* Fix comment
2020-10-13 16:05:39 +03:00
Jorge Rodriguez (A.K.A. Tiriel)
8c79011dbd
Disable hostname check (#38)
* Add changelog fragment

* Add check_hostname option

* Propagate check_hostname option across the collection

* Update documentation fragment

* Propagate test to all other plugins

* Remove stray line

* Give test user privileges to run test operations

* Extend integration tests job matrix

* Add caution note to documentation fragment.

* Update matrix job name

* Rearrange job matrix

* Fix sanity issues

* Fix issue with mysqldb silently failing to update out of range variables

* Fix variable overwrite

* Ignore `check_hostname` when using MySQLdb

* Update plugins/doc_fragments/mysql.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update plugins/doc_fragments/mysql.py

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

* Update changelogs/fragments/35-disable-hostname-check.yml

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2020-10-12 21:19:43 +03:00
Andrew Klychkov
6322a65dbb
mysql_user: fix error when modifying user with host_all (#40)
* mysql_user: fix error when modifying user with host_all

* Add changelog fragment and CI tests

* Update changelogs/fragments/40-mysql_user_fix_error_when_host_all_used.yml

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@tiriel.eu>

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@tiriel.eu>
2020-09-30 22:37:42 +03:00