ansible/ansible — pull request #7061 by 42wim (2014-04-18 21:00:17+00:00)
Title: workaround for no stderr of yum errors in RHEL5 and state=present/state=latest

Yum in RHEL5 doesn't output errors to stderr but to stdout (RHEL6 works correctly).
This gives some issues for functions that check if stdout is empty or not to determine if a package is available or not.
This simple patch fixes this issue in RHEL5 by checking if the stdout result contains the package name itself and not some random error.

Tested on RHEL5.10 and RHEL6.5
Apparently this sending errors/'info' to stdout will also be in RHEL7:
https://bugzilla.redhat.com/show_bug.cgi?id=1017354

To reproduce the issue, e.g an error where we have duplicate yum repos:
RHEL5 #; /usr/bin/repoquery --show-duplicates --plugins --quiet -q --disablerepo=* --pkgnarrow=installed --qf %{name}-%{version}-%{release}.%{arch} --whatprovides httpd > /tmp/abc
RHEL5 #; cat /tmp/abc
Repository epel is listed more than once in the configuration
httpd-2.2.3-85.el5_10.x86_64
RHEL6 #

RHEL6 # /usr/bin/repoquery --show-duplicates --plugins --quiet -q --disablerepo=* --pkgnarrow=installed --qf %{name}-%{version}-%{release}.%{arch} --whatprovides httpd > /tmp/abc
Repository epel is listed more than once in the configuration
RHEL6 # cat /tmp/abc
httpd-2.2.15-30.el6_5.x86_64
RHEL6 #