##############################################################################
#
# Redmine #4309: body inheritance with inherit_from
#
##############################################################################
body common control
{
  inputs => { "../../default.sub.cf" };
  bundlesequence => { default("$(this.promise_filename)") };
  version => "1.0";
}

bundle agent init
{
}

bundle common test
{
  reports:
    "test_inherit" classes => classes_generic_inherit("test_inherit");
    "test_nonesuch" classes => classes_generic_nonesuch("test_nonesuch");
    "test_overwrite" classes => classes_generic_overwrite("test_overwrite");
}

body classes classes_generic_inherit(x)
{
  inherit_from => classes_generic($(x));
}

body classes classes_generic_nonesuch(x)
{
  inherit_from => classes_generic_missing_body;
}

# the parent uses $(x) so this tests that inheritance goes from parent to child
body classes classes_generic_overwrite(overwrite_x)
{
  inherit_from => classes_generic($(overwrite_x));
  promise_repaired => {
    "promise_repaired_$(overwrite_x)",
    "$(overwrite_x)_repaired",
    "$(overwrite_x)_ok",
    "$(overwrite_x)_reached",
  };
  repair_failed => {
    "repair_failed_$(overwrite_x)",
    "$(overwrite_x)_failed",
    "$(overwrite_x)_not_ok",
    "$(overwrite_x)_error",
    "$(overwrite_x)_not_kept",
    "$(overwrite_x)_not_repaired",
    "$(overwrite_x)_reached",
  };
  repair_denied => {
    "repair_denied_$(overwrite_x)",
    "$(overwrite_x)_denied",
    "$(overwrite_x)_not_ok",
    "$(overwrite_x)_error",
    "$(overwrite_x)_not_kept",
    "$(overwrite_x)_not_repaired",
    "$(overwrite_x)_reached",
  };
  repair_timeout => {
    "repair_timeout_$(overwrite_x)",
    "$(overwrite_x)_timeout",
    "$(overwrite_x)_not_ok",
    "$(overwrite_x)_error",
    "$(overwrite_x)_not_kept",
    "$(overwrite_x)_not_repaired",
    "$(overwrite_x)_reached",
  };
  promise_kept => {
    "promise_kept_$(overwrite_x)",
    "$(overwrite_x)_kept",
    "$(overwrite_x)_ok",
    "$(overwrite_x)_not_repaired",
    "$(overwrite_x)_reached",
  };
}

bundle agent check
{
  methods:
    ""
      usebundle => dcs_passif_expected(
        "test_inherit_ok,test_overwrite_ok",
        "test_nonesuch_ok",
        $(this.promise_filename)
      ),
      inherit => "true";
}
