Skip to content

Commit

Permalink
Rebase and fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rikatz committed Dec 12, 2023
1 parent 64bdfec commit 60a02dd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/services/govmomi/clustermodules/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package clustermodules

import (
"context"
"fmt"
"net/http"
"strings"

"github.com/vmware/govmomi/vapi/cluster"
Expand Down Expand Up @@ -91,11 +93,12 @@ func (cm *provider) DoesModuleExist(ctx context.Context, moduleUUID string, clus

_, err := cm.manager.ListModuleMembers(ctx, moduleUUID)
if err == nil {
log.V(4).Info("Cluster module exists", "moduleUUID", moduleUUID)
return true, nil
}

// Is there a better way of unwrap vAPI errors?
if strings.Contains(err.Error(), "404 Not Found") {
if strings.Contains(err.Error(), fmt.Sprintf("%d %s", http.StatusNotFound, http.StatusText(http.StatusNotFound))) {
log.V(4).Info("Cluster module doesn't exist", "moduleUUID", moduleUUID)
return false, nil

Check warning on line 103 in pkg/services/govmomi/clustermodules/provider.go

View check run for this annotation

Codecov / codecov/patch

pkg/services/govmomi/clustermodules/provider.go#L101-L103

Added lines #L101 - L103 were not covered by tests
}
Expand Down

0 comments on commit 60a02dd

Please sign in to comment.