Skip to content

Commit 0b08164

Browse files
committed
fix zone naming
1 parent f05d69e commit 0b08164

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

internal/provider/hypervisor/libvirt.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,15 @@ func buildDialers(log *zap.Logger, config *config.Config) []*ZonedDialer {
8080
}
8181
return &ZonedDialer{Dialer: dialer}
8282
}
83-
dialers := make([]*ZonedDialer, len(config.Zone.Zones)+1)
84-
dialers[0] = buildDialer(config.LibvirtEndpoint)
85-
for idx, zone := range config.Zone.Zones {
86-
dialers[idx+1] = buildDialer(zone.LibvirtEndpoint)
87-
dialers[idx+1].Zone = zone.Name
83+
if len(config.Zone.Zones) > 0 {
84+
dialers := make([]*ZonedDialer, len(config.Zone.Zones))
85+
for idx, zone := range config.Zone.Zones {
86+
dialers[idx] = buildDialer(zone.LibvirtEndpoint)
87+
dialers[idx].Zone = zone.Name
88+
}
89+
return dialers
8890
}
89-
return dialers
91+
return []*ZonedDialer{{Dialer: buildDialer(config.LibvirtEndpoint)}}
9092
}
9193

9294
func (h *Hypervisors) Zone(zone string) (*libvirt.Libvirt, error) {

0 commit comments

Comments
 (0)