Merge configs for the same hosts instead of using the last one

This commit is contained in:
Thomas du Boÿs 2023-02-21 19:33:56 +01:00
parent d3a353990b
commit 611b41e7a6
No known key found for this signature in database
GPG key ID: 180961FD5E02E32D

View file

@ -1639,9 +1639,14 @@ sub _read_config {
## allow {host} to be a comma separated list of hosts
foreach my $h (split_by_comma($host)) {
## save a copy of the current globals
$config{$h} = { %locals };
$config{$h}{'host'} = $h;
if ($config{$h}) {
## host already defined, merging configs
$config{$h} = { %{merge($config{$h}, \%locals)} };
} else {
## save a copy of the current globals
$config{$h} = { %locals };
$config{$h}{'host'} = $h;
}
}
}
%passwords = ();