CephTools: improve abs_path error handling

verify_blockdev_path didn't check the result of abs_path
causing commands like `pveceph createosd bad/path` to error
with a meaningless "Use of uninitialized value" message.
This commit is contained in:
Wolfgang Bumiller 2015-09-25 09:41:40 +02:00 committed by Dietmar Maurer
parent 735df8e5d1
commit 7fabddca05

View File

@ -43,9 +43,11 @@ sub get_config {
} }
sub verify_blockdev_path { sub verify_blockdev_path {
my ($path) = @_; my ($rel_path) = @_;
$path = abs_path($path); die "missing path" if !$rel_path;
my $path = abs_path($rel_path);
die "failed to get absolute path to $rel_path" if !$path;
die "got unusual device path '$path'\n" if $path !~ m|^/dev/(.*)$|; die "got unusual device path '$path'\n" if $path !~ m|^/dev/(.*)$|;