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
This commit is contained in:
Tim Burke 2020-09-11 11:46:00 -07:00 committed by Tim Burke
parent 4fefdf4d83
commit 5b8073c770

View File

@ -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'