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).
- 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
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
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.
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.
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 \.
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',
]
}
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.
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.
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.
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.
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>
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>
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.
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.
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.