As seen in a few projects that are implementing the upgrade-checkers command goal for Stein, using the oslo_i18n.enable_lazy() hook causes issues with the upgrade check command output:
http://paste.openstack.org/show/734156/
osboxes@osboxes:~/git/searchlight$ tox -e venv -- searchlight-status upgrade check
venv develop-inst-noop: /home/osboxes/git/searchlight
venv installed: amqp==2.3.2,appdirs==1.4.3,asn1crypto==0.24.0,attrs==18.2.0,Babel==2.6.0,cachetools==2.1.0,certifi==2018.10.15,cffi==1.11.5,chardet==3.0.4,cliff==2.14.0,cmd2==0.9.6,colorama==0.4.0,contextlib2==0.5.5,coverage==4.5.1,cryptography==2.3.1,debtcollector==1.20.0,decorator==4.3.0,dnspython==1.15.0,dogpile.cache==0.6.7,elasticsearch==2.4.1,eventlet==0.24.1,extras==1.0.0,fasteners==0.14.1,fixtures==3.0.0,flake8==2.2.4,future==0.17.1,futurist==1.7.0,greenlet==0.4.15,hacking==0.10.3,httplib2==0.11.3,idna==2.7,iso8601==0.1.12,Jinja2==2.10,jmespath==0.9.3,jsonpatch==1.23,jsonpointer==2.0,jsonschema==2.6.0,keystoneauth1==3.11.1,keystonemiddleware==5.3.0,kombu==4.2.1,linecache2==1.0.0,MarkupSafe==1.0,mccabe==0.2.1,mock==2.0.0,monotonic==1.5,mox3==0.26.0,msgpack==0.5.6,munch==2.3.2,netaddr==0.7.19,netifaces==0.10.7,openstacksdk==0.19.0,os-client-config==1.31.2,os-service-types==1.3.0,osc-lib==1.11.1,oslo.cache==1.31.1,oslo.concurrency==3.28.1,oslo.config==6.6.2,oslo.context==2.21.0,oslo.i18n==3.22.1,oslo.log==3.40.1,oslo.messaging==9.1.1,oslo.middleware==3.36.0,oslo.policy==1.40.1,oslo.serialization==2.28.1,oslo.service==1.32.0,oslo.upgradecheck==0.1.0,oslo.utils==3.37.1,oslotest==3.7.0,osprofiler==2.5.0,Paste==3.0.3,PasteDeploy==1.5.2,pbr==5.1.0,pep8==1.5.7,prettytable==0.7.2,psutil==5.4.8,pycadf==2.8.0,pycparser==2.19,pyflakes==0.8.1,pyinotify==0.9.6,pyOpenSSL==18.0.0,pyparsing==2.3.0,pyperclip==1.7.0,python-cinderclient==4.1.0,python-dateutil==2.7.5,python-designateclient==2.11.0,python-glanceclient==2.14.0,python-ironicclient==2.5.0,python-keystoneclient==3.18.0,python-mimeparse==1.6.0,python-neutronclient==6.10.0,python-novaclient==11.1.0,python-subunit==1.3.0,python-swiftclient==3.6.0,pytz==2018.7,PyYAML==3.13,repoze.lru==0.7,requests==2.20.0,requestsexceptions==1.4.0,rfc3986==1.1.0,Routes==2.4.1,-e git://git.openstack.org/openstack/searchlight@e9b47947ade21b13c9c8fc14ba42420dbf0707ee#egg=searchlight,simplegeneric==0.8.1,simplejson==3.16.0,six==1.11.0,statsd==3.3.0,stestr==2.1.1,stevedore==1.30.0,testtools==2.3.0,traceback2==1.4.0,unittest2==1.1.0,urllib3==1.24.1,vine==1.1.4,voluptuous==0.11.5,warlock==1.3.0,wcwidth==0.1.7,WebOb==1.8.3,wrapt==1.10.11,WSME==0.9.3
venv runtests: PYTHONHASHSEED='1392988093'
venv runtests: commands[0] | searchlight-status upgrade check
Error:
Traceback (most recent call last):
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/oslo_upgradecheck/upgradecheck.py", line 184, in main
return conf.command.action_fn()
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/oslo_upgradecheck/upgradecheck.py", line 134, in check
print(t)
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", line 237, in __str__
return self.__unicode__()
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", line 243, in __unicode__
return self.get_string()
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", line 995, in get_string
lines.append(self._stringify_header(options))
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", line 1066, in _stringify_header
bits.append(" " * lpad + self._justify(fieldname, width, self._align[field]) + " " * rpad)
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/prettytable.py", line 187, in _justify
return text + excess * " "
File "/home/osboxes/git/searchlight/.tox/venv/lib/python3.5/site-packages/oslo_i18n/_message.py", line 230, in __add__
raise TypeError(msg)
TypeError: Message objects do not support addition.
The lazy translation effort from IBM was abandoned several years ago and these "big tent" projects are probably just still calling this code because it was copied from nova or glance originally, but that's all been removed from the core projects (or should have been by now). Anyway, it causes issues and isn't supported, so we should work to deprecate and remove the enable_lazy translation code from oslo.i18n.
Fix proposed to branch: master /review. openstack. org/615610
Review: https:/