@@ -729,7 +729,8 @@ static PromiseResult RenderTemplateCFEngine(EvalContext *ctx,
729
729
const Rlist * bundle_args ,
730
730
const Attributes * attr ,
731
731
EditContext * edcontext ,
732
- bool file_exists )
732
+ bool file_exists ,
733
+ bool * save_file )
733
734
{
734
735
assert (edcontext != NULL );
735
736
assert (attr != NULL );
@@ -754,7 +755,7 @@ static PromiseResult RenderTemplateCFEngine(EvalContext *ctx,
754
755
EvalContextStackPushBundleFrame (ctx , bp , bundle_args , a .edits .inherit );
755
756
BundleResolve (ctx , bp );
756
757
757
- ScheduleEditLineOperations (ctx , bp , & a , pp , edcontext );
758
+ * save_file = ScheduleEditLineOperations (ctx , bp , & a , pp , edcontext );
758
759
759
760
EvalContextStackPopFrame (ctx );
760
761
@@ -965,6 +966,7 @@ PromiseResult ScheduleEditOperation(EvalContext *ctx, char *filename,
965
966
Rlist * args = NULL ;
966
967
char edit_bundle_name [CF_BUFSIZE ], lockname [CF_BUFSIZE ];
967
968
CfLock thislock ;
969
+ bool save_file = true;
968
970
969
971
snprintf (lockname , CF_BUFSIZE - 1 , "fileedit-%s" , filename );
970
972
thislock = AcquireLock (ctx , lockname , VUQNAME , CFSTARTTIME , a -> transaction .ifelapsed , a -> transaction .expireafter , pp , false);
@@ -1067,7 +1069,8 @@ PromiseResult ScheduleEditOperation(EvalContext *ctx, char *filename,
1067
1069
PromiseResult render_result = RenderTemplateCFEngine (ctx , pp ,
1068
1070
args , a ,
1069
1071
edcontext ,
1070
- file_exists );
1072
+ file_exists ,
1073
+ & save_file );
1071
1074
result = PromiseResultUpdate (result , render_result );
1072
1075
}
1073
1076
}
@@ -1099,7 +1102,7 @@ PromiseResult ScheduleEditOperation(EvalContext *ctx, char *filename,
1099
1102
}
1100
1103
1101
1104
exit :
1102
- FinishEditContext (ctx , edcontext , a , pp , & result );
1105
+ FinishEditContext (ctx , edcontext , a , pp , & result , save_file );
1103
1106
YieldCurrentLock (thislock );
1104
1107
if (result == PROMISE_RESULT_CHANGE )
1105
1108
{
0 commit comments