Skip to content

Commit 5a945a1

Browse files
committed
Properly handle promise locking with edit line
Fixed bug causing rendered files can result in erroneously empty files as a result of promise locking. Ticket: ENT-9980 Changelog: Commit Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
1 parent a5dd749 commit 5a945a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cf-agent/verify_files.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,8 @@ static PromiseResult RenderTemplateCFEngine(EvalContext *ctx,
754754
EvalContextStackPushBundleFrame(ctx, bp, bundle_args, a.edits.inherit);
755755
BundleResolve(ctx, bp);
756756

757-
ScheduleEditLineOperations(ctx, bp, &a, pp, edcontext);
757+
result = ScheduleEditLineOperations(ctx, bp, &a, pp, edcontext)
758+
? PROMISE_RESULT_CHANGE : PROMISE_RESULT_SKIPPED;
758759

759760
EvalContextStackPopFrame(ctx);
760761

@@ -1014,7 +1015,8 @@ PromiseResult ScheduleEditOperation(EvalContext *ctx, char *filename,
10141015

10151016
BundleResolve(ctx, bp);
10161017

1017-
ScheduleEditLineOperations(ctx, bp, a, pp, edcontext);
1018+
result = ScheduleEditLineOperations(ctx, bp, a, pp, edcontext)
1019+
? PROMISE_RESULT_CHANGE : PROMISE_RESULT_SKIPPED;
10181020

10191021
EvalContextStackPopFrame(ctx);
10201022
}

0 commit comments

Comments
 (0)