Skip to content

Commit

Permalink
Merge pull request RedHatInsights#2443 from loadtheaccumulator/devupd…
Browse files Browse the repository at this point in the history
…ate_svcacct_user

fix empty Principal when using service account
  • Loading branch information
loadtheaccumulator authored Mar 6, 2024
2 parents d9f3c18 + adb7cf5 commit 9008e1b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/services/updates.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,18 @@ func (s *UpdateService) CreateUpdate(id uint) (*models.UpdateTransaction, error)
for _, device := range update.Devices {
device := device // this will prevent implicit memory aliasing in the loop
// Create new &DispatcherPayload{}
principal := identity.User.Username
if len(identity.User.Username) == 0 {
// FIXME: identity.ServiceAccount.Username when middleware identity v2.0 is prod, until then use update.OrgId
principal = update.OrgID
}

payloadDispatcher := playbookdispatcher.DispatcherPayload{
Recipient: device.RHCClientID,
PlaybookURL: playbookURL,
OrgID: update.OrgID,
PlaybookName: "Edge-management",
Principal: identity.User.Username,
Principal: principal,
}
s.log.WithField("playbook_dispatcher", payloadDispatcher).Debug("Calling playbook dispatcher")
exc, err := s.PlaybookClient.ExecuteDispatcher(payloadDispatcher)
Expand Down

0 comments on commit 9008e1b

Please sign in to comment.