Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
Signed-off-by: kranurag7 <[email protected]>
  • Loading branch information
kranurag7 committed Apr 2, 2024
1 parent 972f7d2 commit 1fc5069
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions pkg/services/hcloud/remediation/remediation.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ func (s *Service) handlePhaseRunning(ctx context.Context, server *hcloud.Server)
if err := s.scope.HCloudClient.RebootServer(ctx, server); err != nil {
hcloudutil.HandleRateLimitExceeded(s.scope.HCloudMachine, err, "RebootServer")
record.Warn(s.scope.HCloudRemediation, "FailedRebootServer", err.Error())
return reconcile.Result{}, fmt.Errorf("failed to reboot server %s with ID %v: %w", server.Name, server.ID, err)
return reconcile.Result{}, fmt.Errorf("failed to reboot server %s with ID %d: %w", server.Name, server.ID, err)
}
record.Event(s.scope.HCloudRemediation, "ServerRebooted", "Server has been rebooted")

Expand Down Expand Up @@ -124,7 +124,7 @@ func (s *Service) handlePhaseRunning(ctx context.Context, server *hcloud.Server)
if err := s.scope.HCloudClient.RebootServer(ctx, server); err != nil {
hcloudutil.HandleRateLimitExceeded(s.scope.HCloudMachine, err, "RebootServer")
record.Warn(s.scope.HCloudRemediation, "FailedRebootServer", err.Error())
return reconcile.Result{}, fmt.Errorf("failed to reboot server %s with ID %v: %w", server.Name, server.ID, err)
return reconcile.Result{}, fmt.Errorf("failed to reboot server %s with ID %d: %w", server.Name, server.ID, err)
}
record.Event(s.scope.HCloudRemediation, "ServerRebooted", "Server has been rebooted")

Expand Down
12 changes: 6 additions & 6 deletions pkg/services/hcloud/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ func (s *Service) reconcileLoadBalancerAttachment(ctx context.Context, server *h
record.Eventf(
s.scope.HetznerCluster,
"AddedAsTargetToLoadBalancer",
"Added new server %s with ID %d to the loadbalancer %s with ID %v",
"Added new server %s with ID %d to the loadbalancer %s with ID %d",
server.Name, server.ID, s.scope.HetznerCluster.Spec.ControlPlaneLoadBalancer.Name, s.scope.HetznerCluster.Status.ControlPlaneLoadBalancer.ID)

return reconcile.Result{}, nil
Expand Down Expand Up @@ -507,7 +507,7 @@ func (s *Service) getServerImage(ctx context.Context) (*hcloud.Image, error) {
images = append(images, imagesByName...)

if len(images) > 1 {
err := fmt.Errorf("image is ambiguous - %v images have name %s", len(images), s.scope.HCloudMachine.Spec.ImageName)
err := fmt.Errorf("image is ambiguous - %d images have name %s", len(images), s.scope.HCloudMachine.Spec.ImageName)
record.Warnf(s.scope.HCloudMachine, "ImageNameAmbiguous", err.Error())
conditions.MarkFalse(s.scope.HCloudMachine,
infrav1.ServerCreateSucceededCondition,
Expand Down Expand Up @@ -631,13 +631,13 @@ func (s *Service) deleteServerOfLoadBalancer(ctx context.Context, server *hcloud
if strings.Contains(err.Error(), "load_balancer_target_not_found") {
return nil
}
return fmt.Errorf("failed to delete server %s with ID %v as target of load balancer %s with ID %v: %w", server.Name, server.ID, lb.Name, lb.ID, err)
return fmt.Errorf("failed to delete server %s with ID %d as target of load balancer %s with ID %d: %w", server.Name, server.ID, lb.Name, lb.ID, err)
}
record.Eventf(
s.scope.HetznerCluster,
"DeletedTargetOfLoadBalancer",
"Deleted new server with id %d of the loadbalancer %v",
server.ID, lb.ID,
"Deleted new server %s with ID %d of the loadbalancer %s with ID %d",
server.Name, server.ID, lb.Name, lb.ID,
)

return nil
Expand Down Expand Up @@ -673,7 +673,7 @@ func (s *Service) findServer(ctx context.Context) (*hcloud.Server, error) {
}

if len(servers) > 1 {
err := fmt.Errorf("found %v servers with name %s", len(servers), s.scope.Name())
err := fmt.Errorf("found %d servers with name %s", len(servers), s.scope.Name())
record.Warnf(s.scope.HCloudMachine, "MultipleInstances", err.Error())
return nil, err
}
Expand Down

0 comments on commit 1fc5069

Please sign in to comment.