body file control
{
  inputs => { "$(sys.policy_entry_dirname)/../common.cf.sub" };
}

bundle common testcase
{
  vars:
    "filename" string => "$(this.promise_filename)";
}

bundle agent setup
{
  files:
    "$(G.testfile)"
      edit_xml => xml_insert_tree_nopath("<Root foo='bar'/>"),
      create => "true";
}

bundle agent main
{
  files:
    "$(G.testfile)" edit_xml => xml_delete_attribute("foo", "//Root");
}

bundle agent teardown
{
  reports:
    "Edited file has contents: " printfile => my_cat($(G.testfile));
}

body printfile my_cat(file)
# @brief Report the contents of a file
# @param file The full path of the file to report
{
  file_to_print => "$(file)";
  number_of_lines => "inf";
}

bundle edit_xml xml_insert_tree_nopath(treestring)
{
  insert_tree:
    '$(treestring)';
}

bundle edit_xml xml_delete_attribute(attr, xpath)
{
  delete_attribute:
    "$(attr)" select_xpath => "$(xpath)";
}
