Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: save unchanged but lived resource #107

Merged
Merged
Show file tree
Hide file tree
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
15 changes: 5 additions & 10 deletions pkg/engine/operation/graph/resource_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,8 @@ func (rn *ResourceNode) Execute(operation *opsmodels.Operation) status.Status {
case types.ApplyPreview, types.DestroyPreview:
fillResponseChangeSteps(operation, rn, liveState, predictableState)
case types.Apply, types.Destroy:
switch rn.Action {
case types.Create, types.Delete, types.Update:
s := rn.applyResource(operation, priorState, planedState)
if status.IsErr(s) {
return s
}
case types.UnChange:
log.Infof("PriorAttributes and PlanAttributes are equal.")
default:
return status.NewErrorStatus(fmt.Errorf("unknown action:%s", rn.Action.PrettyString()))
if s = rn.applyResource(operation, priorState, planedState); status.IsErr(s) {
return s
}
default:
return status.NewErrorStatus(fmt.Errorf("unknown operation: %v", operation.OperationType))
Expand Down Expand Up @@ -137,6 +129,9 @@ func (rn *ResourceNode) applyResource(operation *opsmodels.Operation, priorState
if s != nil {
log.Debugf("delete state: %v", s.String())
}
case types.UnChange:
log.Infof("planed resource not update live state")
res = planedState
}
if status.IsErr(s) {
return s
Expand Down
2 changes: 1 addition & 1 deletion pkg/engine/operation/models/operation_context.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (o *Operation) RefreshResourceIndex(resourceKey string, resource *models.Re
case types.Delete:
o.CtxResourceIndex[resourceKey] = nil
o.StateResourceIndex[resourceKey] = nil
case types.Create, types.Update:
case types.Create, types.Update, types.UnChange:
o.CtxResourceIndex[resourceKey] = resource
o.StateResourceIndex[resourceKey] = resource
default:
Expand Down