Skip to content

Commit

Permalink
Updated the internal id check.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdas-infoblox committed Mar 6, 2024
1 parent 78a681b commit ab8b65c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions object_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"regexp"
"strings"
)

// Compile-time interface checks
Expand Down Expand Up @@ -558,7 +559,7 @@ func (objMgr *ObjectManager) SearchObjectByAltId(
if ref != "" {
// Fetching object by reference
if err := objMgr.connector.GetObject(recordType, ref, NewQueryParams(false, nil), &res); err != nil {
if _, ok := err.(*NotFoundError); !ok || internalId == "" {
if _, ok := err.(*NotFoundError); !ok {
return nil, err
}
}
Expand Down Expand Up @@ -593,7 +594,7 @@ func (objMgr *ObjectManager) SearchObjectByAltId(
// validateObjByInternalId validates the object by comparing the given internal with the object's internal id
func validateObjByInternalId(res interface{}, internalId, eaNameForInternalId string) (bool, error) {
var success bool
if res == nil {
if res == nil || strings.TrimSpace(internalId) == "" {
return success, nil
}
byteObj, err := json.Marshal(res)
Expand Down

0 comments on commit ab8b65c

Please sign in to comment.