-Have xCATd attempt to relay fatal errors to clients instead of just logging them.

git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@1880 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
This commit is contained in:
jbjohnso 2008-07-14 15:15:35 +00:00
parent 1fee96f3b8
commit f90436637c

View File

@ -1,5 +1,6 @@
#!/usr/bin/env perl
# IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html
use Carp;
BEGIN
{
$::XCATROOT = $ENV{'XCATROOT'} ? $ENV{'XCATROOT'} : '/opt/xcat';
@ -113,7 +114,7 @@ $xcatdir = (($tmp and $tmp->{value}) ? $tmp->{value} : "/etc/xcat");
$sitetab->close;
my $progname;
$SIG{PIPE} = sub { die "SIGPIPE $$progname encountered a broken pipe (probably Ctrl-C by client)" };
$SIG{PIPE} = sub { confess "SIGPIPE $$progname encountered a broken pipe (probably Ctrl-C by client)" };
$progname = \$0;
sub daemonize {
chdir('/');
@ -1116,9 +1117,21 @@ sub service_connection {
if ($@) { # The eval statement caught a program bug..
if ($@ =~ /^SIGPIPE/) {
syslog("local4|info","xcatd: Unexpected client disconnect");
} elsif ($@ =~ /abort/) {
if ($sock) {
eval {
print $sock XMLout({error=>"Generic PIPE error occurred. $@"},RootName=>'xcatresponse',NoAttr=>1);
};
}
} elsif ($@ =~ /Client abort requested/) {
} else {
my $errstr="A fatal error was encountered, the following information may help identify a bug: $@";
chomp($errstr);
syslog("local4|err","xcatd: possible BUG encountered by xCAT TCP service: ".$@);
if ($sock) {
eval {
print $sock XMLout({error=>$errstr},RootName=>'xcatresponse',NoAttr=>1);
};
}
}
}
$SIG{ALRM}= sub { die "$$ failed shutting down" };