Commit graph

27 commits

Author SHA1 Message Date
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
Andrew Klychkov
f1c647f360
CI tests: add a note not to use tests as an example of writing roles (#32) 2020-09-28 08:15:47 +03:00
Jorge Rodriguez (A.K.A. Tiriel)
6e040e1496
Add test to verify TLS requirements are removed (#26)
* Add test to verify TLS requirements are removed

* Fix cursor parsing

* small fixes

* Refactor TLS tests into their own file

* Fix TLS requirements parsing
2020-09-21 07:39:08 +03:00
Jorge Rodriguez (A.K.A. Tiriel)
36e7e6603e
Add TLS connection parameters (#9)
* Add TLS connection parameters

* Add check mode tests

* Fix check mode indentation

* Run MySQL commands with the mysql_command variable

* Fix typo

* Restore code lost during cherry pick

* Fix conditionals to accomodate for MySQL v8

* Fix equal operators

* Remove Black formatting in an attempt to make codecov happy

* Remove deprecation notice

* Fix closing bracket

* Remove code duplication
2020-07-28 09:44:52 +03:00
Ben Mildren
ecd70e8022
pinned pymysql to 0.9.3 to ensure warnings are handled (#10)
Co-authored-by: Ben Mildren <bmildren@digitalocean.com>
2020-07-23 16:56:11 +01:00
Ben Mildren
ac79b437c8
updated replication integration tests, added testing for mysql 5.7 (#7)
Co-authored-by: Ben Mildren <bmildren@digitalocean.com>
2020-07-14 14:13:16 +01:00
Ben Mildren
c26bc095ad
initial commit (#1)
* initial commit

* removed remaining references to community.general

* enabled integration pipeline

* switched from preconfigured replication topology to simple multinode install

* updated version from 1.0.0 to 0.1.0
2020-07-10 17:16:58 +01:00