diff --git a/bacula-backup/CHANGELOG b/bacula-backup/CHANGELOG index 5185682d5..03da80874 100644 --- a/bacula-backup/CHANGELOG +++ b/bacula-backup/CHANGELOG @@ -3,3 +3,5 @@ First version of this module, which allows Bacula to be configured and both back ---- Changes since 1.360 ---- Removed the requirement for the /etc/bacula/bacula command to be installed, if /etc/init.d/bacula-* scripts exist. Added a field to the mount/un-mount page for entering an auto-loader slot number. +---- Changes since 1.370 ---- +Backup schedules with Level= and Pool= tags are now properly displayed and editable. diff --git a/bacula-backup/bacula-backup-lib.pl b/bacula-backup/bacula-backup-lib.pl index bde33eeb3..ab1496208 100644 --- a/bacula-backup/bacula-backup-lib.pl +++ b/bacula-backup/bacula-backup-lib.pl @@ -1532,5 +1532,22 @@ if ($str =~ /^(\d{4})\-(\d\d)\-(\d\d)\s+(\d\d):(\d\d):(\d\d)$/) { return undef; } +# extract_schedule(run) +# Given a schedule Run string like Level=Full Pool=Monthly 1st sat at 03:05, +# returns a hash ref of the tags and the schedule. +sub extract_schedule +{ +local ($run) = @_; +local $tags; +while($run =~ s/^(\S+)=(\S+)\s+//) { + $tags{$1} = $2; + } +if (!$tags{'Level'}) { + $run =~ s/^(\S+)\s+//; + $tags{'Level'} = $1; + } +return ( \%tags, $run ); +} + 1; diff --git a/bacula-backup/edit_schedule.cgi b/bacula-backup/edit_schedule.cgi index 147719489..cb2daeb94 100755 --- a/bacula-backup/edit_schedule.cgi +++ b/bacula-backup/edit_schedule.cgi @@ -29,20 +29,31 @@ print &ui_table_row($text{'schedule_name'}, # Run files @runs = &find_value("Run", $schedule->{'members'}); +@pools = &find("Pool", $conf); +&sort_by_name(\@pools); $rtable = &ui_columns_start([ $text{'schedule_level'}, + $text{'schedule_pool'}, $text{'schedule_times'} ], "width=100%"); $i = 0; foreach $r (@runs, undef, undef, undef) { - ($level, $times) = split(/\s+/, $r, 2); - $level =~ s/^Level\s*=\s*//; - $sched = &parse_schedule($times); + # Parse out the level and pool + $tags = { }; + if ($r) { + ($tags, $r) = &extract_schedule($r); + } + $sched = &parse_schedule($r); $rtable .= &ui_columns_row([ - &ui_select("level_$i", $level, + &ui_select("level_$i", $tags->{'Level'}, [ [ "", " " ], [ "Full" ], [ "Incremental" ], [ "Differential" ] ], 1, 0, 1), - &ui_textbox("times_$i", $times, - $sched || !$r ? "40 readonly" : 40)." ". + &ui_select("pool_$i", $tags->{'Pool'}, + [ [ "", "<$text{'default'}>" ], + map { my $pn = &find_value("Name", + $_->{'members'}); [ $pn ] } @pools ], + 1, 0, 1), + &ui_textbox("times_$i", $r, 50, 0, undef, + $sched || !$r ? "readonly" : "")." ". &schedule_chooser_button("times_$i") ]); $i++; } diff --git a/bacula-backup/lang/en b/bacula-backup/lang/en index b1f19d8a9..38f0e7676 100644 --- a/bacula-backup/lang/en +++ b/bacula-backup/lang/en @@ -172,6 +172,7 @@ schedule_header=Backup schedule details schedule_name=Backup schedule name schedule_runs=Run levels and times schedule_level=Backup level +schedule_pool=Volume schedule_times=Run at times schedule_err=Failed to save backup schedule schedule_ename=Missing or invalid schedule name diff --git a/bacula-backup/save_schedule.cgi b/bacula-backup/save_schedule.cgi index 4328ae306..442ee5bac 100755 --- a/bacula-backup/save_schedule.cgi +++ b/bacula-backup/save_schedule.cgi @@ -40,7 +40,9 @@ else { next if (!$level); $times = $in{"times_$i"}; $times =~ /\S/ || &error(&text('schedule_etimes', $i+1)); - push(@runs, "$level $times"); + push(@runs, "Level=$level ". + ($in{"pool_$i"} ? "Pool=".$in{"pool_$i"}." " : ""). + $times); } &save_directives($conf, $schedule, "Run", \@runs, 1);