Per https://tickets.puppetlabs.com/browse/MODULES-3441, the mysql
module has behaviour which varies by server version. The version is
discovered by running mysqld -V. On hosts without a MySQL server
package install, this fails, which means that contrary to the README,
it's not actually possible to use this module to manage a remote db.
This PR moves the version string discovery into a new fact,
mysqld_version which is used by the provider. This makes it possible
to configure the db version with a custom fact when a remote db
(eg AWS RDS) is being managed.
Change the behaviour of applying user and grant related changes to use
the system database of MySQL.
This is a workaround to fix a bug in MySQL
(https://bugs.mysql.com/bug.php?id=65923) that causes users and grants
to be replicated, even if the "mysql" database should not be replicated.
This function is intended to check for the existence of a table before
declaring some resource, but this is neither portable (because functions
orun on the master, not the agent) nor one-run idempotent (because the
function would run before mysql is even installed, and would take two
runs to do anything).
The correct way of doing this would be to update the providers and
dependency ordering to handle the conditional states.
Luckily this was never released so it is backwards compatible.
Prior to 136b1aa646 it was possible to
have an empty string as value of a my.cnf parameter, resulting in a line
with just the parameter name.
That commit re-enable that behavior that was removed by accident.
- Added MySQL version and flavour detection support
- Added mysql_datadir provider/type (replaces Exec[mysql_install_db])
- Added version specific parameters my.cnf ([mysqld-5.X] sections)
- Version specific user mangement SQL (ALTER USER for 5.7.6++ ...)
Rebased-By: David Schmitt <david.schmitt@puppetlabs.com>
Switching out the puppet version, as puppet_facts does, does not work,
as this will confuse code that wants to use version-dependent features.
Instead this uses rspec-puppet-facts, which doesn't touch the puppet
version.
The password column has been renamed to authentication_string in MySQL >=5.7.6.
By using: SELECT /*!50706 AUTHENTICATION_STRING AS */ PASSWORD the query will
continue to work in older versions as well as newer ones.
We want to make sure we are validating the entire user parameter (and
validating it consistently between mysql_user and mysql_grant).
Additionally, for munging we do not want to do anything that could
truncate the username.
This code have been remove here 4bab65edcb (diff-0938042fe2382aeb10032aa7f8444995) but it is required otherwise we get an `Evaluation Error: Unknown variable: 'install_db_args'.` when using `manage_config_file = false`
Running RHEL 7.1, puppetlabs-mysql is not idempotent.
After a second run, puppet tries to change the SElinux context:
/File[mysql-config-file]/seltype: seltype changed 'etc_t' to
'mysqld_etc_t'
Since packaging already manages SElinux labels, we should not let
Puppet doing it (default behavior).
This patch aims to set selinux_ignore_defaults to True for the
mysql-config-file File resource.
Thanks to that patch, Puppet will be indempotent between all runs on
RHEL platforms.