(#12377) Avoid infinite loop when retrying require json
(#12377) Avoid infinite loop when retrying require json

Without this patch an infinite loop will be entered if the json and
rubygems libraries are not available.

This patch fixes the problem by retrying the `require 'json'` only if
rubygems was successfully loaded for the first time.  Subsequent
attempts to load rubygems will cause the LoadError exception from a
missing json library to be re-raised.

Thanks to Krzysztof Wilczynski for pointing out this issue.

fuel-infra/puppetlabs-stdlib,DavidS/puppetlabs-stdlib,puppetlabs/puppetlabs-stdlib,yadavnikhil/puppetlabs-stdlib,jbondpdx/puppetlabs-stdlib,HelenCampbell/puppetlabs-stdlib