Skip to content

Commit

Permalink
lint fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mahesh-hpe committed Nov 24, 2023
1 parent 243b995 commit bfc947b
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion internal/acceptance_test/data_source_edge_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
package acceptancetest

import (
"context"
"testing"

api_client "github.com/HewlettPackard/hpegl-vmaas-cmp-go-sdk/pkg/client"
Expand Down Expand Up @@ -31,7 +32,7 @@ func TestAccDataSourceNetworkEdgeCluster(t *testing.T) {
if len(ServerResp.NetworkServices) == 0 {
return nil, err
}
nsxType, err := cmp.GetNsxTypeFromCMP(iClient.Client)
nsxType, err := cmp.GetNsxTypeFromCMP(context.Background(), iClient.Client)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/data_source_lb_pool_member_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (n *poolMemberGroupds) Read(ctx context.Context, d *utils.Data, meta interf
if err := d.Error(); err != nil {
return err
}
nsxType, err := GetNsxTypeFromCMP(n.rClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, n.rClient.Client)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/dhcp_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (dhcp *dhcpServer) Delete(ctx context.Context, d *utils.Data, meta interfac
func (dhcp *dhcpServer) dhcpServerAlignRequest(ctx context.Context, meta interface{},
createReq *models.CreateNetworkDhcpServerRequest) error {
// Get network service ID
nsxType, err := GetNsxTypeFromCMP(dhcp.rClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, dhcp.rClient.Client)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/dhcp_server_datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (n *dhcpServerds) Read(ctx context.Context, d *utils.Data, meta interface{}
if err := d.Error(); err != nil {
return err
}
nsxType, err := GetNsxTypeFromCMP(n.rClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, n.rClient.Client)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/edge_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func newEdgeCluster(tClient *client.RouterAPIService) *edgeCluster {
}

func (r *edgeCluster) Read(ctx context.Context, d *utils.Data, meta interface{}) error {
nsxType, err := GetNsxTypeFromCMP(r.tClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, r.tClient.Client)
if err != nil {
return err
}
Expand Down
8 changes: 4 additions & 4 deletions internal/cmp/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,21 @@ func ParseVersion(version string) (int, error) {
return sum, nil
}

func GetCmpVersion(apiClient client.APIClientHandler) (int, error) {
func GetCmpVersion(ctx context.Context, apiClient client.APIClientHandler) (int, error) {
c := client.CmpStatus{
Client: apiClient,
}

cmpVersion, err := c.GetCmpVersion(context.Background())
cmpVersion, err := c.GetCmpVersion(ctx)
if err != nil {
return 0, err
}

return ParseVersion(cmpVersion.Appliance.BuildVersion)
}

func GetNsxTypeFromCMP(apiClient client.APIClientHandler) (string, error) {
cmpVersion, err := GetCmpVersion(apiClient)
func GetNsxTypeFromCMP(ctx context.Context, apiClient client.APIClientHandler) (string, error) {
cmpVersion, err := GetCmpVersion(ctx, apiClient)
if err != nil {
return "", err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/loadbalancer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (lb *loadBalancer) Update(ctx context.Context, d *utils.Data, meta interfac

func (lb *loadBalancer) loadBalancerAlignRequest(ctx context.Context, meta interface{},
createReq *models.CreateLoadBalancerRequest) error {
nsxType, err := GetNsxTypeFromCMP(lb.rClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, lb.rClient.Client)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/resource_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ func (r *resNetwork) Read(ctx context.Context, d *utils.Data, meta interface{})
}

func (r *resNetwork) Create(ctx context.Context, d *utils.Data, meta interface{}) error {
nsxType, err := GetNsxTypeFromCMP(r.rClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, r.rClient.Client)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func (r *router) Delete(ctx context.Context, d *utils.Data, meta interface{}) er
}

func (r *router) routerAlignRouterRequest(ctx context.Context, meta interface{}, routerReq *models.CreateRouterRequest) error {
nsxType, err := GetNsxTypeFromCMP(r.rClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, r.rClient.Client)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmp/transport_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func newTransportZone(tClient *client.RouterAPIService) *transportZone {
}

func (r *transportZone) Read(ctx context.Context, d *utils.Data, meta interface{}) error {
nsxType, err := GetNsxTypeFromCMP(r.tClient.Client)
nsxType, err := GetNsxTypeFromCMP(ctx, r.tClient.Client)
if err != nil {
return err
}
Expand Down

0 comments on commit bfc947b

Please sign in to comment.