# Check that reports are printed just once (Redmine#3446 https://cfengine.com/dev/issues/3446)
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

bundle agent init
{
}

bundle agent test
{
  vars:
    "subout"
      string => execresult(
        "$(sys.cf_agent) -Kf $(this.promise_filename).sub", "noshell"
      );
}

bundle agent check
{
  # If the output contains the string "ONCE" twice then we fail
  classes:
    "ok" not => regcmp(".*ONCE.*ONCE.*", "$(test.subout)");

  reports:
    DEBUG::
      "$(test.subout)";

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

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

### PROJECT_ID: core
### CATEGORY_ID: 2
