Commit graph

306 commits

Author SHA1 Message Date
Jon Topper
ec5450ec75 Use facts for mysqld version discovery
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.
2016-06-15 10:43:50 +02:00
Bryan Jen
e2fad83c1c Skips mysqlbackup.sh tests on MySQL 5.7+ 2016-05-26 11:18:27 -07:00
Bryan Jen
1e8a537468 (maint) Switches nanliu-staging dependency to puppet-staging 2016-05-25 08:27:46 -07:00
Frank van Boven
b8d301527e (MODULES-2111) Add the system database to user related tables.
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.
2016-05-02 14:52:44 +02:00
David Schmitt
04fb127bec Update to newest modulesync_configs [9ca280f] 2016-04-18 20:15:09 +01:00
David Schmitt
9aadcebb1b (maint) Add missing nanliu/staging module
The module is not really used, but its absence creates nasty warning
messages.
2016-04-05 14:52:29 +01:00
Hunter Haugen
f4fe313e65 Remove mysql_table_exists() function
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.
2016-03-28 10:48:58 -07:00
Hunter Haugen
d8206aa4ec Allow mysql::backup::mysqldump to access root_group in tests 2016-03-25 15:31:15 -07:00
Jakub Husak
1a67c3868b Loosen MariaDB recognition to fix it on Debian 8 2016-03-18 16:26:48 +01:00
David Schmitt
f99a3fa78e (FM-4046) Update to current msync configs [006831f]
This moves all copyright statements to the NOTICE file in accordance with the ASFs guidelines on applying the Apache-2.0 license.
2016-02-16 16:33:44 +00:00
David Schmitt
7889a85d37 (FM-4049) Update to current msync configs [2c99161] 2016-01-27 14:44:53 +00:00
David Schmitt
95841d3a8c (FM-4563) fix tmpdir to be shared across examples 2016-01-19 10:45:25 +00:00
David Schmitt
d89062faff (FM-4563) skip idempotency tests on test cells that do have PUP-5016 unfixed
Arguably this decision should be extracted to a more central place,
like puppetlabs_spec_helper or the CI config.
2016-01-18 15:15:52 +00:00
David Schmitt
2de4597ecd (maint) refactor main acceptance suite
This reduces duplication of testing code and makes the intent of the tests
clearer.
2016-01-18 15:15:32 +00:00
Julien Pivotto
e30e0bc958 Re-Add the ability to set a empty string as option parameter
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.
2016-01-08 14:00:31 +01:00
Robert Heinzmann
7efc93c3c5 Fixed new mysql_datadir provider on CentOS for MySQl 5.7.6 compatibility 2015-12-17 18:31:17 +01:00
Robert Heinzmann
bdf4d0f52d Fixed MySQL 5.7.6++ compatibility
- 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>
2015-12-10 18:39:40 +00:00
Martin Hagstrom
61058b7610 Don't hash passwords that are already hashed 2015-11-19 07:54:10 +01:00
Artur Gadelshin
27323f74e6 (MODULES-2767) fix mysql_table_exists: add check for args.size, fix rspec test 2015-11-09 16:04:38 +03:00
Artur Gadelshin
e518abd97e (MODULES-2767) allow to check if table exists before grant 2015-11-07 19:23:20 +03:00
JT (Jonny)
b91630d7a3 Merge pull request #767 from jmk61/MODULES-2675
Fixes unique server_id within my.cnf Ticket/MODULES-2675
2015-10-27 14:52:34 +00:00
David Schmitt
5f49c45b2e (MODULES-2683) fix version compare to properly suppress show_diff for root password 2015-10-13 11:29:53 +01:00
David Schmitt
6527a3aa22 (MAINT) switch to rspec-puppet-facts
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.
2015-10-13 11:29:42 +01:00
Joseph Karns
96c9d6d9a7 Fixes unique server_id within my.cnf, The issue was that the entire mac address was not being read in to generate the id. 2015-10-12 12:36:39 -04:00
Roman Mueller
afddc3ff7b Fix fetching the mysql_user password for MySQL >=5.7.6
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.
2015-09-30 18:55:26 +02:00
Morgan Haskel
97b8200a5f Improved user validation and munging
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.
2015-09-24 11:35:14 -07:00
Mickaël Canévet
6228846ae0 Fix when not managing config file
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`
2015-09-22 14:28:15 +02:00
JT (Jonny)
ced1a08c34 Merge pull request #682 from eems-leo/process-secret-file
Remove default install root password if set
2015-08-06 15:14:19 +01:00
Johnson Earls
6924dea7bd #2030 Only establish dependency between service and package if package is managed. 2015-08-06 14:23:47 +01:00
JT (Jonny)
2c8a822f25 Merge pull request #744 from danzilio/xtrabackup_enhancements
(MODULES-2340) Implement script functionality for xtrabackup provider
2015-08-06 13:57:02 +01:00
David Danzilio
a7a5c66bc4 Add support for postscript for xtrabackup provider
This commit implements the 'postscript' functionality for the xtrabackup
provider. It also adds a 'prescript' option to be executed before a
backup.
2015-08-05 16:15:25 -04:00
Hunter Haugen
c7de52013b Merge pull request #742 from redhat-cip/idempotent-config
Ensure idempotency between Puppet runs
2015-08-04 11:05:46 -07:00
Emilien Macchi
ba52d1d6e9 Ensure idempotency between Puppet runs
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.
2015-08-04 13:38:03 -04:00
David Schmitt
502bdc9360 (maint) workaround PUP-3450 on Solaris 11 2015-07-27 14:27:23 +01:00
David Schmitt
253f74925e (maint) fix spec formatting
this configuration caused rspec to output messages twice on travis
2015-07-24 15:14:37 +01:00
Morgan Haskel
c6afa1181a Merge pull request #722 from igalic/lenght_check
length check for usernames should take mysql version into consideration
2015-06-25 11:18:24 -07:00
David Schmitt
097efe2d41 spec_helper_acceptance: Remove conflicting yum install
puppetlabs-release is not required anymore. run_puppet_install_helper
takes care of all that.
2015-06-18 12:13:55 +01:00
Hunter Haugen
53257df16f Add helper to install puppet/pe/puppet-agent 2015-06-11 16:14:06 -07:00
Justin Stoller
5185d3d360 (maint) allow setting PUPPET_VERSION in acceptance 2015-06-08 22:22:26 -07:00
Igor Galić
837c21b963 length check for usernames should take mysql version into consideration
Starting MariaDB 10.0.0, usernames are now 80 long.
Our mysql_user and mysql_grant types now take that into consideration.

This check is *opportunistic*. It will only take place if the
mysql_version fact is available. If that is not the case, it will be
skipped, leaving the database itself to deal with it, and returning its
error verbatim to our users, if it does fail.

Our fixed and extended tests assume this isn't the first run, and the
fact is already in place.
2015-05-29 14:13:39 +02:00
Travis Fields
d3901f205a (fix) - Change default for mysql::server::backup to ignore_triggers => false
- Update spec acceptance test to check for which version is currently installed prior to testing
2015-05-12 09:45:10 -07:00
Travis Fields
9dad94a8c6 (fix) - Fix issue where fact is unknown at start
- Resolve issue where if known and failed versioncmp would result in idempotency issue on second run
2015-05-11 09:36:35 -07:00
Travis Fields
8b1fa24479 (fix) - Fix an issue were we assume triggers work
- There are older versions of mysql that do not support the privilege TRIGGER and need to change default to not include
  http://dev.mysql.com/doc/refman/5.0/en/grant.html
  'MySQL does not support the standard SQL UNDER privilege, and does not support the TRIGGER privilege until MySQL 5.1.6'

- Updated tests to have both 5.1.6 and 5.0.11 tests for mysql_version fact
2015-05-08 08:51:38 -07:00
Travis Fields
3ce8ad3799 (maint) - Add a fact for capturing the mysql version installed
- Add spec test for mysql_version fact
- Add `mysql_version` fact to README
2015-05-08 08:51:38 -07:00
Steven C. Saliman
49f273a42c Made the 'TRIGGER'privilege of mysqldump backups depend on whether or not we are actually backing up triggers 2015-04-30 12:37:38 -06:00
Steven C. Saliman
ec14b87a81 Added options for including/excluding triggers and routines, and fixed a permission problem that was preventing triggers from being backed up 2015-04-30 08:01:06 -06:00
Morgan Haskel
298242e043 MODULES-1928 - allow log-error to be undef
Wrap the file resource so that this doesn't explode if log-error is
undef. This is required for syslogging.
2015-04-13 17:05:22 -07:00
Colleen Murphy
a59c68b165 Update tests for rspec-puppet 2 and future parser
This patch changes the raise_error matchers to use `catalogue` instead
of `subject` since `subject` is not evaluated the way it used to be;
changes a parameter value from empty string to nil to be compatible
with the future parser, and unpins rspec-puppet.
2015-03-23 22:09:15 -07:00
Jesse Cotton
a26b80d750 Remove default install root password if set 2015-03-17 15:21:07 +00:00
tphoney
78a787107f minor typos fixed 2015-03-04 10:56:32 +00:00