* Convert an error message to use warn
* Ensure failure to cleanup the mount directory causes non-zero exit status
---
lib/Sys/VirtV2V/Target/RHEV.pm | 21 ++++++++++-----------
1 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/lib/Sys/VirtV2V/Target/RHEV.pm b/lib/Sys/VirtV2V/Target/RHEV.pm
index 65800cd..b80c66a 100644
--- a/lib/Sys/VirtV2V/Target/RHEV.pm
+++ b/lib/Sys/VirtV2V/Target/RHEV.pm
@@ -476,21 +476,20 @@ sub DESTROY
my $eh = Sys::VirtV2V::ExecHelper->run('umount', $self->{mountdir});
if ($eh->status() != 0) {
- print STDERR user_message(__x("Failed to unmount {path}. Command ".
- "exited with status {status}. Output ".
- "was: {output}",
- path => $self->{domain_path},
- status => $eh->status(),
- output => $eh->output()));
+ warn user_message(__x("Failed to unmount {path}. Command exited with
".
+ "status {status}. Output was: {output}",
+ path => $self->{domain_path},
+ status => $eh->status(),
+ output => $eh->output()));
# Exit with an error if the child failed.
$retval ||= $eh->status();
}
- rmdir($self->{mountdir})
- or print STDERR user_message(__x("Failed to remove mount directory ".
- "{dir}: {error}",
- dir => $self->{mountdir},
- error => $!));
+ unless (rmdir($self->{mountdir})) {
+ warn user_message(__x("Failed to remove mount directory {dir}:
{error}",
+ dir => $self->{mountdir}, error => $!));
+ $retval ||= 1;
+ }
$? = $retval;
}
--
1.7.0.1