Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
Signed-off-by: Rahul Naren Pujari <rnarenpujari@gmail.com>
  • Loading branch information
rnarenpujari committed Mar 22, 2024
1 parent 3681696 commit 08c05d5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
github.com/hashicorp/terraform-exec v0.16.1 // indirect
github.com/hashicorp/terraform-json v0.13.0 // indirect
github.com/hashicorp/terraform-plugin-go v0.9.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.4.0 // indirect
github.com/hashicorp/terraform-plugin-log v0.4.0
github.com/hashicorp/terraform-registry-address v0.0.0-20210412075316-9b2996cce896 // indirect
github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 // indirect
github.com/hashicorp/yamux v0.0.0-20181012175058-2f1d1f20f75d // indirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@ package dataprotection

import (
"context"
"log"
"net/http"
"strings"
"time"

"github.com/hashicorp/terraform-plugin-log/tflog"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/pkg/errors"
Expand Down Expand Up @@ -65,7 +67,32 @@ func resourceEnableDataProtectionRead(ctx context.Context, data *schema.Resource

config := m.(authctx.TanzuContext)

tflog.Warn(context.Background(), "here1")
log.Print("[WARN] herea1")
err := populateDataFromServer(ctx, config, scopedFullnameData, data)

Check failure on line 72 in internal/resources/dataprotection/resource_enable_data_protection.go

View workflow job for this annotation

GitHub Actions / lint

assignments should only be cuddled with other assignments (wsl)
if err != nil {

Check failure on line 73 in internal/resources/dataprotection/resource_enable_data_protection.go

View workflow job for this annotation

GitHub Actions / lint

only one cuddle assignment allowed before if statement (wsl)
tflog.Warn(context.Background(), "here1.5")
log.Print("[WARN] herea1.5")
tflog.Error(context.Background(), err.Error())
log.Printf("[WARN] %s", err.Error())
if clienterrors.IsNotFoundError(err) {

Check failure on line 78 in internal/resources/dataprotection/resource_enable_data_protection.go

View workflow job for this annotation

GitHub Actions / lint

if statements should only be cuddled with assignments (wsl)
if !helper.IsContextCallerSet(ctx) {
*data = schema.ResourceData{}

return diags
} else if helper.IsDeleteState(ctx) {
// d.SetId("") is automatically called assuming delete returns no errors, but
// it is added here for explicitness.
_ = schema.RemoveFromState(data, m)
return diags
}
}
tflog.Warn(context.Background(), "here1.6")

Check failure on line 90 in internal/resources/dataprotection/resource_enable_data_protection.go

View workflow job for this annotation

GitHub Actions / lint

expressions should not be cuddled with blocks (wsl)
log.Print("[WARN] herea1.6")
return diag.FromErr(err)

Check failure on line 92 in internal/resources/dataprotection/resource_enable_data_protection.go

View workflow job for this annotation

GitHub Actions / lint

return statements should not be cuddled if block has more than two lines (wsl)
}
tflog.Warn(context.Background(), "here2")

Check failure on line 94 in internal/resources/dataprotection/resource_enable_data_protection.go

View workflow job for this annotation

GitHub Actions / lint

expressions should not be cuddled with blocks (wsl)
log.Print("[WARN] herea2")

// remove the existing cluster level resource from state if it is now
// managed at the cluster group level.
Expand All @@ -83,22 +110,6 @@ func resourceEnableDataProtectionRead(ctx context.Context, data *schema.Resource
}
}

if err != nil {
if clienterrors.IsNotFoundError(err) {
if !helper.IsContextCallerSet(ctx) {
*data = schema.ResourceData{}

return diags
} else if helper.IsDeleteState(ctx) {
// d.SetId("") is automatically called assuming delete returns no errors, but
// it is added here for explicitness.
_ = schema.RemoveFromState(data, m)

return diags
}
}
}

return diags
}

Expand Down

0 comments on commit 08c05d5

Please sign in to comment.