#+begin_src cfengine3
bundle agent __main__
{
  files:
    "/tmp/example-edit.empty_before_use.one" create => "true";
    "/tmp/example-edit.empty_before_use.two" create => "true";

    "/tmp/example-edit.empty_before_use.one"
      edit_line => show_edit_empty_before_use,
      edit_defaults => my_empty_file_before_editing;

    "/tmp/example-edit.empty_before_use.two"
      edit_line => show_edit_empty_before_use;
}

bundle edit_line show_edit_empty_before_use
{
  reports:
    "$(with)"
      with => concat(
        "The promise to edit '$(edit.filename)' was ",
        "instructed to ignore any pre-existing content."
      ),
      if => strcmp("true", "$(edit.empty_before_use)");

    "$(with)"
      with => concat(
        "The promise to edit '$(edit.filename)' was ",
        "not instructed to ignore any pre-existing content."
      ),
      if => strcmp("false", "$(edit.empty_before_use)");

    "$(with)"
      with => concat(
        "This version of CFEngine does not know if the",
        "edit operation is expected to ignore pre-existing ",
        "content the variable 'edit.empty_before_use' does ",
        "not exist"
      ),
      unless => isvariable("edit.empty_before_use");
}

body edit_defaults my_empty_file_before_editing
{
  empty_file_before_editing => "true"; # The variable
  # edit.empty_before_use allows this
  # to be known from within an
  # edit_line bundle.
}

#+end_src
###############################################################################
#+begin_src example_output
#@ ```
#@ R: The promise to edit '/tmp/example-edit.empty_before_use.one' was instructed to ignore any pre-existing content.
#@ R: The promise to edit '/tmp/example-edit.empty_before_use.two' was not instructed to ignore any pre-existing content.
#@ ```
#+end_src
