Commit cdd7132ff9 added logic to catch invalid database usernames,
but the regex it uses fails to match usernames with special characters that are properly quoted,
causing errors with usernames that used to work in versions < 3.0.0. This fixes the regex so that
if the username is quoted, anything is allowed between the quotes.
From the docs (http://dev.mysql.com/doc/refman/5.5/en/identifiers.html):
"Permitted characters in quoted identifiers include the full Unicode Basic Multilingual Plane (BMP),
except U+0000"
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',
]
}
Unfortunately Beaker will be EOL-ing support for Ruby 1.8 (a number of
Beaker's dependencies already have and pinning to older versions is
becoming costly). Once Beaker does this it will cause failures whenever
running `bundle install`.
To avoid this failure we can segregate the system testing gems, allowing
unit, lint and development to continue with
`bundle install --without system_tests.`
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.)
* 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 \.
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 '?').
The backup script needs the bzcat command, which does not come
installed on RHEL 7 and Fedora hosts by default. This patch installs
the bzip2 package before attempting to run tests that use bzcat.
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.
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.
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.