Skip to content

Commit

Permalink
Azure userattr nil fix (#269)
Browse files Browse the repository at this point in the history
* Ensuring userAttribute value is not nil

* Adding preliminary logging
  • Loading branch information
lbac-redhat committed Mar 18, 2023
1 parent 173c213 commit 5534fa1
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pkg/syncer/azure.go
Expand Up @@ -433,7 +433,14 @@ func (a *AzureSyncer) isUsernamePresent(value reflect.Value, field string) (stri
method := value.MethodByName(fmt.Sprintf("Get%s", caser.String(field)))

if method.IsValid() {
return fmt.Sprintf("%s", method.Call(nil)[0].Elem().Interface()), true

attr := method.Call(nil)[0]

if !attr.IsNil() {
return fmt.Sprintf("%s", attr.Elem().Interface()), true
} else {
azureLogger.Info(fmt.Sprintf("Warning: Skipping User record with empty %s.", field))
}
}

return "", false
Expand Down

0 comments on commit 5534fa1

Please sign in to comment.