fix(): catch errors and increase verbosity
All checks were successful
Gitea Docker Build Demo / Test (push) Successful in 1m0s
Gitea Docker Build Demo / Build_Image (push) Successful in 1m19s

This commit is contained in:
2025-10-07 10:54:45 +02:00
parent 76fb779d08
commit 60844be81b
2 changed files with 14 additions and 3 deletions

View File

@@ -18,11 +18,17 @@ func GetAllNodes(cfg *Config) ([]*hcloud.Server, error) {
return nil, fmt.Errorf("error listing Hetzner Nodes: %s", err.Error())
}
if servers == nil {
if len(servers) == 0 {
return nil, fmt.Errorf("no Nodes found with label selector: %s", cfg.LabelSelector)
}
return servers, nil
for _, instance := range servers {
log.WithFields(log.Fields{
"Caller": "GetAllNodes",
}).Info(fmt.Sprintf("Found server: %s", instance.Name))
}
return servers, nil
}
func GetAllIps(servers []*hcloud.Server) ([]string, error) {
@@ -33,7 +39,7 @@ func GetAllIps(servers []*hcloud.Server) ([]string, error) {
}
log.WithFields(log.Fields{
"Caller": "GetAllIps",
}).Info(fmt.Sprintf("Found IP: %s", instance.PrivateNet[0].IP.String()))
}).Info(fmt.Sprintf("Found IP: %s", instance.PublicNet.IPv4.IP.String()))
ips[i] = instance.PublicNet.IPv4.IP.String()
}
return ips, nil