commit b00df2969698dca789bbc42adc4331308b2db753 Author: Tim Burke Date: Fri Sep 11 11:46:00 2020 -0700 py3: Fix swift-dispersion-populate We fixed swift-dispersion-report already; -populate needed the same fix or else it'd hit a "maximum recursion depth exceeded" error. Change-Id: I2d22e087a88c9e8003621feb26460ab6e5ce2a57 Related-Change: I24f4bcc3d62dc37fd9559032bfd25f5b15f98745 Closes-Bug: #1895346 Related-Bug: #1863680 (cherry picked from commit 5b8073c7703c42a0b2b07536cd84e16ebf811b04) diff --git a/bin/swift-dispersion-populate b/bin/swift-dispersion-populate index d051630..a54c77e 100755 --- a/bin/swift-dispersion-populate +++ b/bin/swift-dispersion-populate @@ -27,10 +27,6 @@ import six from six.moves import range from six.moves.configparser import ConfigParser -try: - from swiftclient import get_auth -except ImportError: - from swift.common.internal_client import get_auth from swift.common.internal_client import SimpleClient from swift.common.ring import Ring from swift.common.utils import compute_eta, get_time_units, config_true_value @@ -88,6 +84,11 @@ def report(success): if __name__ == '__main__': global begun, created, item_type, next_report, need_to_create, retries_done patcher.monkey_patch() + try: + # Delay importing so urllib3 will import monkey-patched modules + from swiftclient import get_auth + except ImportError: + from swift.common.internal_client import get_auth conffile = '/etc/swift/dispersion.conf'