Pass the backup username and password to mysql when running SHOW DATABASES in
mysqlbackup.sh if `file_per_database` is true and `backupdatabases` is empty.
This conversion is done by Transpec 2.3.6 with the following command:
transpec -f -c "bundle exec rake spec"
* 69 conversions
from: it { should ... }
to: it { is_expected.to ... }
* 48 conversions
from: obj.should
to: expect(obj).to
* 34 conversions
from: == expected
to: eq(expected)
* 4 conversions
from: it { should_not ... }
to: it { is_expected.not_to ... }
* 3 conversions
from: obj.should_not
to: expect(obj).not_to
* 2 conversions
from: lambda { }.should
to: expect { }.to
* 2 conversions
from: pending
to: skip
For more details: https://github.com/yujinakayama/transpec#supported-conversions
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.
Check for database existence when dropping to prevent
ERROR 1008 (HY000): Can't drop database 'test'; database doesn't exist
Signed-off-by: Ray Lehtiniemi <rayl@mail.com>
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>
In the grant provider users are fetched by querying mysql.user table. Grants
for those users are fetched using show grants for... syntax. This can lead to
errors, when some of the users in mysql.user table do not have currently
active grants.
This happens at least when MySQL is started with --skip-name-resolve option,
when there are users with the hostname part specified as a FQDN. Such users are
created by mysql_install_db. This leads to problems if mysql::account_security
is included for the node and skip-name-resolve is specified in override_options
hash for mysql::server.
Includes acceptance test for the change.
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.
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.
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.
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.
Existing EPEL addition in spec_helper_acceptance wasn't actually working, so pulled in stahnma-epel and applied that in the bindings test, since that's the only place it's actually required.
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)
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
Includes a test for the regression fixed in 30ce3e0.
NB: The `ensure => present` on the resource without any `charset` or
`collate` arguments is intentional because of issue described in #458
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.
This fixes an issue where subsequent tests will fail when the RS_PROVISION=no and RS_DESTROY=no flag is set for centos. The error is caused by attempting to install the puppet rpm on a machine that already has the puppet rpm installed.
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.
Some MySQL options need to be passed several times. For example :
http://dev.mysql.com/doc/refman/5.5/en/replication-options-slave.html#option_mysqld_replicate-do-db
This is currently impossible with the override_options. This patch allows to
pass array as value. Example :
override_options => {
'client' => {
'password' => 'xxx',
},
'mysqld' => {
'bind_address' => '0.0.0.0',
'replicate-do-db' => ['base1', 'base2', 'base3'],
},
}
Which will be evaluated into :
[client]
password = xxx
[mysqld]
bind_address = 0.0.0.0
replicate-do-db = base1
replicate-do-db = base2
replicate-do-db = base3
This commit adds tests for the parameters that were previously untested.
Most of this testing is light, but all parameters of the module are now
called at least once. Generally we're testing the happy path, so these
need further work in future.
These tests are more or less parity with the rspec-system tests, though
dependent on a few patches that still have to make it into beaker and
beaker-rspec
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
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.
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.
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.
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.
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.
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.
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.