1
0
mirror of synced 2026-01-26 03:41:32 +00:00

Correctly propagate failing hooks back to xen-create-image

This commit is contained in:
Axel Beckert
2010-05-17 01:13:26 +02:00
parent dd5edf3ccb
commit fc973602e5
2 changed files with 16 additions and 4 deletions

View File

@@ -3706,20 +3706,24 @@ sub runCommand
#
# Copy stderr to stdout, so we can see it, and make sure we log it.
#
$cmd .= " 2>&1 | tee --append /var/log/xen-tools/$CONFIG{'hostname'}.log";
$cmd .= " 2>&1";
#
# Run it.
#
my $output = `$cmd`;
my $rc = $?;
logprint($output);
$CONFIG{ 'verbose' } && print "Finished : $cmd\n";
if ( $? != 0 )
if ( $rc != 0 )
{
logprint("Running command '$cmd' failed.\n");
logprint("Aborting\n");
print "Running command '$cmd' failed.\n";
print "See /var/log/xen-tools/$CONFIG{'hostname'}.log for details\n";
$FAIL = 1;
exit 127;
}

View File

@@ -320,14 +320,22 @@ sub runDistributionHooks
{
print "Running hook $name ['$cmd']\n";
print "--\n";
system($cmd );
my $rc = system($cmd);
if ($rc != 0) {
print "hook $name failed: $?\n";
exit 1;
}
print "--\n";
print "Done\n\n";
}
else
{
print "Running hook $name\n";
system($cmd );
my $rc = system($cmd);
if ($rc != 0) {
print "hook $name failed: $?\n";
exit 1;
}
print "hook $name: done.\n";
}
}