Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
[HOTFIX] Fix status report for self-referenced formation assignment (#…
Browse files Browse the repository at this point in the history
…3588)

* Fix status report for self-referenced formation assignment (#3583)

* only unassign target if it is different from source

* bump values.yaml

* add comment

* bump director PR version
  • Loading branch information
ivantenevvasilev authored Jan 18, 2024
1 parent 254c5fa commit 1da6b7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chart/compass/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ global:
version: "v20240112-68df17f1"
name: compass-pairing-adapter
director:
dir: prod/incubator/
version: "v20240116-203cb8cb"
dir: dev/incubator/
version: "PR-3588"
name: compass-director
hydrator:
dir: prod/incubator/
Expand Down
8 changes: 6 additions & 2 deletions components/director/internal/formationmapping/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,12 @@ func (h *Handler) processFormationUnassign(ctx context.Context, formation *model
return errors.Wrapf(err, "while unassigning object with type: %q and ID: %q", fa.SourceType, fa.Source)
}

if err = h.unassignObjectFromFormationWhenThereAreNoFormationAssignments(unassignCtx, fa, formation, fa.Target, fa.TargetType); err != nil {
return errors.Wrapf(err, "while unassigning object with type: %q and ID: %q", fa.TargetType, fa.Target)
// Skip second unassign from formation in case the formation assignment is self-referenced one,
// and if happened to be the last one. It will be handled above.
if fa.Source != fa.Target {
if err = h.unassignObjectFromFormationWhenThereAreNoFormationAssignments(unassignCtx, fa, formation, fa.Target, fa.TargetType); err != nil {
return errors.Wrapf(err, "while unassigning object with type: %q and ID: %q", fa.TargetType, fa.Target)
}
}

if err = unassignTx.Commit(); err != nil {
Expand Down

0 comments on commit 1da6b7b

Please sign in to comment.