|
From: <jam...@te...> - 2002-06-21 20:24:57
|
OK, replying to myself, but after I fixed the problem with setting the
confiuguration
I had a simular problem in when running it in execute_dump(). I used the
same strategy
to fix it. As I was fixing it thouugh, I noticed that at the end after
running the dump command
the return code from dump was not checked (I would never do that (-;).
Anyway, this patch contains
the previous change, the new change for the same error in execute_dump, and
it contains a suggested
fix for not checking the return code. I forgot to mention this is against
the 0.980 source with no updates.
Here is the new patch:
*** redhat-linux-lib.pl Fri Jun 21 16:13:00 2002
--- redhat-linux-lib.pl.orig Fri Jun 21 14:54:52 2002
***************
*** 190,239 ****
# Executes a dump and displays the output
sub execute_dump
{
- my $dump_data = shift;
local $fh = $_[1];
local ($cmd, $flag);
!
! #
! # Verify we were passed the correct args
! if (!ref($dump_data)) {
! print "<B>Error Call to execute_dump() in redhat-linux-lib.pl with invalid arguments!</B>";
! return 0
! }
!
! if ($dump_data->{'huser'}) {
! $flag = " -f '" . $dump_data->{'huser'} . '@' . $dump_data->{'host'} .
! ':' . $dump_data->{'hfile'} . "'";
}
! elsif ($dump_data->{'host'}) {
! $flag = " -f '" . $dump_data->{'host'} . ':' . $dump_data->{'hfile'} . "'";
}
else {
! $flag = " -f '" . $dump_data->{'file'} . "'";
}
! if ($dump_data->{'fs'} eq 'xfs') {
# xfs backup
$cmd = "xfsdump -l $_[0]->{'level'}";
$cmd .= $flag;
! $cmd .= " -L '" . $dump_data->{'label'} . "'" if ($dump_data->{'label'});
! $cmd .= " -M '" . $dump_data->{'label'} . "'" if ($dump_data->{'label'});
! $cmd .= " -z '" . $dump_data->{'max'} . "'" if ($dump_data->{'max'});
! $cmd .= " -A" if ($dump_data->{'noattribs'});
! $cmd .= " -F" if ($dump_data->{'over'});
! $cmd .= " -J" if ($dump_data->{'noinvent'});
! $cmd .= " -o" if ($dump_data->{'overwrite'});
! $cmd .= " -E -F" if ($dump_data->{'erase'});
! $cmd .= " '" . $dump_data->{'dir'} . "'";
}
else {
# ext2/3 backup
! $cmd = "dump -" . $dump_data->{'level'};
$cmd .= $flag;
! $cmd .= " -u" if ($dump_data->{'update'});
! $cmd .= " -M" if ($dump_data->{'multi'});
! $cmd .= " -L '" . $dump_data->{'label'} . "'" if ($dump_data->{'label'});
! $cmd .= " -B " . $dump_data->{'blocks'} if ($dump_data->{'blocks'});
! $cmd .= " '" . $dump_data->{'dir'} . "'";
}
&system_logged("sync");
--- 190,229 ----
# Executes a dump and displays the output
sub execute_dump
{
local $fh = $_[1];
local ($cmd, $flag);
! if ($_[0]->{'huser'}) {
! $flag = " -f '$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}'";
}
! elsif ($_[0]->{'host'}) {
! $flag = " -f '$_[0]->{'host'}:$_[0]->{'hfile'}'";
}
else {
! $flag = " -f '$_[0]->{'file'}'";
}
! if ($_[0]->{'fs'} eq 'xfs') {
# xfs backup
$cmd = "xfsdump -l $_[0]->{'level'}";
$cmd .= $flag;
! $cmd .= " -L '$_[0]->{'label'}'" if ($_[0]->{'label'});
! $cmd .= " -M '$_[0]->{'label'}'" if ($_[0]->{'label'});
! $cmd .= " -z '$_[0]->{'max'}'" if ($_[0]->{'max'});
! $cmd .= " -A" if ($_[0]->{'noattribs'});
! $cmd .= " -F" if ($_[0]->{'over'});
! $cmd .= " -J" if ($_[0]->{'noinvent'});
! $cmd .= " -o" if ($_[0]->{'overwrite'});
! $cmd .= " -E -F" if ($_[0]->{'erase'});
! $cmd .= " '$_[0]->{'dir'}'";
}
else {
# ext2/3 backup
! $cmd = "dump -$_[0]->{'level'}";
$cmd .= $flag;
! $cmd .= " -u" if ($_[0]->{'update'});
! $cmd .= " -M" if ($_[0]->{'multi'});
! $cmd .= " -L '$_[0]->{'label'}'" if ($_[0]->{'label'});
! $cmd .= " -B $_[0]->{'blocks'}" if ($_[0]->{'blocks'});
! $cmd .= " '$_[0]->{'dir'}'";
}
&system_logged("sync");
***************
*** 249,285 ****
}
}
close(CMD);
- my $rc = $? >> 8;
- if($rc != 0) {
- print <<EOF;
- <B>
- <P>ERROR Running dump!</P>
-
- COMMAND: ${cmd}
- RC: ${rc}
- EOF
- }
-
}
# dump_dest(&dump)
sub dump_dest
{
! my $dump_data = shift;
!
! if(!ref($dump_data)) {
! return "<B>Error Call to dump_dest() in redhat-linux-lib.pl with invalid arguments!</B>";
! }
! if ($dump_data->{'file'}) {
! return "<tt>".&html_escape($dump_data->{'file'})."</tt>";
}
elsif ($_[0]->{'huser'}) {
! return "<tt>" . &html_escape($dump_data->{'huser'} . '@' .
! $dumpdata->{'host'} . ':' . $dump_data->{'hfile'}) . "</tt>";
}
else {
! return "<tt>" . &html_escape($dump_data->{'host'} . ':' .
! $dump_data->{'hfile'}) . "</tt>";
}
}
--- 239,257 ----
}
}
close(CMD);
}
# dump_dest(&dump)
sub dump_dest
{
! if ($_[0]->{'file'}) {
! return "<tt>".&html_escape($_[0]->{'file'})."</tt>";
}
elsif ($_[0]->{'huser'}) {
! return "<tt>".&html_escape("$_[0]->{'huser'}@$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>";
}
else {
! return "<tt>".&html_escape("$_[0]->{'host'}:$_[0]->{'hfile'}")."</tt>";
}
}
Cheers...james
|