#######################################################
#
# Test delete a package that does not exist
#
#######################################################

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

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

bundle agent init
{
  vars:
      "dummy" string => "dummy";
}

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

bundle agent test
{
  packages:
      "nosuchpackageinstalled"
      package_method => mock_warn_delete_pkg,
      package_policy => "delete",
      classes => kept_repaired_notkept("kept", "repaired", "notkept");
}

body package_method mock_warn_delete_pkg
{
      package_changes => "individual";

      package_list_command => "$(G.printf) 'bash-4.2.8-x86_64'";

      package_list_name_regex => "^([^-]+)";
      package_list_version_regex => "^[^-]+-([^-]+)";
      package_list_arch_regex => "^[^-]+-[^-]+-(.*)";
      package_installed_regex => ".*";

      package_add_command => "$(G.false)";
      package_update_command => "$(G.false)";
      package_delete_command => "$(G.true)";
      package_verify_command => "$(G.false)";
}

body classes kept_repaired_notkept(kept, repaired, notkept)
{
      promise_kept => { "$(kept)" };
      promise_repaired => { "$(repaired)" };
      repair_failed    => { "$(notkept)" };
}

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

bundle agent check
{

  reports:
    kept::
      "$(this.promise_filename) Pass";
    !kept::
      "$(this.promise_filename) FAIL";
}
### PROJECT_ID: core
### CATEGORY_ID: 29
