Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure we do not backup the MySQL datadir.

  • Loading branch information...
commit c6a54292df4414f2b52d7be54a4cac02299616e4 1 parent f1e8b3d
@timstoop timstoop authored
Showing with 18 additions and 17 deletions.
  1. +10 −4 kbp_mysql/manifests/init.pp
  2. +8 −13 kbp_percona/manifests/init.pp
View
14 kbp_mysql/manifests/init.pp
@@ -207,6 +207,16 @@
target => "/usr/share/backup-scripts/prepare/mysql",
require => Package["backup-scripts"];
}
+
+ if $datadir {
+ if ! defined(Kbp_backup::Exclude[$datadir]) {
+ kbp_backup::exclude { $datadir:; }
+ }
+ } else {
+ if ! defined(Kbp_backup::Exclude['/var/lib/mysql/']) {
+ kbp_backup::exclude { '/var/lib/mysql/':; }
+ }
+ }
} else {
file { "/etc/backup/prepare.d/mysql":
ensure => absent;
@@ -239,10 +249,6 @@
}
}
- kbp_backup::exclude { "exclude_var_lib_mysql":
- content => "/var/lib/mysql/*";
- }
-
exec { 'remove_root_users':
onlyif => '/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf -e "select * from mysql.user where user=\'root\' and password=\'\'" | /bin/grep -q root',
command => '/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf -e "delete from mysql.user where user=\'root\'; flush privileges"',
View
21 kbp_percona/manifests/init.pp
@@ -178,8 +178,14 @@
require => Package["backup-scripts"];
}
- file { "/etc/mysql/conf.d/expire_logs.cnf":
- content => "[mysqld]\nexpire_logs_days = 7\n";
+ if $datadir {
+ if ! defined(Kbp_backup::Exclude[$datadir]) {
+ kbp_backup::exclude { $datadir:; }
+ }
+ } else {
+ if ! defined(Kbp_backup::Exclude['/var/lib/mysql/']) {
+ kbp_backup::exclude { '/var/lib/mysql/':; }
+ }
}
} else {
# Remove the backup script. Don't remove the expire_logs, since that might inadvertently fill up a disk
@@ -187,10 +193,6 @@
file { "/etc/backup/prepare.d/percona":
ensure => absent,
}
-
- file { "/etc/mysql/conf.d/expire_logs.cnf":
- content => "[mysqld]\nexpire_logs_days = 1\n";
- }
}
file {
@@ -213,13 +215,6 @@
}
}
- kbp_backup::exclude { "exclude_percona_data_dir":
- content => $datadir ? {
- false => "/var/lib/mysql/*",
- default => $datadir,
- },
- }
-
# Since we usually upgrade to Percona, remove the old logrotate config for mysql
file { '/etc/logrotate.d/mysql-server':
ensure => absent,
Please sign in to comment.
Something went wrong with that request. Please try again.