Skip to content

Commit 6911f0f

Browse files
committed
Allow multiple backupmethods
At this Time, this is not possible because a dupplicate resource error occurs. With this change it is possible to generate a daily xtrabackup and also a weekly mysqldump for example.
1 parent 952afd8 commit 6911f0f

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

manifests/backup/mysqlbackup.pp

+1-3
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,10 @@
101101
mode => '0600',
102102
}
103103

104-
file { 'mysqlbackupdir':
104+
file { $backupdir:
105105
ensure => 'directory',
106-
path => $backupdir,
107106
mode => $backupdirmode,
108107
owner => $backupdirowner,
109108
group => $backupdirgroup,
110109
}
111-
112110
}

manifests/backup/mysqldump.pp

+1-3
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,10 @@
7070
content => template('mysql/mysqlbackup.sh.erb'),
7171
}
7272

73-
file { 'mysqlbackupdir':
73+
file { $backupdir:
7474
ensure => 'directory',
75-
path => $backupdir,
7675
mode => $backupdirmode,
7776
owner => $backupdirowner,
7877
group => $backupdirgroup,
7978
}
80-
8179
}

manifests/backup/xtrabackup.pp

+1-2
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@
6767
require => Package[$xtrabackup_package_name],
6868
}
6969

70-
file { 'mysqlbackupdir':
70+
file { $backupdir:
7171
ensure => 'directory',
72-
path => $backupdir,
7372
mode => $backupdirmode,
7473
owner => $backupdirowner,
7574
group => $backupdirgroup,

spec/classes/mysql_server_backup_spec.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class { 'mysql::server': }
1515
let(:default_params) do
1616
{ 'backupuser' => 'testuser',
1717
'backuppassword' => 'testpass',
18-
'backupdir' => '/tmp',
18+
'backupdir' => '/tmp/mysql-backup',
1919
'backuprotate' => '25',
2020
'delete_before_dump' => true,
2121
'execpath' => '/usr/bin:/usr/sbin:/bin:/sbin:/opt/zimbra/bin',
@@ -65,8 +65,7 @@ class { 'mysql::server': }
6565
}
6666

6767
it {
68-
is_expected.to contain_file('mysqlbackupdir').with(
69-
path: '/tmp',
68+
is_expected.to contain_file('/tmp/mysql-backup').with(
7069
ensure: 'directory',
7170
)
7271
}
@@ -113,9 +112,10 @@ class { 'mysql::server': }
113112
end
114113

115114
it {
116-
is_expected.to contain_file('mysqlbackupdir').with(
117-
path: '/tmp', ensure: 'directory',
118-
mode: '0750', owner: 'testuser',
115+
is_expected.to contain_file('/tmp/mysql-backup').with(
116+
ensure: 'directory',
117+
mode: '0750',
118+
owner: 'testuser',
119119
group: 'testgrp'
120120
)
121121
}

0 commit comments

Comments
 (0)