1
0
mirror of synced 2026-05-03 06:48:46 +00:00

Add optional argument to unMountImage and hence runCommand to allow failure

This commit is contained in:
Axel Beckert
2013-01-17 21:02:00 +01:00
parent a223eedf0b
commit c1e7cb717a
3 changed files with 16 additions and 15 deletions

View File

@@ -218,9 +218,9 @@ sub findXenToolstack
=cut
sub runCommand ($$)
sub runCommand ($$;$)
{
my ($cmd, $CONFIG) = (@_);
my ($cmd, $CONFIG, $fail_ok) = (@_);
#
# Set a local if we don't have one.
@@ -245,10 +245,12 @@ sub runCommand ($$)
my $rcopen = open(CMD, '-|', $cmd);
if (!defined($rcopen)) {
logprint_with_config("Starting command '$cmd' failed: $!\n", $CONFIG);
logprint_with_config("Aborting\n", $CONFIG);
print "See /var/log/xen-tools/".$CONFIG->{'hostname'}.".log for details\n";
$CONFIG->{'FAIL'} = 1;
exit 127;
unless ($fail_ok) {
logprint_with_config("Aborting\n", $CONFIG);
print "See /var/log/xen-tools/".$CONFIG->{'hostname'}.".log for details\n";
$CONFIG->{'FAIL'} = 1;
exit 127;
}
}
while (my $line = <CMD>) {
@@ -270,8 +272,10 @@ sub runCommand ($$)
logprint_with_config("Running command '$cmd' failed with exit code $?.\n", $CONFIG);
logprint_with_config("Aborting\n", $CONFIG);
print "See /var/log/xen-tools/".$CONFIG->{'hostname'}.".log for details\n";
$CONFIG->{'FAIL'} = 1;
exit 127;
unless ($fail_ok) {
$CONFIG->{'FAIL'} = 1;
exit 127;
}
}
}