Commit graph

40 commits

Author SHA1 Message Date
Ashley Penney
d884e2fc1e Merge pull request #522 from cmurphy/fix_mysql_grant_MODULES-1040
Require title of mysql_grant resource to match form user/table
2014-06-05 13:07:40 -04:00
Igor Galić
b39ebdcf74 Merge pull request #505 from larsks/bz/1093367
lowercase hostname values in qualified usernames
2014-06-05 12:17:04 +02:00
Colleen Murphy
07b661dcea Require title of mysql_grant resource to match form user/table
This addresses https://tickets.puppetlabs.com/browse/MODULES-1040.
The user parameter is required to have the form username@host. A grant
is identified in the instances method by a name of the form
username@host/table. The resource will fail to be identified as already
existing if the name given to the resource does not match this form.
2014-06-04 10:44:36 -07:00
Lars Kellogg-Stedman
0afb8f09e8 lowercase hostname values in qualified usernames
MySQL/MariaDB automatically downcase hostnames:

  MariaDB [mysql]> create user 'testuser'@'HOSTNAME';
  MariaDB [mysql]> select user,host from user where host = 'hostname';
  +----------+----------+
  | user     | host     |
  +----------+----------+
  | testuser | hostname |
  +----------+----------+

This causes problems when a mysql_user or datbase_user has an hostname
with non-lowercase characters:

  database_user { "root@HOSTNAME":
    ensure => absent,
  }

The SELECT statements used to determine if the user exists will fail
because the comparisons use "HOSTNAME" but the database has "hostname".
This patch forces the hostname part of "user@hostname" to lower case in
the custom type definitions.
2014-06-04 09:30:45 -04:00
William Van Hevelingen
669466c315 RSpec renamed be_true to be_truthy in 3.0
This commits updates the spec tests to use the renamed function.
2014-06-03 23:31:19 -07:00
Ashley Penney
30ce3e0e12 Repair this by ensuring calls to mysql include the database name.
A prior commit accidently broke this, meaning that mysql_database
was querying the mysql defaults instead of each individual database
when trying to determine the current collate settings.
2014-02-18 14:38:21 -05:00
Igor Galić
c747ea7ab5 Merge pull request #422 from stevesaliman/master
fixed a quoting problem with the mysql_database provider
2014-01-25 03:50:23 -08:00
Steve Saliman
80b97d295d Fixed a couple of failing tests 2014-01-24 13:06:34 -07:00
Jim Radford
16baff686c mysql_deepmerge should treat underscore and dash equivalently, as mysql does 2014-01-23 22:41:58 -08:00
Srinath M
a571df4c79 Fixed testing for creating a DB with the [if not exists] clause 2013-12-16 09:59:43 -05:00
Tamas Szasz
aee0e01d81 Type mysql_grant was limited to work only with resource names foo@localhost/*.* or foo@localhost/bar.* but NOT with root@localhost/@ which is the parsed value of "GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION" grant line.
New spec test was created for the type mysql_grant.rb
2013-11-16 19:11:39 +01:00
Tamas Szasz
4ac8879734 Fixed missing parent for global mysql class
Added "require" to the global mysql.rb file like in the other provider files.

defaults-file changed to defaults-extra-file in all the database_* (old) providers, the same as in the mysql_* providers.

Changed defaults-file to defaults-extra-file in all test files
2013-11-12 21:32:41 +01:00
Marc Huffnagle
7ea41249e2 Fix raise_error deprecation warning 2013-10-31 12:42:42 -04:00
Ashley Penney
ce266fa893 Add in the @host users. 2013-10-08 10:18:14 -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
803034e880 Rewrite spec tests to account for changes. 2013-09-13 13:14:48 -04:00
Ashley Penney
596d005a98 Rework tests for mysql_password to extend coverage. 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
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
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
Ashley Penney
4d811e4704 Add basic specs for database provider. 2013-07-05 15:04:04 -04: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
Hunter Haugen
d68aa838e4 Update specs for ansi quoting 2013-06-24 14:51:12 -07: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
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
Branan Purvine-Riley
6a81a2f687 (#14316) make privileges case-insensitive 2012-05-04 10:04:46 -07:00
Branan Purvine-Riley
29cef3f71a Add initial spec for mysql grant provider 2012-05-01 17:01:47 -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