diff --git a/internal/hetzner/hetzneragent.go b/internal/hetzner/hetzneragent.go index 34f947c..f23bd2a 100644 --- a/internal/hetzner/hetzneragent.go +++ b/internal/hetzner/hetzneragent.go @@ -78,7 +78,7 @@ func CreateNewAgent(cfg *config.Config) (*hcloud.Server, error) { labels["ControledBy"] = "WoodpeckerAutoscaler" if err != nil { - return nil, errors.New(fmt.Sprintf("Could not create new Agent: %s", err.Error())) + return nil, errors.New(fmt.Sprintf("Could not parse agent spec: %s", err.Error())) } res, _, err := client.Server.Create(context.Background(), hcloud.ServerCreateOpts{ @@ -93,6 +93,10 @@ func CreateNewAgent(cfg *config.Config) (*hcloud.Server, error) { Labels: labels, }) + if err != nil { + return nil, errors.New(fmt.Sprintf("Could not create new Agent: %s", err.Error())) + } + log.WithFields(log.Fields{ "Caller": "CreateNewAgent", }).Infof("Created new Build Agent %s", res.Server.Name)