bundle common test_meta
{
  vars:
    "description" string => "A user present does not get the home bundle run";
    "story_id" string => "5525";
    "covers" string => "operational_repaired";
}

#######################################################
body common control
{
  inputs => { "../../default.sub.cf", "user_queries.cf.sub" };
  bundlesequence => { default("$(this.promise_filename)") };
}

#######################################################
bundle agent init
{
  users:
    "johndoe" policy => "present";
}

#######################################################
bundle agent test
{
  users:
    "johndoe"
      policy => "present",
      home_bundle => home_bundle("/home/johndoe");
}

bundle agent home_bundle(x)
{
  files:
    "$(G.testfile)"
      create => "true",
      edit_line => home_edit("$(x)");
}

bundle edit_line home_edit(x)
{
  insert_lines:
    "$(x)";
}

#######################################################
bundle agent check
{
  classes:
    "ok"
      expression => strcmp(
        "0", countlinesmatching("/home/johndoe", "$(G.testfile)")
      );

  reports:
    ok::
      "$(this.promise_filename) Pass";

    !ok::
      "$(this.promise_filename) FAIL";
}
