]> git.proxmox.com Git - pve-storage.git/commitdiff
get_monaddr_list: also ensure that returned 'mon addr' are defined
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 9 Jan 2019 14:23:39 +0000 (15:23 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 9 Jan 2019 14:23:44 +0000 (15:23 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
PVE/CephConfig.pm

index aad2701be04aaf9b9f8b8d9c01a7f7769ed35e40..1719b8b5ba04e66e8224cbb35234900eba4318fd 100644 (file)
@@ -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 {