]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
qa/tasks/radosgw_admin: use HTTPMessage as a dict in PY3
authorKefu Chai <kchai@redhat.com>
Mon, 6 Apr 2020 06:52:02 +0000 (14:52 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 3 Jun 2020 11:56:59 +0000 (19:56 +0800)
in Python3, HTTPMessage is a dict-like class by itself, and it does not
offer `dict` attribute anymore.

Signed-off-by: Kefu Chai <kchai@redhat.com>
(cherry picked from commit 4a9c43313acbd26d33364a43b2835e561ceb259b)

qa/tasks/radosgw_admin.py

index b8e6008ce3ef1717d2fbbf5b14b4dcfabc6bfa3d..fbe76582a4c4bced14de7c4a5ccb3160dd6b9975 100644 (file)
@@ -215,8 +215,9 @@ class requestlog_queue():
             if 'Content-Length' in j['o'].headers:
                 bytes_out = int(j['o'].headers['Content-Length'])
             bytes_in = 0
-            if 'content-length' in j['i'].msg.dict:
-                bytes_in = int(j['i'].msg.dict['content-length'])
+            msg = j['i'].msg if six.PY3 else j['i'].msg.dict
+            if 'content-length'in msg:
+                bytes_in = int(msg['content-length'])
             log.info('RL: %s %s %s bytes_out=%d bytes_in=%d failed=%r'
                      % (cat, bucket, user, bytes_out, bytes_in, j['e']))
             if add_entry == None: