@@ -293,7 +293,7 @@ func (r *Context) getDeviationUpdate(ctx context.Context, targetKey storebackend
293293 update := make ([]* sdcpb.Update , 0 , len (deviation .Spec .Deviations ))
294294
295295 for _ , deviation := range deviation .Spec .Deviations {
296- if deviation .Reason == "NOT_APPLIED" {
296+ if deviation .Reason == "NOT_APPLIED" && deviation . CurrentValue != "<nil>" {
297297 path , err := utils .ParsePath (deviation .Path )
298298 if err != nil {
299299 return nil , fmt .Errorf ("deviation path parsing failed forr target %s, path %s invalid" , targetKey .String (), deviation .Path )
@@ -303,18 +303,14 @@ func (r *Context) getDeviationUpdate(ctx context.Context, targetKey storebackend
303303 if err := prototext .Unmarshal ([]byte (deviation .CurrentValue ), val ); err != nil {
304304 log .Error ("deviation proto unmarshal failed" , "key" , targetKey .String (), "path" , deviation .Path , "currentValue" , deviation .CurrentValue )
305305 continue
306- //return nil, fmt.Errorf("create data failed for target %s, val %s invalid", key.String(), deviation.CurrentValue)
307306 }
308307
309- //val, err := parse_value((deviation.CurrentValue))
310- //if err != nil {
311- // return nil, fmt.Errorf("create data failed for target %s, val %s invalid", key.String(), deviation.CurrentValue)
312- //}
313-
314308 update = append (update , & sdcpb.Update {
315309 Path : path ,
316310 Value : val ,
317311 })
312+ } else {
313+ // delete case to be updated with the new protos
318314 }
319315 }
320316 return update , nil
@@ -582,6 +578,7 @@ func (r *Context) SetIntents(
582578 intents := make ([]* sdcpb.TransactionIntent , 0 )
583579 for key , deviation := range deviationsToUpdate {
584580 deviationsToUpdateSet .Insert (key )
581+
585582 update , err := r .getDeviationUpdate (ctx , targetKey , deviation )
586583 if err != nil {
587584 log .Error ("Transaction getDeviationUpdate deviation" , "error" , err .Error ())
0 commit comments