Skip to content

Commit

Permalink
NO-ISSUE: Fix email domain for event uploader (#5511)
Browse files Browse the repository at this point in the history
Email domain was set to Unknown by default for
clusters. This modifies the check for that and
ensures it's set to an actual email domain for
on-prem event uploading.
  • Loading branch information
CrystalChun committed Sep 26, 2023
1 parent 81a2d67 commit 932f8e0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
7 changes: 1 addition & 6 deletions internal/uploader/auth_utils.go
@@ -1,7 +1,6 @@
package uploader

import (
"net/mail"
"strings"

"github.com/openshift/assisted-service/internal/cluster/validations"
Expand Down Expand Up @@ -51,11 +50,7 @@ func getOCMPullSecret(k8sclient k8sclient.K8SClient) (string, bool) {
}

func getEmailDomain(email string) string {
addr, err := mail.ParseAddress(email)
if err != nil {
return ""
}
parts := strings.Split(addr.Address, "@")
parts := strings.Split(email, "@")
if len(parts) < 2 {
return ""
}
Expand Down
2 changes: 1 addition & 1 deletion internal/uploader/events_uploader.go
Expand Up @@ -183,7 +183,7 @@ func eventsFile(ctx context.Context, clusterID *strfmt.UUID, eventsHandler event
func clusterFile(tw *tar.Writer, cluster *common.Cluster, pullSecret *validations.PullSecretCreds) error {
if cluster != nil && cluster.ID != nil {
// To distinguish who is uploading the data
if cluster.EmailDomain == "" {
if cluster.EmailDomain == "" || cluster.EmailDomain == "Unknown" {
cluster.EmailDomain = getEmailDomain(pullSecret.Email)
}
if cluster.UserName == "" {
Expand Down

0 comments on commit 932f8e0

Please sign in to comment.