Skip to content

fix FreeBSD support for backups #697

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
Apr 13, 2015
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
2 changes: 1 addition & 1 deletion manifests/backup/mysqlbackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$backupdir,
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = 'root',
$backupdirgroup = $mysql::params::root_group,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be $mysql::root_group?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, we might use $mysql::root:group here, but this module's style is to use $mysql::params::* elsewhere.

$backupcompress = true,
$backuprotate = 30,
$ignore_events = true,
Expand Down
4 changes: 2 additions & 2 deletions manifests/backup/mysqldump.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
$backupdir,
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = 'root',
$backupdirgroup = $mysql::params::root_group,
$backupcompress = true,
$backuprotate = 30,
$ignore_events = true,
Expand Down Expand Up @@ -47,7 +47,7 @@
path => '/usr/local/sbin/mysqlbackup.sh',
mode => '0700',
owner => 'root',
group => 'root',
group => $mysql::params::root_group,
content => template('mysql/mysqlbackup.sh.erb'),
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/backup/xtrabackup.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$backupmethod = 'mysqldump',
$backupdirmode = '0700',
$backupdirowner = 'root',
$backupdirgroup = 'root',
$backupdirgroup = $mysql::params::root_group,
$backupcompress = true,
$backuprotate = 30,
$ignore_events = true,
Expand Down
6 changes: 6 additions & 0 deletions templates/mysqlbackup.sh.erb
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<%- if @kernel == 'Linux' -%>
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can probably set this unconditionally, since we're not really using any oh…

<%- else -%>
#!/bin/sh
<%- end -%>
#
# MySQL Backup Script
# Dumps mysql databases to a file for another backup tool to pick up.
Expand Down Expand Up @@ -27,7 +31,9 @@ PATH=<%= @execpath %>



<%- if @kernel == 'Linux' -%>
set -o pipefail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we actually are…

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wondering if we can make the shell dependent on whether /bin/bash actually exists… but then again, FreeBSD puts bash in /usr/local/bin (and doesn't install it per default)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If simplification would be the main goal, I'd always opt to change the script to rely on (a POSIX-conformant) /bin/sh instead of bash for obvious compatibility reasons. Otherwise I'm fine with my suggested fallback on non-Linux platforms...

<%- end -%>

cleanup()
{
Expand Down