##############################################################################
#
# Redmine #3576: cf-promises should not run agent bundles
# NOTE: changed to if --eval-functions=no
#
##############################################################################
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_promises) --eval-functions=no -v -f $(this.promise_filename).sub | $(G.grep) PURPLE",
        "useshell"
      );
}

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

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

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

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