From 4b3088a0a80afcacff258b5e1e04fb9d78edf60a Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 9 Jan 2019 15:23:39 +0100 Subject: [PATCH] get_monaddr_list: also ensure that returned 'mon addr' are defined Signed-off-by: Thomas Lamprecht --- PVE/CephConfig.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/PVE/CephConfig.pm b/PVE/CephConfig.pm index aad2701..1719b8b 100644 --- a/PVE/CephConfig.pm +++ b/PVE/CephConfig.pm @@ -99,17 +99,16 @@ my $ceph_get_key = sub { sub get_monaddr_list { my ($configfile) = shift; - my $server; - if (!defined($configfile)) { warn "No ceph config specified\n"; return; } my $config = $parse_ceph_file->($configfile); - @$server = sort map { $config->{$_}->{'mon addr'} } grep {/mon\./} %{$config}; - return join(',', @$server); + my @monids = grep { /mon\./ && defined($config->{$_}->{'mon addr'}) } %{$config}; + + return join(',', sort map { $config->{$_}->{'mon addr'} } @monids); }; sub hostlist { -- 2.39.2