Commit graph

319 commits

Author SHA1 Message Date
Marc Huffnagle
7ea41249e2 Fix raise_error deprecation warning 2013-10-31 12:42:42 -04:00
Ashley Penney
d271ab5f76 Fix an issue with lowercase privileges.
This fixes the case where a user passes in lowercase privileges and
we incorrectly assume this means a change and reapply them.
2013-10-28 12:44:48 -04:00
Ashley Penney
1dae474146 Add a moere complex test case for mysql_grant. 2013-10-10 15:07:47 -07:00
Ashley Penney
ce266fa893 Add in the @host users. 2013-10-08 10:18:14 -07:00
Ashley Penney
cc51d7ad7d Improve mysql_grant to work with IPv6.
This work attempts to improve the situation for matching IPv6
IP addresses, as the previous regex couldn't handle them properly.
2013-10-07 11:57:02 -07:00
Ashley Penney
5d17f10f93 Port of a6101dc (mysql::server::monitor fix) to 2.x. 2013-10-07 09:55:13 -04:00
Ashley Penney
1d59505425 Extend coverage to the contents of /etc/my.cnf. 2013-10-04 14:47:31 -04:00
Ashley Penney
4a48d639f2 Add testing for mysql::server::root_password. 2013-10-04 13:22:21 -04:00
Ashley Penney
f8af684fe0 Merge pull request #276 from apenney/mysql_grant_fixes
Improvements to mysql_grant.
2013-10-02 09:54:09 -07:00
Nate Riffe
602ec1354f Adjust the test to the new reality 2013-09-29 18:44:49 -05:00
Justin Burnham
1b4a486bf9 Fixes issue #274 by using recursive hash merge. 2013-09-25 10:38:08 -07:00
Ashley Penney
46fe1ea512 Remove mysql::globals.
This turned out to be a fairly bad idea.  It begun as a way to try
and mirror what happens in the postgresql module for consistency
but instead made things complex.

I've changed it to have the override_options in mysql::server which
leads much more naturally out of the design and shape of MySQL.
2013-09-24 18:04:29 -04:00
Ashley Penney
003d5b3c6a Improvements to mysql_grant.
Ensure that table and user are required properties, as well as remove
the optional table handling in the provider and enforce it.
2013-09-24 15:37:11 -04:00
Ashley Penney
ce893b5115 Fix spec tests on ruby 1.8. 2013-09-13 13:42:32 -04:00
Ashley Penney
803034e880 Rewrite spec tests to account for changes. 2013-09-13 13:14:48 -04:00
Ashley Penney
e3843ceb6f Refactor to use mysql::globals.
This initial round of work focuses on adding the concept of
mysql::globals to the module.  This is a shared place to provide all the
data the module needs, and then clients, servers, and providers can all
rely on this information to set things up.

This is being primarily used at first to allow a default_options hash
that contains all the previous parameters and takes a overrides_options
that allows you to then further customize any of the options in my.cnf.
2013-09-09 11:34:39 -04:00
Ashley Penney
2abccab4d9 Refactor and rename database_grant to mysql_grant.
This provider has undergone the largest set of changes and currently
just accepts a full SQL grant string as the name and then applies it,
making things easier for DBAs and removes the awkward attempts at
modelling grants into Puppet.
2013-09-03 17:24:21 -04:00
Ashley Penney
351c722fbd Add rspec-system test for mysql_user. 2013-08-28 18:11:21 -04:00
Ashley Penney
88eea1708e Add simplecov support in order to generate test coverage. 2013-08-28 18:11:21 -04:00
Ashley Penney
596d005a98 Rework tests for mysql_password to extend coverage. 2013-08-28 18:11:21 -04:00
Ashley Penney
369c83126b Use new provider names in manifests.
Modify manifests and tests to handle the renamed providers.
2013-08-28 18:11:21 -04:00
Ashley Penney
16770faa29 Rename and refactor database_user to mysql_user.
This work adds max_connections_per_hour, max_queries_per_hour, and
max_updates_per_hour support to the provider and extends self.instances to add
in the new parameters when checking existing users.  It also adds
self.prefetch in order to speed up Puppet runs.

Provider is also switched to using mk_resource_methods to generate
all the resource readers, and exists? and other methods now use the
property_hash where appropriate.

Tests rewritten to handle changes and extend code coverage.
2013-08-28 18:11:21 -04:00
Ashley Penney
7d4f9fc685 Rename and refactor database to mysql_database.
Add collate as a new managable parameter, and extend self.instances to
add in all parameters when checking existing databases.  It also adds
self.prefetch in order to speed up Puppet runs.

Provider is also switched to using mk_resource_methods to generate
all the resource readers, and exists? and other methods now use the
property_hash where appropriate.

Tests rewritten to handle changes and extend code coverage.
2013-08-28 18:11:21 -04:00
Trey Dockendorf
627699fc49 Add option to mysql::backup to set the backup script to perform a mysqldump on each database to its own file 2013-08-27 15:15:29 -05:00
Ashley Penney
40db3e801d Merge pull request #244 from willametteuniversity/master
Added support to back up specified databases only with 'mysqlbackup'
2013-08-27 09:26:25 -07:00
Casey Feskens
359d88175c Added support to back up specified databases only with 'mysqlbackup'
parameter.  Each database is backed up separately to a named file.
2013-08-13 14:44:41 -07:00
Hunter Haugen
82c4b81ba3 Add environment variable for .my.cnf and specs 2013-08-13 13:08:39 -07:00
Ashley Penney
7c7195ba33 Refactor MySQL bindings and client packages.
The current MySQL module is hard to modify, test, and drop in
replacement components to.  This work starts out by refactoring
the bindings support in MySQL to a completely seperate bindings
class in order to reduce the amount of parameters in the main
class for a feature that is infrequently used.

In addition to this start the movement of client configuration
and packages to the mysql::client::* namespace.
2013-07-19 18:39:55 -04:00
Vincent Janelle
afb8561372 Fixing puppetlabs-mysql PR 174 spec tests 2013-07-16 15:01:58 -07:00
Ashley Penney
cc58668d19 Various fixes suggested by RubyMine. (style for the most part). 2013-07-11 19:41:42 -04:00
Ashley Penney
1bd970d8e5 Merge pull request #215 from mbakke/max_connections
Support max_user_connections in database_user
2013-07-10 07:40:23 -07:00
Marius Bakke
f3b3a7e39f fix database_user tests after changing creation method 2013-07-10 10:23:02 +02:00
Ashley Penney
588af2a89d Merge pull request #218 from hunner/rspec_system_serverspec
Add rspec-system / serverspec tests
2013-07-09 16:15:17 -07:00
Ashley Penney
926e94a4cb Merge pull request #170 from omalashenko/master
Harden mysqlbackup.sh script
2013-07-09 16:06:55 -07:00
Marius Bakke
5f3708ff24 add spec for max_user_connections on database_user 2013-07-08 17:49:59 +02:00
Martin Magr
e3d74a65b0 Use $root_home for .my.cnf 2013-07-08 11:49:30 +02:00
Hunter Haugen
c34bcc0f73 Add rspec-system / serverspec tests 2013-07-05 15:19:02 -07:00
Ashley Penney
4d811e4704 Add basic specs for database provider. 2013-07-05 15:04:04 -04:00
Ashley Penney
d35261dc16 Tweak spec file to account for days of rotation. 2013-07-05 12:32:19 -04:00
Daniel De Marco
e12eb0e19f add ft_min_word_len and ft_max_word_len config options 2013-07-04 21:33:53 -04:00
Oleg Malashenko
1521a2ea4f Fixed tests for mysqlbackup.sh 2013-07-05 11:27:29 +10:00
Ashley Penney
8bf03681f3 Various changes to the provider to ensure commands are successful,
as well as improvements to the tests.
2013-07-03 16:08:48 -04:00
Ashley Penney
00130ef6c6 Add initial spec tests for database_user. 2013-07-03 13:22:48 -04:00
Ashley Penney
e961b83226 Fix spelling of privileges across the spec file. 2013-07-02 16:57:36 -04:00
Lebedev Vadim
9d69afcae7 Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-mysql
Conflicts:
	manifests/config.pp
	spec/classes/mysql_config_spec.rb
2013-07-02 22:11:19 +04:00
Ashley Penney
aa5d1f070b Merge pull request #198 from mhellmic/maxconnections
add a maximum connection parameter and set the default to 1000
2013-07-02 10:43:29 -07:00
Lebedev Vadim
6cef2e8af4 Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-mysql 2013-07-02 21:42:49 +04:00
Ashley Penney
f3e5c89551 Merge pull request #187 from RsrchBoy/topic/perl
add mysql::perl helper class
2013-07-02 10:37:10 -07:00
Lebedev Vadim
ead86b5a3f Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-mysql
Conflicts:
	manifests/config.pp
2013-07-02 21:26:43 +04:00
Simon Effenberg
7f7e886d71 handling of my.cnf config file is now optional
This adds a parameter (default value is like old behavior) so that the
my.cnf file isn't managed (created/updated) by the mysql module at all
which is necessary for our environment. We need to set all parameters by
ourself. If we don't set a parameter then the default from the mysqld
binary should be used instead of any default parameter the mysql module
provides us.
2013-07-02 10:01:21 +02:00
Martin Hellmich
880eaae3e8 changed the max_connections default to 151
this is the default according to the mysql manual.
https://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html#sysvar_max_connections
2013-06-28 11:21:58 +02:00
Martin Hellmich
1263d89a98 changed the test accordingly to the new max-connections parameter
Conflicts:
	spec/classes/mysql_config_spec.rb
2013-06-28 11:03:36 +02:00
Lebedev Vadim
a42d5bea53 Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-mysql 2013-06-26 14:06:01 +04:00
Ewoud Kohl van Wijngaarden
59a6fb8097 Quote the password
It is possible to have a # in a password, which is parsed as a comment.
By quoting the password this is no problem.
2013-06-26 11:47:11 +02:00
Hunter Haugen
a04038efb0 Merge pull request #179 from msmithgu/parameterize-max_allowed_packet
Parameterized max_allowed_packet my.conf config setting, because it is needed to setup puppet-dashboard.
2013-06-25 14:56:53 -07:00
Hunter Haugen
16affe5af8 Merge pull request #199 from hunner/ansi_quotes
Fix SQL when ANSI_QUOTES is enabled in mysql config.
2013-06-25 10:22:00 -07:00
Hunter Haugen
d68aa838e4 Update specs for ansi quoting 2013-06-24 14:51:12 -07:00
Steve Traylen
b9b122e65a change the distribution osfamily from Redhat into RedHat 2013-06-24 16:24:50 +02:00
Lebedev Vadim
6c81ea0d24 * Trying fix unit tests for Travis 2013-06-16 19:41:29 +04:00
Lebedev Vadim
1a13580f49 Merge branch 'master' of https://github.com/puppetlabs/puppetlabs-mysql
Conflicts:
	manifests/config.pp
	manifests/params.pp
2013-05-21 20:40:50 +04:00
Lebedev Vadim
a171c52a89 * Puppet 2.6 fix 2013-05-21 01:21:38 +04:00
Mark Smith-Guerrero
7f94bc3c97 added spec test for parameterized max_allowed_packet 2013-05-06 15:54:47 -04:00
Chris Weyl
0dec443517 mysql::perl tests 2013-05-03 09:25:31 -07:00
Francois Deppierraz
a555848e7d Test to avoid broken default-storage-engine settings 2013-04-26 00:30:09 +02:00
Wolf Noble
0f6886bd99 Refactor of classes to put everything as a param to mysql to prepare for autoloading from hiera
put a handle on all the params of the class in init.pp so that they can be autoloaded from hiera, and easily fed to the class from a profile class
2013-04-09 13:45:55 -05:00
Lebedev Vadim
5ea8e5f920 * Adding server_idparameter to mysql::config`
* Adding `sql_log_bin` parameter to `mysql::config`
* Adding `log_bin` parameter to `mysql::config`
* Adding `max_binlog_size` parameter to `mysql::config`
* Adding `binlog_do_db` parameter to `mysql::config`
* Adding `expire_logs_days` parameter to `mysql::config`
* Adding `log_bin_trust_function_creators` parameter to `mysql::config`
* Adding `replicate_ignore_table` parameter to `mysql::config`
* Adding `replicate_wild_do_table` parameter to `mysql::config`
* Adding `replicate_wild_ignore_table` parameter to `mysql::config`
* Adding `expire_logs_days`  parameter to `mysql::params`
* Adding `max_binlog_size` parameter to `mysql::params`
2013-04-08 19:23:24 +04:00
Lebedev Vadim
2a1b1e7962 * Adding key_buffer parameter to mysql::config
* Adding `thread_stack` parameter to `mysql::config`
* Adding `thread_cache_size` parameter to `mysql::config`
* Adding `myisam-recover` parameter to `mysql::config`
* Adding `query_cache_limit` parameter to `mysql::config`
* Adding `query_cache_size` parameter to `mysql::config`
* Adding `max_connections` parameter to `mysql::config`
* Adding `tmp_table_size` parameter to `mysql::config`
* Adding `table_open_cache` parameter to `mysql::config`
* Adding `long_query_time` parameter to `mysql::config`
* Updating mysql_config spec tests
* Fixing lint warnings
2013-04-08 00:20:36 +04:00
Matt Rogers
b42d4355f0 fix mocha deprecation warnings 2013-02-28 22:36:11 -06:00
Paul Chechetin
90947afd2f Fix tests for Puppet 3.0 target 2013-02-18 15:03:18 +04:00
Hunter Haugen
6b9a5efc0a Add tests for absent /root/.my.cnf 2013-01-10 15:55:42 -08:00
Hunter Haugen
cea77802ac Updating specs for .my.cnf 2013-01-10 15:31:21 -08:00
Hunter Haugen
02c4da48a5 Add php support
PHP libraries are required by many apps. This class assumes 'normal'
names for these packages, but allows other packages names to be passed
for variances such as 'php53-mysql' on RedHat and FreeBSD.
2013-01-04 10:59:17 -08:00
Ryan Coleman
5a167c9eef Merge pull request #125 from bodepd/create_my_cnf
Create /root/.my.cnf even when root passwd is not managed
2012-10-13 10:14:23 -07:00
Ryan Coleman
bb4f15b8fe Merge pull request #117 from hunner/optional_compression
Mysql::backup Compression Optional
2012-10-13 10:09:55 -07:00
Dan Bode
765b5c2527 Create /root/.my.cnf even when root passwd is not managed
When the root password is not managed, it causes mysql to
fail b/c it does not create the /root/.my.cnf file (which causes
all mysql commands from the provider to fail)
2012-10-13 02:35:38 -07:00
Hunter Haugen
64d38890c6 Add mysql argument to use mysql database back 2012-10-09 14:02:05 -07:00
Hunter Haugen
24444ce119 Stub the $root_home fact 2012-10-09 14:00:09 -07:00
Nate Riffe
bdb416053a Use root's credentials when executing mysql.
This is necessary when running puppet as root using sudo because mysql
will still look in the user's home directory in that case unless told
otherwise.
2012-10-09 13:59:58 -07:00
Hunter Haugen
81889c9992 Adding specs for manage_service parameter 2012-10-04 16:27:06 -07:00
Hunter Haugen
6a7d84369e Add spec tests for backup compression enabled/disabled 2012-09-26 13:40:59 -07:00
Hunter Haugen
d98efe3b7a Merge pull request #113 from janoszen/ipv6
IPv6
2012-09-05 11:01:12 -07:00
Janos Pasztor
e77576d8e7 Added spec for IPv6 changes as requested by upstream 2012-09-05 09:58:42 +02:00
Hunter Haugen
8b9f17348c Update mysql::backup privs for #108 2012-09-04 17:04:26 -07:00
Hunter Haugen
0e4de09934 Merge pull request #93 from Savar/master
new config define and a small bugfix
2012-08-29 11:54:58 -07:00
Simon Effenberg
e47b4d19e7 fixed documentation and added rspec
* fixed a typo in the documentation
* added documentation for parameter +notify_service+
* added rspec test
2012-08-24 08:01:33 +02:00
Hunter Haugen
bfd19998d1 Merge pull request #101 from martasd/manage-db-status
Added an option to specify db status.
2012-08-22 11:30:46 -07:00
Eugene Kirpichov
6869b77541 Parameterized pidfile; critical for successful first restart 2012-08-21 18:32:34 -07:00
Martin Dluhos
04537908a9 Added an option to specify db status. 2012-08-21 15:40:42 -07:00
Michael Arnold
605fa718e1 Escape $root_password during execs.
Some characters used in a password can cause the shell in an exec to do
unexpected things unless the password is enclosed in single quotes.
Updated the rspec tests to deal with the password quoting.
2012-08-09 00:34:09 -07:00
Branan Purvine-Riley
5c4f14e386 Fix negative tests on rspec 2.11 2012-07-23 16:39:37 -07:00
Dan Bode
8b2b29a136 Add enabled parameter to mysql::server
This parameter can be used to specify whether the service
should be running.

It has been implemented to allow installations of mysql::server to
be in passive mode for HA.
2012-06-18 14:09:42 -07:00
Branan Purvine-Riley
62b395fe69 Switch to using the puppetlabs_spec_helper gem for common files 2012-05-31 15:32:36 -07:00
William Van Hevelingen
f572b90f9e (#14330) Add FreeBSD spec tests 2012-05-30 19:12:57 -07:00
William Van Hevelingen
05d7e23fe8 (#14330) Add support for FreeBSD
Note: ssl_ca, ssl_cert, and ssl_key do not have sane
defaults in FreeBSD. Setting ssl to true will require
setting the parameters mentioned above.
2012-05-30 19:12:25 -07:00
Branan Purvine-Riley
703c0bde30 Update the module to the new layout for easier testing and packaging
* Add spec_full, spec_prep, and spec_clean targets
* Rename Gemfile -> .gemfile for less cluttered module packages
* Append fixtuers to modulepath instead of overwriting
* Use a more complete .gitignore
* Remove the recursive symlink
2012-05-24 16:55:22 -07:00
John Chilton
41be95e262 Add spec's to test setting default storage engine. 2012-05-15 12:42:32 -05:00
Dan Bode
360f8d968a Merge pull request #64 from runningman/backup
Added mysql::backup class.
2012-05-10 22:44:52 -07:00
Dan Bode
ed62777045 Merge pull request #63 from runningman/security
Added mysql::server::account_security class.
2012-05-04 18:04:11 -07:00
Branan Purvine-Riley
6a81a2f687 (#14316) make privileges case-insensitive 2012-05-04 10:04:46 -07:00
Michael Arnold
c06f82eef7 Update privilege names to comply with 3fbb54de6c.
Forgot to update the rspec test.
2012-05-03 19:58:25 -07:00
Branan Purvine-Riley
29cef3f71a Add initial spec for mysql grant provider 2012-05-01 17:01:47 -07:00
Michael Stahnke
f750b39ad5 Merge pull request #61 from runningman/java
Java
2012-04-29 15:24:11 -07:00
François Charlier
64f367fbb4 Fix typos in mysql::server::monitor class
* fix the dependency declaration

+ add basic tests
2012-04-24 11:56:01 +02:00
Michael Arnold
7890f79547 Added mysql::server::account_security class.
Secures the MySQL installation by removing the test database and the
default users that are created during the MySQL first-run
(root@${fqdn}, @%, @localhost, etc.).
Includes rspec tests and updated documentation.
2012-04-23 23:41:12 -07:00
Michael Arnold
4158137278 Added mysql::backup class.
Installs a mysql backup script, cronjob, and priviledged backup user. 
Includes rspec tests and updated documentation.
2012-04-23 22:53:59 -07:00
Michael Arnold
0743faa6db Added tests to mysql::java. 2012-04-23 21:44:31 -07:00
William Van Hevelingen
f7e0ea5893 (#13203) Add ssl support
This commit adds a ssl parameter to the mysql::config class.
Setting ssl to true adds the following parameters to the template.

   ssl_ca             - path to ssl-ca
   ssl_cert           - path to ssl-cert
   ssl_key            - path to ssl-key
2012-03-21 14:48:22 -07:00
William Van Hevelingen
f353fc6a2d (#13163) Datadir should be configurable
Previously datadir was hardcoded to /var/lib/mysql.
This commit makes datadir configurable for MySQL
installations with custom datadir paths.
2012-03-17 20:19:55 -07:00
Dan Bode
b9e6a78816 Merge pull request #51 from nanliu/tb/spec
Fix spec test issues related to error message.
2012-03-17 12:13:14 -07:00
Nan Liu
eff79b5331 Fix spec test issues related to error message.
The current spec tests was testing for an error message duplicate
declaration instead of duplicate definition. This change was introduced
by puppet issue #11451, so we test for both errors instead.
2012-03-16 22:39:42 -05:00
Nan Liu
72da2c5838 Fix mysql service on Ubuntu.
On Ubuntu, mysql should use upstart provider instead of init.d. This
change overrides the init provider until the issue with init provider
can be addressed.
2012-03-16 18:15:12 -05:00
Dan Bode
55e399db0d Add more spec test coverage
This commit adds full spec test coverage for
- mysql::python
- mysql
- mysql::ruby
- mysql::server
2012-03-16 14:50:35 -07:00
Nan Liu
1700349a76 (#11963) Fix spec test due to path changes.
Due to additional path in issue 11963 to mysql-restart, the config class
spec test have been updated to reflect these changes.
2012-03-16 13:52:30 -05:00
Nan Liu
812ba01509 Merge pull request #46 from bodepd/add_rspec_tests_for_config_class
Add rspec tests for config class
2012-03-16 11:25:28 -07:00
François Charlier
b14c7d14d2 Add a test to check path for 'mysqld-restart'
And fix a coma error in mysql::config class.

Signed-off-by: François Charlier <fcharlier@ploup.net>
2012-03-16 18:13:16 +01:00
Dan Bode
907331a750 Add rspec-puppet tests for mysql::config 2012-03-15 00:54:33 -07:00
Nan Liu
b1f90fd1d2 Major refactor of mysql module.
This is a major change to the module and would be released as a new
version.

* Add self.instances to database and database_user for puppet resource.
* Update database provider to use flush method.
* Update module to conform to puppet-lint recommendations.
* Cleanup some unecessary logic in mysql::db define type.
* Move mysql_restart to config class.
* Use class to class dependency instead of resource dependency.
* Change appropriate rspec-puppet tests.
* Add fixtures directory to simplify testing.
* Update raketask and spec_helper to reflect fixture changes.
* Update mysql_password function to support validation.
* Move client installation to a separate class.
* Update documentation and readme.
2012-03-13 15:19:53 -07:00
Carl Caum
0783c748b7 Only notify Exec to import sql if sql is given
Commit e3b9fd broke the mysql::db defined type by always notifying the
Exec[${name}-import-import] resource even though the resource may not be
declared if the $sql parameter was not given. This commit adds an
in-selector to only notify the Exec resource if the $sql parameter has a
value.  More extensive rspec-puppet tests have been provided to protect
against this in the future.
2011-12-19 20:48:47 -08:00
Carl Caum
e3b9fd90a6 (#11508) Only load sql_scripts on DB creation
Previous to this commit, if the sql parameter was provided to a
declaration of the mysql::db defined type, the defined type would always
load the sql script on every catalog run. This changes the exec that
loads that sql script to be refreshonly unless the enforce_sql parameter
is set to true.
2011-12-19 07:25:35 -08:00