Fixes #7137, Credit to @MiLk for identifing some key areas. 

tested on Centos 5,6, Oracle 6, Scientific Linux 6. Used present, absent, latest, with --enablerepo and --disablererepo.