Commit graph

369 commits

Author SHA1 Message Date
Lars Kellogg-Stedman
23a4a362a0 [#puppethack] use of mysql::db without mysql::server
This removes the hard dependencies on mysql::server from
manifests/db.pp. This permits one to use this module to manage databases
in an existing server, possibly located on a remote host (with a
properly configured /root/.my.cnf).
2015-07-30 15:53:24 +02:00
TP Honey
f9359624f0 Merge pull request #732 from DavidS/dont_print_root
(maint) don't print diff root password in diff
2015-07-14 12:16:00 +01:00
tphoney
8f628b8d73 (maint) don't print diff root password in diff
For puppet versions that support it, suppress diffing root's password.
2015-07-14 11:52:34 +01:00
tphoney
d2b33b5af2 dont print diff root password in diff
puppet 2.7 doesnt support show_diff

hash alignment
2015-06-29 16:43:35 +01:00
Drew Fisher
aba6280a49 Add Solaris support to MySQL module 2015-06-25 09:33:56 -06:00
Timo Goebel
7ea4a748c2 fix Evaluation Error with future parser 2015-06-23 19:04:39 +02:00
Travis Fields
ac6ae7140e (maint) Package was renamed in server::install
- As a result of rename several underlying dependencies broke
  this is to update the require dependencies
2015-06-18 13:55:22 -07:00
Yanis Guenane
29788fb4c4 (MODULES-2077) Fixes wrong dependency variable
Currently the package dependency relies on the service name when it
should be relying on the package name.
2015-05-27 17:05:38 +02:00
Zachary Dovel
4bab65edcb Fixed server package name so it isn't hardcoded to mysql 2015-05-27 13:27:17 +02:00
Seth Lyons
dc9dcee4fe update to proper defaults for freebsd 2015-05-12 15:26:50 -04: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
Morgan Haskel
e4b4afd000 Merge pull request #683 from eems-leo/remove-old-root-pass
Remove references to old_root_password (cleanup)
2015-05-05 12:10:56 -07:00
Steven C. Saliman
1018a0370a Cleaned up the privilege assignment in the mysqldump backup script 2015-04-30 14:21:08 -06: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
Julien Pivotto
c2b0b4cb2c Split package installation and database install
The current install pattern used by this module is the following:
1. Install package
2. Install the DB
3. Make the config files

In some cases this prevents MySQL to start, because some variables in
the config file have an impact on the DB installation.

Example with a custom innodb_data_file_path:
[ERROR] InnoDB: space header page consists of zero bytes in data file
/var/lib/mysql/ibdata

This commit changes the order to do:
1. Install package
2. Make the config files
3. Install the DB
2015-04-23 13:17:08 +02:00
Maxime VISONNEAU
2b9e777637 Bugfix on Xtrabackup crons 2015-04-21 14:25:11 +02:00
Dmitry Melanchenko
6a79d26838 references to README.md and default values were added to workaround warnings from puppet-lint 2015-04-15 21:25:37 +00: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
Igor Galić
eb3fa4e9f5 Merge pull request #697 from fraenki/freebsd_support
fix FreeBSD support for backups
2015-04-13 15:39:15 +02:00
Morgan Haskel
c2ec74b1b5 Merge pull request #687 from igalic/provider-regr
mysql backup: fix regression in mysql_user call
2015-04-08 15:35:25 -07:00
Frank Wall
a2faed23ac fix FreeBSD support for backups 2015-03-31 12:58:49 +02:00
Sebastian Reitenbach
5116883111 Fix regression introduced by adding OpenBSD support.
Add a $mysql_group parameter, and use that instead of the $root_group
parameter to define the group membership of the mysql error log file.
2015-03-18 08:47:25 +01:00
Jesse Cotton
a26b80d750 Remove default install root password if set 2015-03-17 15:21:07 +00:00
Marc Remy
04b806044a Manage service only if managed
In the case of an unmanaged mysql service, defined with:
class {'::mysql::server':
[...]
  service_manage => false,
[...]
}

We have the following error:
Undefined variable "service_ensure"

In this case, we don't want to have it "started" or "stopped", as it is
managed by another application (in our case by pacemaker).

This patch resolve this issue, by setting service_ensure to undef, in the
case of an unmanaged service.
2015-03-16 12:58:54 +01:00
Jesse Cotton
5b692a8f62 Deprecate mysql::server::old_root_password 2015-03-13 13:58:04 +00:00
Igor Galić
facb57a108 Merge pull request #567 from buzzdeee/master
Add OpenBSD support.
2015-03-12 10:55:17 +01:00
Igor Galić
32329b77b7 Merge pull request #672 from timmooney/master
Only set up ordering between the config file and the service if we're managing the config file.
2015-03-11 14:50:30 +01:00
Sebastian Reitenbach
db72fe8d86 Add OpenBSD support, only for OpenBSD -current, since
the recent switch to mariadb.
2015-03-11 14:46:29 +01:00
Igor Galić
1c3bf95e21 mysql backup: fix regression in mysql_user call
due to a mishappen rebase, in #649, we introduced a regression fixed
which was fixed in #655.

how come our tests don't catch this?
2015-03-05 14:33:44 +01:00
Morgan Haskel
7ee3b8b708 Whitespace fix 2015-03-02 11:27:56 -08:00
Morgan Haskel
7a3fe1ca00 Merge pull request #617 from juniorsysadmin/package-manage-parameter
(MODULES-1143) Add package_manage parameters
2015-02-27 12:06:25 -08:00
Hunter Haugen
ce43899af3 (MODULES-1804) Allow override of log-error
The mysqld log-error setting may be passed by override_options, but
server/service.pp was not using the overridden value. This fixes that.
2015-02-27 09:54:00 -08:00
Morgan Haskel
c1191f1230 PR 654 was incorrectly using stdlib dirname
puppetlabs-mysql has a dependency on stdlib 3.2.0, which does not
include the dirname function.
2015-02-24 11:08:29 -08:00
Igor Galić
e323f69c04 Merge pull request #654 from NoodlesNZ/logbindir
Check for full path for log-bin to stop puppet from managing directory “."
2015-02-24 08:49:11 +01:00
Travis Fields
51d66a53ab Fix lint issues due to merging of PR #649 2015-02-19 10:55:24 -08:00
Igor Galić
cb142f414d Merge pull request #649 from dveeden/newbackupprovider
Use backup providers
2015-02-19 16:06:42 +01:00
David Gurtner
b3c33f0a13 fix bug in GH-578
the recently added feature to support galera by allowing independent
creation of the root@localhost user in the DB and the /root/.my.cnf
file contains a bug.

specifically the .my.cnf file resource still requires the root@localhost
resource, even when it is not available.

this fixes the issue by making the dependency conditional.
2015-02-16 17:01:18 +01:00
Tim Mooney
24eca014b8 Only set up ordering between the config file and the service if we're
managing the config file.
2015-02-12 12:37:37 -06:00
juniorsysadmin
f5a693b826 (MODULES-1143) Add package_manage parameter
This patch adds a package_manage parameter for both mysql::server and
mysql::client
2015-02-12 13:33:36 +11:00
Daniël van Eeden
58508b772a Use backup providers
Add MySQL Enterprise Backup and Percona XtraBackup
2015-02-11 22:27:35 +01:00
Nick Le Mouton
dc711561d7 Check for full path for log-bin to stop puppet from managing directory “.” 2015-02-12 08:19:54 +11:00
Morgan Haskel
2635469f0b lint cleanup 2015-02-09 15:30:55 -08:00
Morgan Haskel
b9fbba3b0d Merge pull request #578 from franzs/new_root_options
Add new parameters create_root_user and create_root_my_cnf.
2015-02-09 14:13:07 -08:00
Morgan Haskel
96f4d164a4 MODULES-1759: Remove dependency on stdlib >=4.1.0
Backported dirname => mysql_dirname since updating dependency to stdlib
4.1.0 is backwards incompatible with some versions of PE.
2015-02-09 12:34:44 -08:00
Rob Nelson
e08aa011f1 (MODULES-1731) Invalid parameter 'provider' removed from mysql_user instance. 2015-01-30 12:49:20 +00:00
TP Honey
1a87bae020 Merge pull request #637 from dveeden/account_localhost
Do the right thing when fqdn==localhost
2015-01-22 10:36:01 -08:00
Daniël van Eeden
c04fed1066 When fqdn==localhost account security breaks
This is because the root@localhost account is already
defined.

Remove localdomain accounts if fqdn is localhost
2015-01-18 15:02:17 +01:00
juniorsysadmin
2088fb8b36 Fix lint warning in server/service.pp 2015-01-11 15:35:10 +11:00
Morgan Haskel
b20f04330c Future parser fix in params.pp 2014-12-30 09:45:54 -08:00
Igor Galić
d3f7254ecc Merge pull request #616 from takumin/install_db_with_freebsd
mysql_install_db freebsd support
2014-12-23 18:03:25 +01:00
Igor Galić
5f62e6d455 Merge pull request #615 from KlavsKlavsen/master
ensure mysql-config-file and server package is in place before trying to...
2014-12-22 10:32:35 +01:00
Armin ranjbar
263a9fa210 useless whitespace removed 2014-12-19 18:54:51 +03:30
Armin ranjbar
9f9061ea8f under Debian 8 package name for ruby mysql biding is called ruby-mysql, just like trusty. 2014-12-19 17:03:46 +03:30
Morgan Haskel
a367b3e1e4 Clean up lint warnings 2014-12-16 11:19:04 -08:00
Morgan Haskel
3c872abcd2 Remove mysqltuner, fetch with staging instead
mysqltuner is licensed under GPL so we don't want to package it with the
module.
2014-12-16 10:52:39 -08:00
takumi
7d3962fc28 mysql_install_db freebsd support 2014-12-05 18:45:38 +09:00
Klavs Klavsen
a8fd4d375b ensure mysql-config-file and server package is in place before trying to start service - to ensure it gets started with correct settings and does not try to enable service before it actually exists :) 2014-12-04 16:14:09 +01:00
Colleen Murphy
e23da83230 Fix operating system release fact for SLES
PE on SLES 11 does not support the operatingsystemmajrelease fact.
2014-11-26 15:25:37 -08:00
Colleen Murphy
25b65342b3 Add support for SLES 12
SLES 12 has different package names for the server and client. It also
doesn't seem to want to start if basedir is defined.
2014-11-26 12:57:44 -08:00
Colleen Murphy
e0e797e480 Revert "Default to MariaDB for SLES 12"
SLES belongs in the Suse family, not the RedHat family.

This reverts commit 8cc0083d6e.
2014-11-26 12:11:46 -08:00
Travis Fields
8cc0083d6e Default to MariaDB for SLES 12 2014-11-21 15:07:50 -05:00
Colleen Murphy
31191b64b7 Merge pull request #604 from mhaskel/rebase_581
Fixed test classes
2014-11-19 10:24:25 -08:00
Sylvain Lamontagne
3b5d5af855 Proper containment for mysql::client in mysql::db 2014-11-18 17:33:18 -05:00
Andrea Biancini
473a3c3307 Fixed test classes
Oracle 7 uses mariadb

Update PE and OS compatibility info in metadata

Now compatible with PE 3.4 and SLES 10.

Clean up metadata for new SLES support

Add timeout parameter to increase for long time running sql imports

Signed-off-by: refnode <refnode@gmail.com>

Add documentation for new mysql::db "import_timeout" parameter

Signed-off-by: refnode <refnode@gmail.com>

Add support for Gentoo

The old regex requires something after the 'host' part. Fix this.

Old regex is : /^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/ . The
last part (\s.*)$ means "a space followed by anything". The issue is
that when user has no GRANT privileges, the "SHOW GRANTS FOR #{user_string}" returns
"GRANT SELECT ON `database`.* TO 'user'@'%'" which does not match (\s.*)$ .
This small patch fixes this making last bloc optional (thanks to '?').

Add explicit dependencies for types

mysql_grant has an autorequire()'d dependency on the .my.cnf file used
by the provider to talk to the database.

I've added this to mysql_database and mysql_user too since logically
these also need the file to be in place.

I've hit this bug because of a slightly unusual edge case in our own
manifests, but I think this fix belongs upstream regardless.

(maint) add statement "MANAGED BY PUPPET" to my.cnf config file template and remove unused my.conf.cnf.erb template

Improve checks for MySQL user's name.

As per http://dev.mysql.com/doc/refman/5.5/en/identifiers.html , MySQL
allows for more than '\w-'. This commit improves the check to ensure
that:
 - if username only contains [0-9a-zA-Z$_], it might be quoted. It is
   not a requirement though
 - if username contains anything else, it MUST be quoted

I kept 2 checks, but the 2nd one can probably be removed (I can't find a
username which match the 2nd one but not the first.)

Fix escaped backslashes in grants

* Mysql uses the underscore character to represent a single character
  wildcard.
* A grant on table `the_database`.* would match `theAdatabase`.*, so
  underscores must be escaped to avoid this match.
* The output from mysql escapes special characters (\n, \t, \0, and \\),
  but the input does not need to be escaped.
* In order for the provider to compare the tables, the output of
  mysql -NBe <query> must have \\ substituted with \.

Fixed backup test

Oracle 7 uses mariadb

Update PE and OS compatibility info in metadata

Now compatible with PE 3.4 and SLES 10.

Add timeout parameter to increase for long time running sql imports

Signed-off-by: refnode <refnode@gmail.com>

Add documentation for new mysql::db "import_timeout" parameter

Signed-off-by: refnode <refnode@gmail.com>

Add support for Gentoo

The old regex requires something after the 'host' part. Fix this.

Old regex is : /^GRANT\s(.+)\sON\s(.+)\sTO\s(.*)@(.*?)(\s.*)$/ . The
last part (\s.*)$ means "a space followed by anything". The issue is
that when user has no GRANT privileges, the "SHOW GRANTS FOR #{user_string}" returns
"GRANT SELECT ON `database`.* TO 'user'@'%'" which does not match (\s.*)$ .
This small patch fixes this making last bloc optional (thanks to '?').

Add explicit dependencies for types

mysql_grant has an autorequire()'d dependency on the .my.cnf file used
by the provider to talk to the database.

I've added this to mysql_database and mysql_user too since logically
these also need the file to be in place.

I've hit this bug because of a slightly unusual edge case in our own
manifests, but I think this fix belongs upstream regardless.

(maint) add statement "MANAGED BY PUPPET" to my.cnf config file template and remove unused my.conf.cnf.erb template

Improve checks for MySQL user's name.

As per http://dev.mysql.com/doc/refman/5.5/en/identifiers.html , MySQL
allows for more than '\w-'. This commit improves the check to ensure
that:
 - if username only contains [0-9a-zA-Z$_], it might be quoted. It is
   not a requirement though
 - if username contains anything else, it MUST be quoted

I kept 2 checks, but the 2nd one can probably be removed (I can't find a
username which match the 2nd one but not the first.)

Fix escaped backslashes in grants

* Mysql uses the underscore character to represent a single character
  wildcard.
* A grant on table `the_database`.* would match `theAdatabase`.*, so
  underscores must be escaped to avoid this match.
* The output from mysql escapes special characters (\n, \t, \0, and \\),
  but the input does not need to be escaped.
* In order for the provider to compare the tables, the output of
  mysql -NBe <query> must have \\ substituted with \.
2014-11-18 16:27:57 -05:00
Morgan Haskel
11fb01c736 Fix test issues
Remove the dependency on stdlib 4.x puppetlabs/puppetlabs-mysql#574
introduced, add some input validation, and improve test checks.
2014-11-14 13:16:01 -08:00
Yanis Guenane
5e6a1c418a (MODULES-1338) Allow mysql::db to import several files
A user might need to import several files on database creation.
Currently the module only allows the import of a single file.
This commit allows one to, from now on, import severals.

Before :

  mysql::db { 'test' :
    sql => '/tmp/my_import1.sql',
  }

Now :

  mysql::db { 'test' :
    sql => [
      '/tmp/my_import1.sql',
      '/tmp/my_import2.sql',
    ]
  }
2014-11-13 14:17:50 -05:00
Igor Galić
56e52fc3fa Merge pull request #596 from NoodlesNZ/logbindir
Create log-bin directory if it doesn't exist
2014-11-12 15:39:02 +01:00
Nick Le Mouton
08a66b7bb9 Added log-bin dir creatation 2014-11-12 06:50:14 +13:00
Damon Conway
7de2316e15 [MODULES-1484] Add support for install_options for all package resources.
Add install_options parameter to mysql::bindings, mysql::client, and
mysql::server. The default is undef.
2014-11-08 00:30:00 -06:00
Pascal Jufer
2a91e524bd Add support for Gentoo 2014-10-22 15:12:18 +02:00
Igor Galić
39aa5f511a Merge pull request #576 from igalic/timeout
Timeout
2014-10-19 19:17:52 +02:00
Colleen Murphy
d2d40a8dc8 Oracle 7 uses mariadb 2014-10-10 13:23:48 -07:00
Colleen Murphy
ec6b97ea5d Ensure error log is present before trying to manage ownership
If mysql generates an error log in between puppet runs, the log's
ownership and group might not match the ownership and group set by the
file resource. This means sequential puppet runs will appear not to be
idempotent. This patch makes sure the file is there from the start so
that it doesn't have to change its ownership later.
2014-10-07 14:28:00 -07:00
Franz Schwartau
02564bfe08 Add new parameters create_root_user and create_root_my_cnf.
This allows the galera module and others to write ${::root_home}/.my.cnf
independently from create the mysql user. This is useful for cluster
setups where you want to create ${::root_home}/.my.cnf on every node
but create the user only once.
2014-10-06 10:53:30 +02:00
Colleen Murphy
bf2c8d4bc0 Change sql param to default to undef instead of empty string
The future parser treats the empty string '' as a truthy value. This
means that mysql::db will always try to include the db import exec in
the catalog. With the empty string as the $sql value, the command
attempts to import '' into a database, which fails. This patch changes
the default $sql value to undef so that the exec won't be included if
there is no sql to import.
2014-10-03 11:56:18 -07:00
refnode
4e1bb8f1ce Add timeout parameter to increase for long time running sql imports
Signed-off-by: refnode <refnode@gmail.com>
2014-09-29 17:42:30 +02:00
Tim McLaughlin
54540324ea Using mariadb in OpenSuSE >= 13.1. 2014-09-17 13:33:40 -07:00
Martin Magr
293d35db4d Fixes manage_service feature
Module lacks of disabling service managing (ensure=>undef).
This patch is fixing this issue.
2014-08-21 17:44:27 +02:00
Ashley Penney
bb205ad2f0 Remove all the deprecated code. 2014-08-08 14:13:22 -04:00
Ashley Penney
cf2ffc6821 Handle graceful failure on RHEL4 and improve the messaging. 2014-08-08 11:55:31 -04:00
Hunter Haugen
1812fbca25 Rewrite some of the unit tests to work on more platforms.
This commit introduces puppet_facts, a gem that allows easier testing
against PE platforms.  We're using this gem to automatically parse the
metadata.json and test against appropriate versions of PE on platforms
we support.

We start by only running against centos-6-x86_64 and ubuntu 14.04 on a
regular basis but this is implemented as an ENV so it can be overwritten
by CI systems to test against all PE platforms.
2014-08-07 16:27:17 -04:00
Ashley Penney
bbc7f2b33e Merge pull request #517 from edvinasme/archlinux_support
Add Archlinux support
2014-07-24 13:22:07 -04:00
I'm on Vacation until 18th of July
70cafdc283 Merge pull request #509 from xbezdick/master
Parametrize !includedir
2014-07-23 12:38:18 +02:00
I'm on Vacation until 18th of July
46643523ce Merge pull request #539 from stevesaliman/master
Grants for the backupuser should be conditional
2014-07-23 12:35:50 +02:00
Igor Galić
ea0b1fe442 Make sure we actually notify the service.
fix for the fix in c2d02ff721
thanks to @edestecd
2014-07-23 12:03:00 +02:00
Gael Chamoulaud
7b3cdd234a Adds Support for CentOS and Scientific Linux 7
CentOS Project has adopted a new rule for versioning numbers. The major number
matches the RHEL major number, but the minor number is generated from the
release date. For example, CentOS 7.0.1406.

Uses $::operatingsystemmajrelease instead of $::operatingsystemrelease for
avoiding issue like "Comparison of String with 7 failed" for CentOS 7.

Signed-off-by: Gael Chamoulaud <gchamoul@redhat.com>
2014-07-21 20:13:26 +02:00
Steve Saliman
30249552d4 Changed the backup user grant in backup.pp to use the ensure variable instead of always assuming 'present' 2014-07-11 11:25:10 -06:00
Edvinas Klovas
0f0d2e6815 Add Archlinux support
This commit adds Arch Linux support. Everything besides bindings for JAVA and
Ruby has been tested as properly working. JAVA and Ruby bindings cannot be
managed by puppet as official packages are not in official repositories but in
AUR instead. PHP bindings are installed by default with mysql/mariadb package so
there is no need to specify/install separate patches. To reflect this,
bindings.pp has been altered to throw a warning if user wants to install
PHP binding. It throws an error is user tries to install JAVA or Ruby binding.

Signed-off-by: Edvinas Klovas <edvinas@pnd.io>
2014-07-10 21:55:44 +02:00
Hunter Haugen
52d44be30f Merge pull request #536 from apenney/mysql_install
Handle changing the datadir properly.
2014-07-08 14:55:11 -07:00
Ashley Penney
c2d02ff721 Make sure we notify the service. 2014-07-08 13:24:23 -04:00
Ashley Penney
5959715ff6 Rework the mysql initdb functionality.
This reworks a previously unmerged PR to clean up the code a little and
adds a test for it.
2014-07-08 12:53:20 -04:00
Reinhard Vicinus
6f5488827a run mysql_install_db if datadir is set annd mysql database is missing 2014-07-08 10:26:18 -04:00
Jaakko
16002dfe09 Fix acceptance test for mysql::bindings.
Fix acceptance test for bindings to use correct parameter names, when
instantiating mysql::bindings class. Fix client and server dev package names
for couple of distros.
2014-06-11 18:01:16 +02:00
Jaakko
96a64a9793 (MODULES-1096) Fix double quote / single quote issue in params.pp.
To follow style guide advice
(http://docs.puppetlabs.com/guides/style_guide.html#quoting) and make
puppet-lint happy, manifests should only use double quotes with strings that
contain variables.

This commit fixes the lone exception to this rule.
2014-06-06 11:48:56 +02:00
David Miller
18df1d08e5 fix param client_package_ensure 2014-06-04 10:45:46 -04:00
Lukas Bezdicka
26204437ef Prametrize !includedir
Hardcoded path provided by puppet is now replaced by providing only the final directory as on
most systems includedir is provided by package and it's matter of user to provide it if he
wants to override it. This also allows disabling including at all.
2014-06-04 14:07:49 +02:00
Aaron Hicks
b2090194f5 Install MySQL client and daemon dev libraries. 2014-05-19 09:41:25 +12:00