Delay importing swiftclient until after monkey-patching
Delay importing swiftclient until after monkey-patching

Commit message below partly copied from nova:

Eventlet monkey patching should be as early as possible

We were seeing infinite recursion opening an ssl socket when running
various combinations of python3, eventlet, and urllib3. It is not
clear exactly what combination of versions are affected, but for
background there is an example of this issue documented here:

https://github.com/eventlet/eventlet/issues/371

The immediate cause in swift's case was that we were calling
eventlet.monkey_patch() after importing swiftclient (which imported
requests, which finally imported urllib3).

We only use the imported function in one place, however; hold off on
importing until we actually need it to ensure that monkey patching
happens first. Note that we *don't* want to monkey-patch at import time,
as we've previously had bugs related to import-time side-effects.

Change-Id: I24f4bcc3d62dc37fd9559032bfd25f5b15f98745
Closes-bug: #1863680
Related-bug: #1380815

openstack/swift,tipabu/swift,tipabu/swift,openstack/swift,swiftstack/swift,openstack/swift,swiftstack/swift,openstack/swift,tipabu/swift,tipabu/swift,swiftstack/swift