Commit graph

346 commits

Author SHA1 Message Date
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
Morgan Haskel
6151590caf Change the package name in the manifest, too! 2014-05-09 16:46:03 -04:00
Morgan Haskel
dec2af67b8 MariaDB still uses my.cnf as the main config file. 2014-05-09 15:10:27 -04:00
nerdlich
b40865d740 Backup user needs PROCESS privilege when doing file-per-database backups
The following error occured:
mysqldump: Couldn't execute 'SELECT /*!40001 SQL_NO_CACHE */ * FROM `INNODB_BUFFER_PAGE`': Access denied; you need (at least one of) the PROCESS privilege(s) for this operation (1227)
2014-04-22 13:08:58 +02:00
Ashley Penney
71d1f24bd9 Merge pull request #457 from igalic/independent-backup
mysqlbackup.sh should be able to find mysql
2014-04-10 13:46:19 -04:00
Martin Magr
c47d1fb586 Modified params.pp to work on latest Red Hat releases
On Fedora-20+ and RHEL-7+ mysqld service does not work any more
and has been replaced by mariadb service. This patch changes all
parameters accordingly.
2014-03-18 17:34:54 +01:00
Pan
df706eec5e Use ensure_resource for mysql_databasein mysql::db
This will allow exported resource mysql::db to define same database but different
hostname and enables the cluster web nodes to declear the mysql::db and
to be collected on db node.
2014-03-15 13:38:17 -07:00
Pan
2834498e4d Allow use different name for db resource other than db name
When defining the mysql::db as exported resources, there are chances that the
same resource names are defined across the site, which will cause puppet agent
fail. By adding an optional dbname parameter, default to the $name, it allows the
resouce name to be defined differently, e.g. ${dbname}_${domain}.
Also updated test and docs for dbname parameter and add acceptance test for
dbname parameter feature
2014-03-15 13:38:13 -07:00
Robin Gloster
47521aea8e add message to warn if disabling ssl 2014-03-04 14:58:17 +01:00
Robin Gloster
abcea00dcb handle mysql compiled without ssl
mysql doesn't allow ssl=true/false in my.cnf if it hasn't been compiled
with ssl, therefor add a new parameter ssl-disable which makes sure the
template doesn't write anything with ssl to the config.
2014-02-28 21:42:41 +01:00
Ashley Penney
2d1a9f981a This fixes:
* Bindings on SLES
* Makes sure we don't kill the service while testing conf file locations.
2014-02-26 14:54:54 +00:00
Igor Galić
d2b24e40d3 mysqlbackup.sh should be able to find mysql
anywhere. This should enable use to use mysql::server::backup
idependantly, even if mysql is preinstalled, and preinstalled in non
standard locations
2014-02-20 17:17:41 +01:00
Igor Galić
63e0da0b71 option to specify a script that runs after backups
This script could be used to sync backups to a central server, or just
to create a file to let external scripts know that backups are
(sucessfully) done and can be picked up.

The postscript option (defaults to false) and can be either a string or
an array of strings. These strings will be directly put into the
mysqlbackup.sh and as such can either be shell commands, or externally
managed files.
2014-02-06 16:44:07 +01:00
John Bond
10f346eaca Add logic to ignore mysql.events 2014-01-30 12:31:21 +01:00
Jim Radford
dabb29dd6e Actually use upstart on Ubuntu by fixing misspelled variable name 2014-01-23 13:01:08 -08:00
Ashley Penney
edfaeccfa8 Merge pull request #394 from danielfoglio/master
changed log_error to log-error and pid_file to pid-file to match the mys...
2013-12-19 16:39:56 -08:00
Igor Galić
d5fd46de59 Merge pull request #400 from duritong/fix_backupuser_dependency
Fix backupuser dependency
2013-12-18 22:13:27 -08:00
Ashley Penney
c32ae645e0 Apparently we were restarting no matter what the parameter said,
awkward.
2013-12-18 15:12:04 -05:00
Ashley Penney
5bba2e04b3 Add a comment to make this clearer. 2013-12-18 14:13:00 -05:00
Ashley Penney
b7dcdd1714 Add $restart support.
Previously this parameter did nothing, lets make it actually work.
2013-12-18 13:59:56 -05:00
mh
765afe4f61 Fix #321 - root_user should be setup before configuring backup user
Otherwise puppet might try to setup the backup user even before
the service is running and will fail.
2013-12-18 13:35:20 +01:00
Foglio, Daniel
3d98b1de0d changed log_error to log-error and pid_file to pid-file to match the mysqld service script 2013-12-17 17:39:04 -05:00
Guillaume Virlet
3da12ac622 migrate key_buffer (deprecated) to key_buffer_size in config_file 2013-12-14 23:15:13 +01:00
Guillaume Virlet
9460db2ec1 fix typo on bind-address in config_file 2013-12-14 23:14:01 +01:00