Commit graph

69 commits

Author SHA1 Message Date
Laurent Indermühle
a4d3246b22
Release 1.5.1 commit (#538)
* Release 1.5.1 commit
2023-05-05 12:42:31 +02:00
Laurent Indermühle
3e975ca7a1
[PR #514/e2aa655 backport][stable-1] Fix issues and documentation with integration tests after merge of #490 (#520)
* Fix issues and documentation with integration tests after merge of #490. (#514)

* Fix explanation about containers images
* Add definitive URI to the containers images
* Document that new images must be set as public
* Document makefile options possible values
* Document that any mysql and mariadb tag can be used
* Add computation of docker_image path
* Refactor pre-command to separate commands for cleaner GHA output
* Refactor to use GHA test matrix
* Cut docker_image from documentation since it's now automatic
* Document how to use run_all_test.py to display the test matrix

(cherry picked from commit e2aa655762)

* Add changelog fragment
* Cut tests for MariaDB 10.5 and 10.6 that never worked with stable-1
2023-03-30 08:25:54 +02:00
Laurent Indermühle
54efe0bbb8
[PR #490/6970aef backport][stable-1] Integrations tests : Use containers (#517)
* Integrations tests : Use containers for more control and verify that versions match expectation (#490)

* Add healthcheck to MariaDB before starting the tests
This prevent the first test to fail because the db isn't ready yet.

* Add % instead of the default 'localhost' since we use remote connection

Previously, everything was on localhost. Now ansible-test is in a
venv and the db is in a container. The db see the IP address from the
podman host (10.88.0.2)

* Add mysql_client to the controller

* Prepare controller with Podman/Docker Network

We use the Podman/Docker network gateway address to communicate between
container. I haven't tested Docker. I would have preferred to use a pod
but only Podman support it and ansible-test only support the
--docker-network option.

* Generalize mysql and mariadb version based on container name

This way we can split db_engine and db_version and simplify tests.
Also this is mandatory to use the matrix.db_engine_version as the
image name for our services containers.

* Fix replication due to usage of gateway_addr instead of localhost

* Refactor setup_mysql into setup_controller

* Fix server_id in GHA

GHA lack a way to pass option to docker's command. Also server_id is
not read as a environment variable. So I'm forced to use a config file.

* Refactor test_mysql_user to work with other host than localhost

* Refactor way tests info are passed from sed to file with lookup

The idea is to avoid modifying test targets from the workflow to prevent
ansible-test to think every tests needs to be run.

* Refactor test to use the db_version from setup_controller

* Add temporary files to .gitignore

* Add back docker healthcheck on services

I saw in the GHA logs that it perform an healtcheck ! So I hope this
will work.

* Refactor the way server_id is set for replicas

The simple way is to add '--server-id 2' after the name of the image of
the container. But GHA doesn't let us do that. The idea of mount a file
from our repo doesn't work because the repo is check out later in the
workflow and I failed to find a pre-job hook. Then I realized that this
MySQL option is dynamic! So we will set that in the test target!

* Add IF NOT EXISTS to prevent misleading error on retry

* Cut python 3.11 not supported by ansible-test yet

* Add option to run only a single target

* Disable replication with channel tests entirely for MySQL 5.7

* Activate Mysql 8 and Mariadb into GitHub Action Workflow

* Document run_all_tests.py

* Fix replication settings

sh don't know 'echo -e', so we use bash instead.
Also, we need to wait for the container to be healthy before trying to
restart it. Otherwise that could corrupt it.

* Add more descriptive tests names

* Use mysql_host var name instead of gateway_addr in tests

* Refactor user@<gateway ip addr> into user@%

* Workaround for plugin role that fails with any MariaDB versions

* Ensure replicas are healthy before rebooting them

* Add a virtualenv for ansible-test used locally

* Cut column-statistics disabling

Thanks to our test-container, we now use the correspond mysql-client.
So to test mysql 5.7 we use mysql-client-5.7 and to test mysql 8 we
use mysql-client-8.

* Fix test matrix

Python version should be quoted, otherwise 3.10 become 3.1
We can skip 2.14 and devel with Python3.8
We can skip devel with Python 3.9
We can skip MariaDB 10.4 with mysql-client-10.6
Add tests for MariaDB 10.6, 10.7 and 10.8

* Fix queries for roles

* Add filter for issues resolved in newer version of mysqlclient

* Add names to tests

* Cut tests for incompatible MySQL 8 and pymysql 0.7.11

* Fix assertion for older mysqlclient than 2.0.1 with mysql (mariadb ok)

* Change docker-image workflow to work on all images using matrix

* Add support for version of mysqlclient

* Fix verify database version

Sometimes, version_full contains trailing information (-log). To prevent
issues it's best to concatenate major and minor version.

* Cut filter for tests now that the right connector is used

* Add clean up in "always" phase of the block

Because our tests use --retry-on-error, and the first thing the test
does is to try to create the database. We must cleanup otherwise if
there is a retry, it will throw a misleading "database already exists"
error.

* Disable tests using pymysql 1.0.2

Many tests are failing but this must be fixed in the plugins in a future
PR.

* Cut test MySQL 8 with incompatible pymysql 0.7.11

It fails to connect with error about cryptography unsupported

* Fix missing cffi package to connect to MySQL 8 using Python 3.9

* Split Docker image workflow to rebuild only changed Dockerfile

My goal is not to save the planet but to make it work. Currently
docker/setup-buildx-action@v2 often fails. You have to rerun the
workflow multiple times until it succeed. When you do that with the
matrix with 15 containers, you never get to the point where they all
built successfully. Having separate workflows makes rerun the failing
build easier.

* Add option to let containers alive at end of testing

* Migrate tests documentations in their own file

* Document usage of continue_on_errors

* Add support for systems with unsupported python set as default

* Add create podman network for system missing it.

We saw that on a Fedora 33 with Podman 3.3.1, an old system. I didn't
find in which release the default network changed and maybe it's
defined in the Linux distribution. So in doubt I always attempt to
create the network.

* Add full path to image to prevent podman asking which registry to use

* Add options to enforce recreate containers even if already exists

* Add deletion of anonymous volumes associated with the container

* Change shebang from python to python3 to avoid confusion with python2

This script is a python3 script.

* Add disk and RAM requirements

* Cut the 3 from python command to follow shebang recommendations

https://docs.ansible.com/ansible-core/devel/dev_guide/testing/sanity/shebang.html

* Reformat file path

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

* Move utility task files in their own folder

* Add called workflow file in the GHA hooks

Without this, the containers are not rebuilt when you modify the file
built-docker-image.yml.

* Rollback to github.repository in container image name

This time I think I understood. We publish in the
github.repository_owner's namespace. In my case it's laurent-indermuehle
and in case of upstream it's ansible-collections. A proof of that:
https://github.com/orgs/ansible-collections/packages <- here there is
one attempt I did in february to push my branch to the upstream.
So, our tests containers will be visible to the whole community, not
just community.mysql.

---------

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@futurice.com>
(cherry picked from commit 6970aef8f6)

* Add changelog fragment

* Disable tests that doesn't work on stable-1

It's shameful to disable tests, but they didn't makes much sense
anyway.

* Fix error message being different on stable-1 than v3

* Disable tests against MariaDB 10.5 and 10.6

Does version have never been tested on stable-1 and many tests fails.
2023-03-29 08:56:09 +02:00
Markus Bergholz
8687e575d7
prepare community.mysql 1.5.0 (#505)
* prepare 1.4.10

* 1.5.0
2023-02-08 10:34:27 +01:00
patchback[bot]
cf25d85e49
[PR #497/a5f3296d backport][stable-1] mysql_info - Add connector_name and connector_version to returned value (#498)
* 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>
(cherry picked from commit a5f3296d73)

* Cut fragment not relevant to the collection usage

* Updated version_added for stable-1

---------

Co-authored-by: Laurent Indermühle <laurent.indermuehle@pm.me>
2023-02-01 09:47:44 +01:00
Andrew Klychkov
963e042edd
491-CI-fix-tarball-download (#491) (#493)
* 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>
(cherry picked from commit 00fa058a18)

Co-authored-by: Jorge Rodriguez (A.K.A. Tiriel) <jorge.rodriguez@futurice.com>
2023-01-25 10:56:39 +01:00
Laurent Indermühle
85a63511b6
Backport/stable 1/pr 452 (#464)
* Sync GHA workflow w/ the collection template (#452)

* Sync GHA workflow w/ the collection template

* Drop the trailing pre-cmd semicolon

* Recover missing `-e` flag of `sed`

* Use relative paths for version configs

* Unquote `env.connector_version_file`

* Use string formatting to fix the substitution problem

(cherry picked from commit 8107530744)
(cherry picked from commit 704a0cea6a)

* Backport mysql_version_parts variable assignation

(cherry picked from commit 79046a88cb)
(cherry picked from commit a59d95501e)

* Add changelog fragment

(cherry picked from commit 26ecd68801)

* Backport flags and variables to differentiate MariaDB from MySQL setup

(cherry picked from commit b4303511d5)

* Backport issue-28 check for tls support

(cherry picked from commit efde607d25)

* Backport tls_requirements simplified and deduplified tests

(cherry picked from commit ac5a339644)

Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
2022-11-10 15:00:42 +01:00
Laurent Indermühle
99548e10cb
Release 1.4.8 commit (#410) 2022-08-02 10:08:19 +02:00
Andrew Klychkov
d8ab933d79
Update licensing information (#392) 2022-06-03 16:28:29 +02:00
Andrew Klychkov
949cb0c1dd
Release 1.4.7 commit (#387) 2022-06-02 08:15:26 +02:00
hubiongithub
4d4a5f2a02
merge into stable1 (#383)
* PR379 merge

* Update plugins/modules/mysql_user.py

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

Co-authored-by: Andrew Klychkov <aaklychkov@mail.ru>
2022-05-31 17:43:15 +02:00
Andrew Klychkov
f7677aa05b
[stable-1] mysql_query: fix false change reports when IF NOT EXISTS clause is used (#375)
* 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

(cherry picked from commit 647461010d)

* Fix tests
2022-05-26 08:41:21 +02:00
Andrew Klychkov
0921d4eef5
Release 1.4.6 commit (#361) 2022-05-17 12:08:28 +02:00
Felix Fontein
f4736770e3
Add PSF-license.txt file (#356) (#359)
* Add PSF-license.txt file.

* Update with actual CPython 3.9.5 license.

(cherry picked from commit b2e476cb1a)
2022-05-17 08:24:07 +02:00
Andrew Klychkov
3bb7b00497
Release 1.4.5 commit (#353) 2022-05-13 09:07:25 +02:00
Andrew Klychkov
393023eb07
[stable-1] mysql_user: fix parsing privs when a user has roles assigned to it (#346)
* mysql_user: fix parsing privs when a user has roles assigned to it

* Fix CI

* Fix CI
2022-05-12 15:19:20 +02:00
Andrew Klychkov
256817ca32
Drop support for Ansible 2.9 and ansible-base 2.10 (#347) 2022-05-12 14:11:36 +02:00
patchback[bot]
a2a4a1ff61
Move CHANGELOG.rst at top level (#349) (#351)
(cherry picked from commit f57ed38beb)

Co-authored-by: Andrew Klychkov <aklychko@redhat.com>
2022-05-12 11:53:46 +02:00
Andrew Klychkov
b730cd6675
mysql_user: added flush privileges to write dynamic privs into db (#340) 2022-04-29 17:52:07 +02:00
Andrew Klychkov
59d411ac82
Add IF EXISTS clause to DROP USER statement (#309) 2022-03-15 15:43:09 +01:00
Andrew Klychkov
f46b84e670
Release 1.4.4 commit (#277) 2022-01-18 11:05:37 +01:00
Andrew Klychkov
9386045797
[stable-1] Use vendored version of distutils.version (#274)
* Prepare for distutils.version being removed in Python 3.12 (#267)

* 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>
(cherry picked from commit d9e12b85ad)

* Use vendored version of distutils.version (#269)

* 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>
(cherry picked from commit 9c575b4762)

* Add ignore-2.13.txt
2022-01-18 10:53:09 +01:00
Andrew Klychkov
ace830ef56
Release 1.4.3 commit (#222) 2021-09-23 14:29:24 +02:00
Andrew Klychkov
dbcc7e7e60
[stable-1] mysql_info: fix TypeError failure when there are databases that do not contain tables (#209)
* 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

(cherry picked from commit a1f419d541)

* Fix sanity errors
2021-08-20 09:50:34 +02:00
Andrew Klychkov
f49206d3b3
Release 1.4.2 commit (#198) 2021-08-11 08:38:59 +02:00
Andrew Klychkov
64b06aa543
mysql_query: correctly reflect changed status in replace statements (#193) (#197)
* mysql_query: correctly reflect changed status in replace statements.

* Fix the wrong indent.

(cherry picked from commit 9055bb4c8c)

Co-authored-by: Tong He <68936428+unnecessary-username@users.noreply.github.com>
2021-08-10 15:38:37 +02:00
Andrew Klychkov
b3a83aa0a3
Release 1.4.1 commit (#159) 2021-04-23 15:59:12 +02:00
Andrew Klychkov
fe8f3662eb
mysql: revert changes made in PR 116 (#153) (#156)
* mysql: revert changes made in PR 116

* Add changelog fragment

* Fix CI

* Fix CI

* Fix CI

* Update CI

* Fix CI

(cherry picked from commit 738343d64c)
2021-04-23 14:08:49 +02:00
Andrew Klychkov
59cbe5ffe3 Release 1.4.0 2021-04-16 08:53:51 +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
Jorge Rodriguez (A.K.A. Tiriel)
11958ec46a
Handle divergences between MySQL and MariaDB (#103)
* Initial attempt

* First functional approach

* Remove unused imports

* Add dychotomy handling for mysql_replication

* Fix cursor lookup

* Fix sanity tests

* Cleanup implementation conditional import

* Fix unit tests

* Fix conditional import to satisfy both sanity and integration tests

* Add changelog fragment
2021-03-16 09:15:19 +01: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
Daniel Ziegenberg
2254b29178
change deprecated parameter pw and db (#116)
* change deprecated parameter pw to password

* change deprecated parameter db to database

* add changelog fragment
2021-03-16 07:15:12 +02:00
Andrew Klychkov
baea97d24c
mysql_user: Add REPLICA MONITOR privilege to supported (#108)
* mysql_user: Add REPLICA MONITOR privilege to supported

* Add changelog fragment
2021-03-11 16:17:49 +01:00
Andrew Klychkov
fc2dd0079f
Add .keep file to changelog/fragments to make it always present (#113) 2021-03-10 18:16:18 +01:00
Andrew Klychkov
e8cb81b30e Release 1.3.0 commit 2021-03-08 17:22:17 +01: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
Andrew Klychkov
31bd2b567f Release 1.2.0: add changelog 2021-01-18 09:27:46 +03:00
Steve Teahan
b25fb5974d
mysql_user: refactor to reduce execute() calls (#76)
This module does not currently log the SQL statements that it executes.
A change was proposed to add this functionality, but it would require
modifications in many sections of the code due to how many cursor.execute()
statements there currently are. This change simply consolidates the
number of execute() calls where it is trivial to do so.
2021-01-15 13:44:03 +03: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
2de3a57021
mysql_user: Add SHOW_ROUTINE privilege support (#87)
* mysql_user: Add SHOW_ROUTINE privilege support

* add changelog fragment

Co-authored-by: Andrew Klychkov <andrew.klychkov@gmail.com>
2021-01-13 09:36:23 +03:00
Andrew Klychkov
9eb007969c Generating changelog for release 1.1.2, remove fragments 2020-12-18 11:29:36 +03:00
Andrew Klychkov
2cf7d60976 Add release 1.1.2 changelog fragment 2020-12-18 11:26:24 +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
Andrew Klychkov
b7e828a092
mysql_db: fix false warning related to unsafe_login_password (#74) 2020-12-18 10:56:49 +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
c3dd146220 Generate changelog for release 1.1.1, remove fragments 2020-11-03 21:46:32 +03:00