Skip to content

Commit

Permalink
improve Inventory error messages when device not in inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
tmunzer committed Aug 28, 2024
1 parent 5de9020 commit b195548
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions internal/resource_org_inventory/sdk_to_terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package resource_org_inventory

import (
"context"
"fmt"
"strings"

"github.com/tmunzer/mistapi-go/mistapi/models"
Expand Down Expand Up @@ -127,6 +128,16 @@ func SdkToTerraform(ctx context.Context, orgId string, data []models.Inventory,
} else if dev_from_mist, ok := devices_tmp[mac]; ok {
checkVcSiteId(&dev_from_mist, vcmac_to_site)
devices_out = append(devices_out, dev_from_mist)
} else if magic != "" {
diags.AddError(
"Device not in the Org Inventory",
fmt.Sprintf("Device with Claim Code %s is not in the Org Inventory", magic),
)
} else {
diags.AddError(
"Device not in the Org Inventory",
fmt.Sprintf("Device with MAC Address %s is not in the Org Inventory", mac),
)
}
}
}
Expand Down

0 comments on commit b195548

Please sign in to comment.