#######################################################
#
# Test command useshell parameters
#
#######################################################

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

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

bundle agent init
{
  vars:
      "origtestdir" string => dirname("$(this.promise_filename)");

      "shelltypes" slist => { "useshell_true",
                              "useshell_false",
                              "useshell_yes",
                              "useshell_no",
                              "useshell_on",
                              "useshell_off",
                              "useshell_noshell",
                              "useshell_useshell",
                              "useshell_powershell"
      };
}

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

bundle agent test
{
  meta:
      "test_soft_fail" string => "windows",
        meta => { "ENT-10257" };
  classes:
      "$(init.shelltypes)" expression => regcmp(".*(Succeeded|Powershell is only supported on Windows).*", execresult("$(sys.cf_agent) -D $(init.shelltypes) -Kf $(init.origtestdir)$(const.dirsep)tryshell.cf.sub", "noshell"));

      "ok" and => { "@(init.shelltypes)" };

  vars:
    ok::
      "ok" string => "ok";

  reports:
    DEBUG::
      "$(init.shelltypes) test failed"
      if => "!$(init.shelltypes)";
}

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

bundle agent check
{
  classes:
      "ok" expression => strcmp("$(test.ok)", "ok");

  reports:
    DEBUG::
      "Tests powershell in commands promises.";
    ok::
      "$(this.promise_filename) Pass";
    !ok::
      "$(this.promise_filename) FAIL ";
}

### PROJECT_ID: core
### CATEGORY_ID: 26
