get_monaddr_list: also ensure that returned 'mon addr' are defined
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
@ -99,17 +99,16 @@ my $ceph_get_key = sub {
|
|||||||
sub get_monaddr_list {
|
sub get_monaddr_list {
|
||||||
my ($configfile) = shift;
|
my ($configfile) = shift;
|
||||||
|
|
||||||
my $server;
|
|
||||||
|
|
||||||
if (!defined($configfile)) {
|
if (!defined($configfile)) {
|
||||||
warn "No ceph config specified\n";
|
warn "No ceph config specified\n";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $config = $parse_ceph_file->($configfile);
|
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 {
|
sub hostlist {
|
||||||
|
|||||||
Reference in New Issue
Block a user