#7951 IPA i18n_messages call does not obey translations requests
Closed: fixed 4 years ago by abbra. Opened 4 years ago by abbra.

From run of ipa-tests-run -k test_i18n_messages:

______________________________________________________________________ test_i18n_messages.test_i18n_consequence_receive ______________________________________________________________________

self = <ipatests.test_ipaserver.test_i18n_messages.test_i18n_messages object at 0x7feafb453f60>

    def test_i18n_consequence_receive(self):
        """
        Test if consequence translations requests for different languages are
        successful. Every request's result have to contain messages in it's
        locale.
        """
        prev_i18n_msgs = self._fetch_i18n_msgs_http('en-us')
        cur_i18n_msgs = self._fetch_i18n_msgs_http('fr-fr')
        try:
            assert_equal(prev_i18n_msgs['texts']['true'], u'True')
>           assert_equal(cur_i18n_msgs['texts']['true'], u'Vrai')

/usr/lib/python3.7/site-packages/ipatests/test_ipaserver/test_i18n_messages.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

val1 = 'True', val2 = 'Vrai'

    def assert_equal(val1, val2):
        """
        Assert ``val1`` and ``val2`` are the same type and of equal value.
        """
        assert type(val1) is type(val2), '%r != %r' % (val1, val2)
>       assert val1 == val2, '%r != %r' % (val1, val2)
E       AssertionError: 'True' != 'Vrai'

/usr/lib/python3.7/site-packages/ipatests/util.py:181: AssertionError

Server side reports no problems:

[Wed May 15 10:53:24.618873 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed May 15 10:53:24.618933 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: DEBUG: WSGI jsonserver_i18n_messages.__call__:
[Wed May 15 10:53:24.619152 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed May 15 10:53:24.619187 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed May 15 10:53:24.619363 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: DEBUG: raw: i18n_messages(version='2.232')
[Wed May 15 10:53:24.619439 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: DEBUG: i18n_messages(version='2.232')
[Wed May 15 10:53:24.622659 2019] [wsgi:error] [pid 14060:tid 139651964225280] [remote 192.168.121.228:34980] ipa: INFO: [jsonserver_i18n_messages] UNKNOWN: i18n_messages(version='2.232'): SUCCESS
[Wed May 15 10:53:24.628704 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed May 15 10:53:24.628750 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: DEBUG: WSGI jsonserver_i18n_messages.__call__:
[Wed May 15 10:53:24.628881 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed May 15 10:53:24.628914 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed May 15 10:53:24.629075 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: DEBUG: raw: i18n_messages(version='2.232')
[Wed May 15 10:53:24.629147 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: DEBUG: i18n_messages(version='2.232')
[Wed May 15 10:53:24.632312 2019] [wsgi:error] [pid 14061:tid 139651964217088] [remote 192.168.121.228:34982] ipa: INFO: [jsonserver_i18n_messages] UNKNOWN: i18n_messages(version='2.232'): SUCCESS

but still returns 'True' when it should have returned 'Vrai' for the second call.

I suspect that the problem is actually not in the test but in the interaction between ipalib.text.create_translation() and Gettext.as_unicode(). Both assume that a thread-local context contains a single translation for a key in context.__dict__ but if context.languages would be different between multiple requests, we would get the same value returned on consequent requests regarding what language is specified.


The only test where a translated text in the not default locale (fr-fr) is actually fetched is this (test_i18n_consequence_receive). The problem is in the missing locale on a server. For Travis I added that locale like this:

sed -i 's/%_install_langs \(.*\)/\0:fr/g' /etc/rpm/macros.image-language-conf

https://github.com/freeipa/freeipa/commit/f49fac7bda8150aee2086be9afdbe4eb81c3f18a.
I could do the similar for Azure.

Ahh, thanks for the comment. I actually removed that code from the script as it had no comment to explain why is it needed. I can add it to my PR 3146 where other fixes are already.

master:

  • 9cb6817 azure-run-tests: handle single unexpanded parameter too
  • c41b3ae fix selenium imports in automount web UI test
  • 245a8bc test_legacy_clients: fix class inheritance
  • 74f3ca5 i18n_messages: get back a locale needed for testing

Metadata Update from @abbra:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

4 years ago

Not sure if this is exactly related to this but logging in the UI with the root user just goes into a loop with the logs which include UNKNOWN: i18n_messages

[Wed Feb 03 15:17:40.117916 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed Feb 03 15:17:40.118039 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver_i18n_messages.__call__:
[Wed Feb 03 15:17:40.118258 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed Feb 03 15:17:40.118341 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed Feb 03 15:17:40.118636 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: raw: i18n_messages(version='2.239')
[Wed Feb 03 15:17:40.118791 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: i18n_messages(version='2.239')
[Wed Feb 03 15:17:40.125077 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: INFO: [jsonserver_i18n_messages] UNKNOWN: i18n_messages(version='2.239'): SUCCESS
[Wed Feb 03 15:17:40.261108 2021] [:warn] [pid 183437:tid 183490] [client X.X.X.X:57600] failed to set perms (3140) on file (/run/ipa/ccaches/root@OURDOMAIN.EDU)!, referer: https://OURDOMAIN.edu/ipa/ui/
[Wed Feb 03 15:17:40.261991 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed Feb 03 15:17:40.262141 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver_session.__call__:
[Wed Feb 03 15:17:40.273232 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: Created connection context.ldap2_139992849979040
[Wed Feb 03 15:17:40.273347 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed Feb 03 15:17:40.273429 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed Feb 03 15:17:40.274385 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: batch(config_show(), whoami(), env(None), dns_is_enabled(), trustconfig_show(), domainlevel_get(), ca_is_enabled(), vaultconfig_show())
[Wed Feb 03 15:17:40.274977 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: batch(config_show(), whoami(), env(None), dns_is_enabled(), trustconfig_show(), domainlevel_get(), ca_is_enabled(), vaultconfig_show())
[Wed Feb 03 15:17:40.275231 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: config_show(version='2.239')
[Wed Feb 03 15:17:40.275411 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: config_show(rights=False, all=False, raw=False, version='2.239')
[Wed Feb 03 15:17:40.303444 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: config_show(): SUCCESS
[Wed Feb 03 15:17:40.303685 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: whoami(version='2.239')
[Wed Feb 03 15:17:40.303828 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: whoami(version='2.239')
[Wed Feb 03 15:17:40.308217 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: whoami(): SUCCESS
[Wed Feb 03 15:17:40.308423 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: env(None, version='2.239')
[Wed Feb 03 15:17:40.308596 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: env(None, server=False, all=True, version='2.239')
[Wed Feb 03 15:17:40.308966 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: env(None): SUCCESS
[Wed Feb 03 15:17:40.309177 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: dns_is_enabled(version='2.239')
[Wed Feb 03 15:17:40.309323 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: dns_is_enabled(version='2.239')
[Wed Feb 03 15:17:40.311424 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: dns_is_enabled(): SUCCESS
[Wed Feb 03 15:17:40.311648 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: trustconfig_show(version='2.239')
[Wed Feb 03 15:17:40.311840 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: trustconfig_show(rights=False, trust_type='ad', all=False, raw=False, version='2.239')
[Wed Feb 03 15:17:40.312975 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: trustconfig_show(): NotFound
[Wed Feb 03 15:17:40.313162 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: domainlevel_get(version='2.239')
[Wed Feb 03 15:17:40.313291 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: domainlevel_get(version='2.239')
[Wed Feb 03 15:17:40.314391 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: domainlevel_get(): SUCCESS
[Wed Feb 03 15:17:40.314570 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: ca_is_enabled(version='2.239')
[Wed Feb 03 15:17:40.314710 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: ca_is_enabled(version='2.239')
[Wed Feb 03 15:17:40.316434 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: ca_is_enabled(): SUCCESS
[Wed Feb 03 15:17:40.316645 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: vaultconfig_show(version='2.239')
[Wed Feb 03 15:17:40.316810 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: vaultconfig_show(all=False, raw=False, version='2.239')
[Wed Feb 03 15:17:40.317038 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: raw: kra_is_enabled(version='2.239')
[Wed Feb 03 15:17:40.317204 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: kra_is_enabled(version='2.239')
[Wed Feb 03 15:17:40.318147 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: root@OURDOMAIN.EDU: batch: vaultconfig_show(): InvocationError
[Wed Feb 03 15:17:40.318713 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: INFO: [jsonserver_session] root@OURDOMAIN.EDU: batch(config_show(), whoami(), env(None), dns_is_enabled(), trustconfig_show(), domainlevel_get(), ca_is_enabled(), vaultconfig_show()): SUCCESS
[Wed Feb 03 15:17:40.320894 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57600] ipa: DEBUG: Destroyed connection context.ldap2_139992849979040
[Wed Feb 03 15:17:40.330932 2021] [:warn] [pid 183437:tid 183501] [client X.X.X.X:57600] failed to set perms (3140) on file (/run/ipa/ccaches/root@OURDOMAIN.EDU)!, referer: https://OURDOMAIN.edu/ipa/ui/
[Wed Feb 03 15:17:40.331811 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed Feb 03 15:17:40.331935 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver_session.__call__:
[Wed Feb 03 15:17:40.342812 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: Created connection context.ldap2_139992849984672
[Wed Feb 03 15:17:40.342929 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed Feb 03 15:17:40.343011 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed Feb 03 15:17:40.343442 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: raw: user_show('admin', all=True, version='2.239')
[Wed Feb 03 15:17:40.343684 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: user_show('admin', rights=False, all=True, raw=False, version='2.239', no_members=False)
[Wed Feb 03 15:17:40.360102 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: INFO: [jsonserver_session] root@OURDOMAIN.EDU: user_show/1('admin', all=True, version='2.239'): SUCCESS
[Wed Feb 03 15:17:40.361232 2021] [wsgi:error] [pid 182764:tid 183119] [remote X.X.X.X:57600] ipa: DEBUG: Destroyed connection context.ldap2_139992849984672
[Wed Feb 03 15:17:40.373091 2021] [:warn] [pid 183437:tid 183478] [client X.X.X.X:57600] failed to set perms (3140) on file (/run/ipa/ccaches/root@OURDOMAIN.EDU)!, referer: https://OURDOMAIN.edu/ipa/ui/
[Wed Feb 03 15:17:40.374171 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed Feb 03 15:17:40.374334 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver_session.__call__:
[Wed Feb 03 15:17:40.374348 2021] [:warn] [pid 182765:tid 182851] [client X.X.X.X:57612] failed to set perms (3140) on file (/run/ipa/ccaches/root@OURDOMAIN.EDU)!, referer: https://OURDOMAIN.edu/ipa/ui/
[Wed Feb 03 15:17:40.376301 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: WSGI wsgi_dispatch.__call__:
[Wed Feb 03 15:17:40.376537 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: WSGI jsonserver_session.__call__:
[Wed Feb 03 15:17:40.387212 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: Created connection context.ldap2_139992849972384
[Wed Feb 03 15:17:40.387377 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed Feb 03 15:17:40.387463 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed Feb 03 15:17:40.387861 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: raw: json_metadata(None, None, object='all', version='2.239')
[Wed Feb 03 15:17:40.388089 2021] [wsgi:error] [pid 182763:tid 183109] [remote X.X.X.X:57600] ipa: DEBUG: json_metadata(None, None, object='all', version='2.239')
[Wed Feb 03 15:17:40.395263 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: Created connection context.ldap2_139992849979040
[Wed Feb 03 15:17:40.395429 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: WSGI jsonserver.__call__:
[Wed Feb 03 15:17:40.395583 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: WSGI WSGIExecutioner.__call__:
[Wed Feb 03 15:17:40.396097 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: raw: json_metadata(None, None, command='all', version='2.239')
[Wed Feb 03 15:17:40.396321 2021] [wsgi:error] [pid 182761:tid 183112] [remote X.X.X.X:57612] ipa: DEBUG: json_metadata(None, None, command='all', version='2.239')

freeipa.png

Login to comment on this ticket.

Metadata
Attachments 1
Attached 3 years ago View Comment