Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions bundle/direct/bundle_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,15 +334,11 @@ func prepareChanges(ctx context.Context, adapter *dresources.Adapter, localDiff,
for _, ch := range remoteDiff {
entry := m[ch.Path.String()]
if entry == nil {
// we have difference for remoteState but not difference for localState
// from remoteDiff we can find out remote value (ch.Old) and new config value (ch.New) but we don't know oldState value
oldStateVal, err := structaccess.Get(oldState, ch.Path)
var notFound *structaccess.NotFoundError
if err != nil && !errors.As(err, &notFound) {
log.Debugf(ctx, "Constructing diff: accessing %q on %T: %s", ch.Path, oldState, err)
}
// We have a difference for remoteState but not for localState.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't know that, we can have a difference recorded at different levels.

For example, old->new diff for 'field' and new->remote diff for 'field.subfield'.

See also #4451

It looks like we make the same assumption below for Remote.

// No local diff means oldState == newConfig for this field,
// so ch.New (from newConfig) is also the oldState value.
m[ch.Path.String()] = &deployplan.ChangeDesc{
Old: oldStateVal,
Old: ch.New,
New: ch.New,
Remote: ch.Old,
}
Expand Down