puppetlabs/puppet — pull request #294 by ccaum (2011-12-29 18:06:57+00:00)
Title: (#10837 ) Retry inventory ActiveRecord transaction failure

Previous to this commit, if the ActiveRecord transaction for saving
facts failed do to MySQL deadlock, for example, the transaction would
fail printing a message to the user. This primarily occurred during a
PE agent installation if multiple agent's were being creating
simultaneously.

This commit adds the ability to retry if a ActiveRecord::StatementInvalid
exception is thrown. To accomplish this, this commit ports Cloud
Provisioner's Puppet::CloudPack::Utils#retry_action method to Puppet
core under Puppet::Util::RetryAction#retry_action.

Currently spec tests exist for the retry_action method, however properly
testing ActiveRecord inventory indirector is proving difficult since the
proper way to test it is to throw an expected failure once, then succeed
on a subsequent run.