Project

General

Profile

Bug #24779

Updated by Nathan Cutler over 5 years ago

In a number of places, the Ceph Python bindings use the @iteritems@ method, which in Python 3 gives errors like:

<pre>g1:/var/log/ceph # ceph balancer status
Error EIO: Module 'balancer' has experienced an error and cannot handle commands: 'dict' object has no attribute 'iteritems'
</pre>

In order to make the code compatible with Python 3, these instances of @iteritems@ need to be changed to @items@, subject to the caveat that, in Python 2, @items@ does not produce an iterator. If the code demands an iterator, the iteritems function from six Kefu's method could be used since ceph-mgr already brings in six as a dependency (indirectly via bcrypt). used:

<pre>
try:
iteritems = dict.iteritems
except:
iteritems = dict.items
</pre>


Backporting note: include https://github.com/ceph/ceph/commit/5f892430462 in the backport

Back