Skip to content

Commit 9bab315

Browse files
Handle ensure absent for backup directory
1 parent 51fc626 commit 9bab315

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

manifests/backup/xtrabackup.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@
169169
}
170170

171171
file { $backupdir:
172-
ensure => 'directory',
172+
ensure => $ensure ? { 'absent' => 'absent', default => 'directory' },
173173
mode => $backupdirmode,
174174
owner => $backupdirowner,
175175
group => $backupdirgroup,

spec/classes/mysql_backup_xtrabackup_spec.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,10 @@ class { 'mysql::server': }
346346
it 'installs the backup method package' do
347347
expect(subject).to contain_package(package).with_ensure('installed')
348348
end
349+
350+
it 'manages the backup directory' do
351+
expect(subject).to contain_file('/tmp').with_ensure('directory')
352+
end
349353
end
350354

351355
context 'with ensure => absent' do
@@ -356,6 +360,10 @@ class { 'mysql::server': }
356360
it 'removes the backup method package' do
357361
expect(subject).to contain_package(package).with_ensure('absent')
358362
end
363+
364+
it 'removes the backup directory' do
365+
expect(subject).to contain_file('/tmp').with_ensure('absent')
366+
end
359367
end
360368
end
361369
end

0 commit comments

Comments
 (0)