Skip to content

Commit

Permalink
[minor_changes] Fixing adding site, after manually changing it to unm…
Browse files Browse the repository at this point in the history
…anaged.
  • Loading branch information
anvitha-jain committed Jul 24, 2023
1 parent dea6882 commit 320bd26
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 0 additions & 2 deletions mso/resource_mso_site.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func resourceMSOSite() *schema.Resource {
"location": &schema.Schema{
Type: schema.TypeMap,
Optional: true,
Computed: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{

Expand Down Expand Up @@ -103,7 +102,6 @@ func resourceMSOSite() *schema.Resource {
"maintenance_mode": &schema.Schema{
Type: schema.TypeBool,
Optional: true,
Computed: true,
Default: false,
},

Expand Down
3 changes: 2 additions & 1 deletion mso/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"strings"

"github.com/ciscoecosystem/mso-go-client/container"
"github.com/ciscoecosystem/mso-go-client/models"
"github.com/hashicorp/terraform-plugin-sdk/helper/schema"
)

Expand All @@ -21,7 +22,7 @@ func toStringList(configured interface{}) []string {

func errorForObjectNotFound(err error, dn string, con *container.Container, d *schema.ResourceData) error {
if err != nil {
if con.S("code").String() == "404" || strings.HasSuffix(err.Error(), "not found") {
if con.S("code").String() == "404" || strings.HasSuffix(err.Error(), "not found") || strings.HasSuffix(models.StripQuotes(con.S("error").String()), "no documents in result") {
log.Printf("[WARN] %s, removing from state: %s", err, dn)
d.SetId("")
return nil
Expand Down

0 comments on commit 320bd26

Please sign in to comment.