#######################################################
#
# Test whether parsing of /etc/issue works on Debian
# (Acceptance test for redmine #2988)
#
#######################################################

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

bundle agent init
{
}

#######################################################

bundle agent test
{
  vars:
    debian::
      "myflavor" string => execresult("/bin/grep Debian.*GNU /etc/issue | /usr/bin/cut -d' ' -f3 | cut -d. -f1 | cut -d/ -f1", "useshell");
}

#######################################################

bundle agent check
{
  classes:
    debian.!ubuntu::
      "ok" expression => strcmp("$(sys.flavor)", "debian_$(test.myflavor)");
    ubuntu::
      "ok" expression => "any";
    !debian::
      "ok" expression => "any";

  reports:
    DEBUG::
      "Compared $(sys.flavor) to debian_$(test.myflavor)";
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL";
}
