(FACT-481) Infinite loop when EC2 metadata server times out

The retry loop for contacting the EC2 metadata server failed to increment the
attempt counter on each iteration, as the 'ensure' block only executes once
the entire begin/rescue block has been completed, not on each retry.