# Tests that package upgrade works properly

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

}

bundle agent init
{
  meta:
      # Windows has its own mechanism to list packages, and doesn't use the package body.
      "test_skip_needs_work" string => "windows";

  vars:
      "dummy" string => "dummy";
}

body package_method yum_rpm
{
      package_changes => "individual";
      package_list_command => "$(G.printf) 'which 1 i386'";

      package_list_name_regex    => "^(\S+?)\s\S+?\s\S+$";
      package_list_version_regex => "^\S+?\s(\S+?)\s\S+$";
      package_list_arch_regex    => "^\S+?\s\S+?\s(\S+)$";

      package_installed_regex => ".*";

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

bundle agent test
{
  packages:
      "which"
      package_policy => "addupdate",
      package_select => "==",
      package_version => "2",
      package_method => yum_rpm,
      classes => if_repaired("whichrepaired");
}

bundle agent check
{
  reports:
    whichrepaired::
      "$(this.promise_filename) Pass";
    !whichrepaired::
      "$(this.promise_filename) FAIL";
}
### PROJECT_ID: core
### CATEGORY_ID: 29
