#######################################################
#
# Check that similar command promises are not skipped
# (cf redmine #2182)
#
#######################################################
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

#######################################################
body classes if_touched(x)
{
  visited::
    promise_repaired => { "revisited" };

  !visited::
    promise_repaired => { "visited" };
}

#######################################################
bundle agent init
{
}

#######################################################
bundle agent test
{
  commands:
    "$(G.echo) restart" classes => if_touched("called");

  methods:
    "any" usebundle => call;
}

bundle agent call
{
  commands:
    "$(G.echo) restart" classes => if_touched("called");
}

#######################################################
bundle agent check
{
  classes:
    any::
      "ok" and => { "visited", "revisited" };

  reports:
    DEBUG.visited::
      "visited defined";

    DEBUG.revisited::
      "revisited defined";

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

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