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

bundle agent test
{
  meta:
    any::
      "description" -> { "CFE-2698" }
        string => "Order of vars promises shouldn't matter";

  vars:
    any::
      "target_variable" string => "value";

      "vars_promise_which_should_be_skipped"
        string => "value",
        unless => isvariable($(variable_defined_later));

      "variable_defined_later" string => "target_variable";
}

bundle agent check
{
  classes:
    any::
      "not_ok"
        or => { isvariable("test.vars_promise_which_should_be_skipped") };

  reports:
    !not_ok::
      "$(this.promise_filename) Pass";

    not_ok::
      "$(this.promise_filename) FAIL";
}
