Skip to content

Parameterize backup directory mode and ownership #375

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,21 @@ MySQL user password for backups.

Directory to backup into.

#####`backupdirmode`

Permissions applied to the backup directory. This parameter is passed directly
to the `file` resource.

#####`backupdirowner`

Owner for the backup directory. This parameter is passed directly to the `file`
resource.

#####`backupdirgroup`

Group owner for the backup directory. This parameter is passed directly to the
`file` resource.

#####`backupcompress`

Boolean to determine if backups should be compressed.
Expand Down
9 changes: 6 additions & 3 deletions manifests/server/backup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
$backupuser,
$backuppassword,
$backupdir,
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = 'root',
$backupcompress = true,
$backuprotate = 30,
$delete_before_dump = false,
Expand Down Expand Up @@ -48,9 +51,9 @@
file { 'mysqlbackupdir':
ensure => 'directory',
path => $backupdir,
mode => '0700',
owner => 'root',
group => 'root',
mode => $backupdirmode,
owner => $backupdirowner,
group => $backupdirgroup,
}

}
17 changes: 17 additions & 0 deletions spec/classes/mysql_server_backup_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,23 @@
end
end

context 'custom ownership and mode for backupdir' do
let(:params) do
{ :backupdirmode => '0750',
:backupdirowner => 'testuser',
:backupdirgroup => 'testgrp',
}.merge(default_params)
end

it { should contain_file('mysqlbackupdir').with(
:path => '/tmp',
:ensure => 'directory',
:mode => '0750',
:owner => 'testuser',
:group => 'testgrp'
) }
end

context 'with compression disabled' do
let(:params) do
{ :backupcompress => false }.merge(default_params)
Expand Down