Correctly propagate failing hooks back to xen-create-image
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user