Rewrite package.installed to retry when yum fails due to a database lock

* Update utils.execute to automatically retry if the command fails
* Add grep function to do a re.search against text
* Add grepc function to return the number of lines that matched
  re.search

package.installed was having intermittent fails when we tried to use yum
while another yum process had the database locked.