Bug 52512 - Make portal modularized
Make portal modularized
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Portal
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Dirk Wiesenthal
Florian Best
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-12-17 14:03 CET by Dirk Wiesenthal
Modified: 2021-05-25 16:01 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Feature Request
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
portal.log (83.52 KB, text/x-log)
2021-01-29 14:00 CET, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2020-12-17 14:03:27 CET
Nearly aspect of the portal should be modularized.

Use case: Currently, we use UDM to get the portal tiles. We may want to get the data from a different database.

Same with the information whether the user is logged in (currently done by coupling to UMC). Or in which groups they are (currently done by a listener).

This could also cover Bug#51798
Comment 1 Florian Best univentionstaff 2021-01-08 11:08:08 CET
REOPEN:

11932 times in /var/log/univention/portal.log: (in every Jenkins run).

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/tornado/web.py", line 1590, in _execute
    result = method(*self.path_args, **self.path_kwargs)
  File "/usr/sbin/univention-portal-server", line 87, in get
    visible_content = portal.get_visible_content(user, admin_mode)
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/portal.py", line 94, in get_visible_content
    visible_entry_dns = self._filter_entry_dns(entries.keys(), entries, user, admin_mode)
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/portal.py", line 175, in _filter_entry_dns
    if entry['anonymous'] and username:
KeyError: 'anonymous'
Comment 2 Florian Best univentionstaff 2021-01-08 11:35:02 CET
./python/univention/portal/extensions/portal.py:175:31: F821 undefined name 'username'   

Please also fix PEP8 styling:

./unittests/test_dynamic_portal.py:36:1: E302 expected 2 blank lines, found 1
./unittests/test_dynamic_portal.py:50:22: W291 trailing whitespace
./unittests/test_dynamic_portal.py:52:6: W291 trailing whitespace
./unittests/test_dynamic_portal.py:54:22: W291 trailing whitespace
./unittests/test_dynamic_portal.py:56:6: W291 trailing whitespace
./unittests/test_dynamic_portal.py:60:22: W291 trailing whitespace
./unittests/test_dynamic_portal.py:62:6: W291 trailing whitespace
./unittests/test_dynamic_portal.py:75:21: W291 trailing whitespace
./unittests/test_dynamic_portal.py:78:32: W291 trailing whitespace
./unittests/test_dynamic_portal.py:81:24: W291 trailing whitespace
./unittests/test_dynamic_portal.py:83:8: W291 trailing whitespace
./unittests/test_dynamic_portal.py:85:36: W291 trailing whitespace
./unittests/test_dynamic_portal.py:88:26: W291 trailing whitespace
./unittests/test_dynamic_portal.py:90:10: W291 trailing whitespace
./unittests/test_dynamic_portal.py:92:26: W291 trailing whitespace
./unittests/test_dynamic_portal.py:95:9: W291 trailing whitespace
./unittests/test_dynamic_portal.py:98:7: W291 trailing whitespace
./unittests/test_dynamic_portal.py:100:6: W291 trailing whitespace
./unittests/test_dynamic_portal.py:102:33: W291 trailing whitespace
./unittests/test_dynamic_portal.py:106:24: W291 trailing whitespace
./unittests/test_dynamic_portal.py:110:33: W291 trailing whitespace
./unittests/test_dynamic_portal.py:113:26: W291 trailing whitespace
./unittests/test_dynamic_portal.py:115:10: W291 trailing whitespace
./unittests/test_dynamic_portal.py:117:39: W291 trailing whitespace
./unittests/test_dynamic_portal.py:120:28: W291 trailing whitespace
./unittests/test_dynamic_portal.py:122:12: W291 trailing whitespace
./unittests/test_dynamic_portal.py:124:28: W291 trailing whitespace
./unittests/test_dynamic_portal.py:126:12: W291 trailing whitespace
./unittests/test_dynamic_portal.py:128:28: W291 trailing whitespace
./unittests/test_dynamic_portal.py:130:12: W291 trailing whitespace
./unittests/test_dynamic_portal.py:132:28: W291 trailing whitespace
./unittests/test_dynamic_portal.py:134:12: W291 trailing whitespace
./unittests/test_dynamic_portal.py:136:28: W291 trailing whitespace
./unittests/test_dynamic_portal.py:139:11: W291 trailing whitespace
./unittests/test_dynamic_portal.py:142:9: W291 trailing whitespace
./unittests/test_dynamic_portal.py:148:23: W291 trailing whitespace
./unittests/test_dynamic_portal.py:151:5: W291 trailing whitespace
./unittests/test_log.py:34:1: F401 'pytest' imported but unused
./unittests/test_portal.py:50:2: E303 too many blank lines (2)
./unittests/test_portal.py:60:2: E303 too many blank lines (2)
./unittests/test_portal.py:69:2: E303 too many blank lines (2)
./unittests/test_portal.py:74:1: W293 blank line contains whitespace
./unittests/test_portal.py:75:2: E303 too many blank lines (2)
./unittests/test_portal.py:83:2: E303 too many blank lines (2)
./unittests/test_portal.py:95:2: E303 too many blank lines (2)
./unittests/test_portal.py:103:2: E303 too many blank lines (2)
./unittests/test_portal.py:109:2: E303 too many blank lines (2)
./unittests/test_portal.py:146:2: E303 too many blank lines (2)
./unittests/test_portal.py:153:2: E303 too many blank lines (2)
./unittests/test_portal.py:168:2: E303 too many blank lines (2)
./unittests/test_portal.py:177:6: E128 continuation line under-indented for visual indent
./unittests/test_portal.py:178:6: E128 continuation line under-indented for visual indent
./unittests/test_portal.py:185:5: E128 continuation line under-indented for visual indent
./unittests/test_portal.py:186:5: E128 continuation line under-indented for visual indent
./unittests/test_portal.py:192:2: E303 too many blank lines (2)                                                                                                                                                                               
./unittests/test_portal.py:200:2: E303 too many blank lines (2)                                                                                                                                                                               
./unittests/test_config.py:34:1: F401 'univentionunittests.import_module' imported but unused                                                                                                                                                 
./unittests/test_config.py:39:2: F821 undefined name 'reload'                                                                                                                                                                                 
./unittests/test_config.py:48:4: E126 continuation line over-indented for hanging indent                                                                                                                                                      
./unittests/test_config.py:52:3: E126 continuation line over-indented for hanging indent                                                                                                                                                      
./unittests/test_config.py:54:48: E712 comparison to True should be 'if cond is True:' or 'if cond:'
./unittests/test_config.py:56:48: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
./unittests/test_config.py:63:2: F841 local variable 'open_mock' is assigned to but never used
./unittests/test_config.py:65:48: E712 comparison to True should be 'if cond is True:' or 'if cond:'
./unittests/test_config.py:68:48: E712 comparison to True should be 'if cond is True:' or 'if cond:'                                                                                                                                          
./unittests/test_config.py:77:41: E712 comparison to True should be 'if cond is True:' or 'if cond:'                                                                                                                                          
./unittests/test_config.py:84:48: E712 comparison to False should be 'if cond is False:' or 'if not cond:'
./unittests/test_authenticator.py:59:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:69:2: E303 too many blank lines (2)        
./unittests/test_authenticator.py:78:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:83:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:98:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:109:24: E711 comparison to None should be 'if cond is None:'
./unittests/test_authenticator.py:113:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:117:51: E711 comparison to None should be 'if cond is None:'
./unittests/test_authenticator.py:119:61: E711 comparison to None should be 'if cond is None:'
./unittests/test_authenticator.py:122:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:146:26: W291 trailing whitespace
./unittests/test_authenticator.py:150:44: E711 comparison to None should be 'if cond is None:'
./unittests/test_authenticator.py:153:1: W293 blank line contains whitespace
./unittests/test_authenticator.py:154:2: E303 too many blank lines (2)
./unittests/test_authenticator.py:168:54: E711 comparison to None should be 'if cond is None:'
./unittests/test_authenticator.py:175:54: E711 comparison to None should be 'if cond is None:'
./unittests/test_authenticator.py:176:54: E711 comparison to None should be 'if cond is None:'
./unittests/conftest.py:84:2: E306 expected 1 blank line before a nested definition, found 0
./unittests/conftest.py:84:19: W291 trailing whitespace           
./unittests/conftest.py:87:1: W391 blank line at end of file       
./unittests/conftest.py:87:1: W293 blank line contains whitespace  
./unittests/test_reloader.py:36:1: F401 'univentionunittests.import_module' imported but unused
./unittests/test_reloader.py:41:2: F821 undefined name 'reload'    
./unittests/test_reloader.py:73:2: E303 too many blank lines (2)   
./unittests/test_reloader.py:80:1: W293 blank line contains whitespace
./unittests/test_reloader.py:81:2: E303 too many blank lines (2)   
./unittests/test_reloader.py:89:1: W293 blank line contains whitespace
./unittests/test_reloader.py:90:2: E303 too many blank lines (2)   
./unittests/test_reloader.py:96:2: E303 too many blank lines (2)   
./unittests/test_reloader.py:103:1: W293 blank line contains whitespace
./unittests/test_reloader.py:104:2: E303 too many blank lines (2)  
./unittests/test_reloader.py:108:56: E251 unexpected spaces around keyword / parameter equals
./unittests/test_reloader.py:108:58: E251 unexpected spaces around keyword / parameter equals
./unittests/test_reloader.py:131:2: E303 too many blank lines (2)  
./unittests/test_reloader.py:136:2: E303 too many blank lines (2)  
./unittests/test_reloader.py:143:2: E303 too many blank lines (2) 
./unittests/test_reloader.py:145:3: F841 local variable 'mocked_portal' is assigned to but never used
./unittests/test_reloader.py:165:2: E303 too many blank lines (2) 
./unittests/test_reloader.py:171:41: E221 multiple spaces before operator
./unittests/test_reloader.py:176:2: E303 too many blank lines (2)
./unittests/test_cache.py:49:2: E303 too many blank lines (2) 
./unittests/test_cache.py:54:2: E303 too many blank lines (2) 
./unittests/test_cache.py:59:5: E126 continuation line over-indented for hanging indent
./unittests/test_cache.py:62:4: E126 continuation line over-indented for hanging indent
./unittests/test_cache.py:69:2: E303 too many blank lines (2) 
./unittests/test_cache.py:79:2: E303 too many blank lines (2) 
./udm/api/portal.py:34:1: F401 '..encoders.dn_property_encoder_for' imported but unused
./python/univention/portal/config.py:39:1: E302 expected 2 blank lines, found 1
./python/univention/portal/config.py:49:1: E305 expected 2 blank lines after class or function definition, found 0
./python/univention/portal/config.py:51:1: E302 expected 2 blank lines, found 1
./python/univention/portal/log.py:36:1: E302 expected 2 blank lines, found 1
./python/univention/portal/extensions/reloader.py:139:2: E303 too many blank lines (2)   
./python/univention/portal/extensions/reloader.py:307:3: E306 expected 1 blank line before a nested definition, found 0
Comment 3 Florian Best univentionstaff 2021-01-08 12:06:34 CET
The release changelog is missing.
See the 5 gitlab comments I created.
Comment 4 Florian Best univentionstaff 2021-01-28 11:04:19 CET
There are still the following PEP8 errors:

./unittests/test_dynamic_portal.py:47:126: E231 missing whitespace after ','
./unittests/test_dynamic_portal.py:47:189: E231 missing whitespace after ','
./python/univention/portal/log.py:43:63: E203 whitespace before ':'
./python/univention/portal/extensions/authenticator.py:32:1: F401 'base64' imported but unused
./python/univention/portal/extensions/authenticator.py:33:1: F401 'uuid' imported but unused
./python/univention/portal/extensions/authenticator.py:36:1: F401 'tornado' imported but unused
./python/univention/portal/extensions/portal.py:99:4: W503 line break before binary operator
./python/univention/portal/extensions/portal.py:106:4: W503 line break before binary operator
./python/univention/portal/extensions/portal.py:112:4: W503 line break before binary operator
./python/univention/portal/extensions/portal.py:119:4: W503 line break before binary operator
Comment 5 Dirk Wiesenthal univentionstaff 2021-01-28 11:42:02 CET
Fixed with the latest version in UCS 5. flake8 and black seem to work against each other in certain scenarios.
Comment 6 Florian Best univentionstaff 2021-01-28 13:59:12 CET
You removed "OpenIDAuthenticator".
Don't you have to set the unit tests to skip then?

unittests/test_authenticator.py:        assert dynamic_class("OpenIDAuthenticator")
unittests/test_authenticator.py:class TestOpenIDAuthenticator:
unittests/test_authenticator.py:                OpenIDAuthenticator = dynamic_class("OpenIDAuthenticator")
unittests/test_authenticator.py:                default_openid_authenticator = OpenIDAuthenticator("authorization_endpoint", "client_id")
Comment 7 Florian Best univentionstaff 2021-01-28 14:03:39 CET
I think we need to revert the ACL change:
-	by * +0 break
+	by * +0 stop

This could have impact on UCS@school, which can't influence the replication of those objects anymore.
Comment 8 Florian Best univentionstaff 2021-01-28 14:23:04 CET
How to use the new package univention-portal-tests?

Trying to use it causes:
Could not load JSON data from portal/portal/portal.json: RequestError: Unable to load /univention-portal/portal/portal.json?v=2.0.2-4 status: 404 and an error in handleAs: transformation of response
dojo.js.uncompressed.js:5272 dojo/parser::parse() error TypeError: Cannot read property 'logo' of undefined
    at Object.logo (portalContent.js?v=2.0.2-4:93)
    at Object.constructor (Portal.js?v=2.0.2-4:955)
    at new <anonymous> (dojo.js.uncompressed.js:10259)
    at Object.construct (dojo.js.uncompressed.js:4832)
    at Object.<anonymous> (dojo.js.uncompressed.js:4562)
    at Object.map (dojo.js.uncompressed.js:4304)
    at Object._instantiate (dojo.js.uncompressed.js:4556)
    at dojo.js.uncompressed.js:5265
    at d (dojo.js.uncompressed.js:6109)
    at e (dojo.js.uncompressed.js:6100)

/usr/share/univention-portal/test.html uses things from the App-Center:
<link rel="stylesheet" href="/univention/management/modules/appcenter.css" type="text/css"/>.
Comment 9 Florian Best univentionstaff 2021-01-28 14:31:16 CET
I see 404 errors after logging in caused by:
management/univention-portal/www/Portal.js:                                     'location': '/univention/portal/loggedin/',                                                                                                                   
management/univention-portal/www/Portal.js:                                     if (pathname === '/univention/portal/loggedin/') {
Comment 10 Florian Best univentionstaff 2021-01-28 14:41:25 CET
I am unsure about the new Apache configuration:

ProxyPassMatch /univention/([^/]+)/portal/(.*) http://127.0.0.1:@%@portal/port@%@/$1/$2 retry=0

→ This would theoretically result in /univention/udm/portal/* to be answered by the Portal Server instead of the UDM REST API. Luckiyl the new UDM modules are called "portals" not "portal".
Comment 11 Florian Best univentionstaff 2021-01-28 14:50:51 CET
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 107, in refresh
    fd = self._refresh()
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 181, in _refresh
    except UDM.NoObject:
AttributeError: type object 'UDM' has no attribute 'NoObject'
Comment 12 Florian Best univentionstaff 2021-01-29 10:57:29 CET
Please fix py2 compatibility:

python2 $(which ucr) filter < /etc/univention/templates/files/usr/lib/univention-portal/config/config.json
  File "<stdin>", line 13
    print(json.dumps(admin_groups), end="")
                                       ^
SyntaxError: invalid syntax
Comment 13 Florian Best univentionstaff 2021-01-29 12:30:13 CET
03_ucr/63checkucrwarning fails with:
Error: Missing UCR header for /usr/lib/univention-portal/config/config.json
Comment 14 Florian Best univentionstaff 2021-01-29 14:00:45 CET
Created attachment 10607 [details]
portal.log

Please make sure during the initialization no tracebacks are logged.
Comment 15 Dirk Wiesenthal univentionstaff 2021-01-29 15:47:16 CET
In
  univention-portal 4.0.4-6A~5.0.0.202101291534

I fixed most of that:

UCR template
Apache location
Traceback in Logs
Unittests

Two things open:
  univention-portal-tests:
    That is not a new package. I dont know how to use it. We may want to remove it.
  Portal.js' 404 errors:
    Not sure how this got into the code. I am still consultation
Comment 16 Dirk Wiesenthal univentionstaff 2021-01-29 17:34:20 CET
(In reply to Dirk Wiesenthal from comment #15)
> In
>   univention-portal 4.0.4-6A~5.0.0.202101291534
> 
> I fixed most of that:
> 
> UCR template
> Apache location
> Traceback in Logs
> Unittests
> 
> Two things open:
>   univention-portal-tests:
>     That is not a new package. I dont know how to use it. We may want to
> remove it.

Removed it

>   Portal.js' 404 errors:
>     Not sure how this got into the code. I am still consultation

If opened Bug#52722 for that
Comment 17 Philipp Hahn univentionstaff 2021-01-30 18:20:53 CET
634b51911367a0b3c9be94b7f1a2b18d4fdc9389
 b/management/univention-portal/debian/univention-portal.postinst
 33 +ucr set groups/default/domainadmins?"Domain Admins"

sets a default value, which break base/univention-lib/unittests/test_misc.py::test_groupname

    def test_groupname():
>       assert misc.custom_groupname('domain admins') == 'domain admins'
E    AssertionError: assert 'Domain Admins' == 'domain admins'
E      - Domain Admins
E      ? ^      ^
E      + domain admins
E      ? ^      ^

Fixed with https://git.knut.univention.de/univention/ucs/-/commit/ef00073ee6358f79d12369dd67ad3c6faf24cf15
Comment 18 Florian Best univentionstaff 2021-02-01 13:59:40 CET
There are two unit tests which fail:

TestPortalFileCache.test_reload_on_get
TestPortalFileCache.test_reload

The unit tests yield the following warnings:

test_authenticator.py::TestUMCAuthenticator::()::test_ask_umc_request_success
  /usr/lib/python3/dist-packages/univention/portal/extensions/authenticator.py:122: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    get_logger("user").warn("session unknown!")

test_reloader.py::TestMtimeBasedLazyFileReloader::()::test_init_error
  /usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py:87: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    get_logger("cache").warn("Unable to get mtime for {}".format(exc))

test_reloader.py::TestPortalReloaderUDM::()::test_init_error
  /usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py:87: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    get_logger("cache").warn("Unable to get mtime for {}".format(exc))

test_reloader.py::TestPortalReloaderUDM::()::test_refresh
  <string>:40: DeprecationWarning: invalid escape sequence \d
  /usr/lib/python3/dist-packages/ruamel/yaml/comments.py:14: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    from collections import MutableSet, Sized, Set
  /usr/lib/python3/dist-packages/ruamel/yaml/comments.py:14: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    from collections import MutableSet, Sized, Set
  /usr/lib/python3/dist-packages/ruamel/yaml/comments.py:14: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
    from collections import MutableSet, Sized, Set
  <string>:40: DeprecationWarning: invalid escape sequence \d
  <string>:40: DeprecationWarning: invalid escape sequence \d
  <string>:40: DeprecationWarning: invalid escape sequence \d

test_reloader.py::TestGroupsReloaderLDAP::()::test_init_error
  /usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py:87: DeprecationWarning: The 'warn' method is deprecated, use 'warning' instead
    get_logger("cache").warn("Unable to get mtime for {}".format(exc))
Comment 19 Florian Best univentionstaff 2021-02-01 14:00:38 CET
It's missing that the unittests are executed during package build.
Comment 20 Philipp Hahn univentionstaff 2021-02-02 06:29:10 CET
(In reply to Philipp Hahn from comment #17)
> 634b51911367a0b3c9be94b7f1a2b18d4fdc9389
>  b/management/univention-portal/debian/univention-portal.postinst
>  33 +ucr set groups/default/domainadmins?"Domain Admins"
...
> Fixed with

From Bug #51316:
[5.0-0] e3bc88b15c fix Bug #52512 lib: fix unittests/test_misc.py::test_groupname

Package: univention-lib
Version: 9.0.11-1A~5.0.0.202102011824
Comment 21 Florian Best univentionstaff 2021-02-12 13:55:43 CET
Please add error handling or fix this error during Jenkins Tests:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 107, in refresh
    fd = self._refresh()
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 177, in _refresh
    udm = udm_lib.UDM.machine().version(2)
  File "/usr/lib/python3/dist-packages/univention/udm/udm.py", line 140, in machine
    connection = LDAP_connection.get_machine_connection()
  File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line 80, in get_machine_connection
    co, po = cls._wrap_connection(univention.admin.uldap.getMachineConnection)
  File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line 61, in _wrap_connection
    six.reraise(ConnectionError, ConnectionError('Could not read secret file'), sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
    raise value.with_traceback(tb)
  File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line 59, in _wrap_connection
    return func(**kwargs)
  File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 178, in getMachineConnection
    lo = univention.uldap.getMachineConnection(start_tls, decode_ignorelist=decode_ignorelist, ldap_master=ldap_master)
  File "/usr/lib/python3/dist-packages/univention/uldap.py", line 168, in getMachineConnection
    bindpw = open(secret_file).read().rstrip('\n')
univention.udm.exceptions.ConnectionError: Could not read secret file
Comment 22 Florian Best univentionstaff 2021-02-12 15:10:56 CET
Same applies for:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 107, in refresh
    fd = self._refresh()
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 179, in _refresh
    portal = udm.get("portals/portal").get(self._portal_dn)
  File "/usr/lib/python3/dist-packages/univention/udm/udm.py", line 221, in get
    self._module_object_cache[key] = klass(name, self.connection, self.api_version)
  File "/usr/lib/python3/dist-packages/univention/udm/modules/generic.py", line 509, in __init__
    self._orig_udm_module = self._get_orig_udm_module()
  File "/usr/lib/python3/dist-packages/univention/udm/modules/generic.py", line 627, in _get_orig_udm_module 
    module_name=self.name
univention.udm.exceptions.UnknownModuleType: UDM module 'portals/portal' does not exist.

and:

Traceback (most recent call last):
  File "/etc/univention/templates/modules/create_portal_entries.py", line 241, in handler
    _handler(ucr, changes)
  File "/etc/univention/templates/modules/create_portal_entries.py", line 202, in _handler
    obj = init_object('portals/entry', lo, pos, dn)
  File "/usr/lib/python3/dist-packages/univention/appcenter/udm.py", line 75, in init_object
    module = _get_module(module, lo, pos) 
  File "/usr/lib/python3/dist-packages/univention/appcenter/udm.py", line 69, in _get_module
    udm_modules.init(lo, pos, mod)
  File "/usr/lib/python3/dist-packages/univention/admin/modules.py", line 184, in init
    univention.admin.ucr_overwrite_properties(module, lo)
  File "/usr/lib/python3/dist-packages/univention/admin/__init__.py", line 66, in ucr_overwrite_properties
    ucr_prefix = ucr_property_prefix % module.module
AttributeError: 'NoneType' object has no attribute 'module'
Comment 23 Florian Best univentionstaff 2021-02-13 21:02:16 CET
This exception should also be handled:

 28593 cache        21-02-13 00:51:52 [   ERROR]: Error during refresh
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 107, in refresh
    fd = self._refresh()
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 451, in _refresh
    with open(self._password_file) as fd:
FileNotFoundError: [Errno 2] No such file or directory: '/etc/machine.secret'
Comment 24 Florian Best univentionstaff 2021-03-22 15:38:49 CET
Please explain git:634b51911367a0b3c9be94b7f1a2b18d4fdc9389
management/univention-portal/debian/univention-portal.postinst
+ucr set groups/default/domainadmins?"Domain Admins"
Comment 25 Florian Best univentionstaff 2021-03-31 13:22:23 CEST
REOPEN: The following git commits weren't taken into the rewrite:

git:98c644f7ce6cc40b86c1b2b57b127b5dd35cd718
git:203134319f6b73c900ceabc0bc417377c6375145
Comment 26 Florian Best univentionstaff 2021-03-31 13:24:21 CEST
The following traceback is logged every Jenkins run:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 107, in refresh
    fd = self._refresh()
  File "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py", line 181, in _refresh
    raise ValueError("No Portal defined")  # default portal?
ValueError: No Portal defined
Comment 27 Dirk Wiesenthal univentionstaff 2021-04-23 01:36:00 CEST
(In reply to Florian Best from comment #19)
> It's missing that the unittests are executed during package build.

Fixed the unittests. They are not run because it might require a lot of build dependencies.

We are working on a pipeline based solution for this. For now, they are "just there".(In reply to Florian Best from comment #21)
> Please add error handling or fix this error during Jenkins Tests:
> 
> Traceback (most recent call last):
>   File
> "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py",
> line 107, in refresh
>     fd = self._refresh()
>   File
> "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py",
> line 177, in _refresh
>     udm = udm_lib.UDM.machine().version(2)
>   File "/usr/lib/python3/dist-packages/univention/udm/udm.py", line 140, in
> machine
>     connection = LDAP_connection.get_machine_connection()
>   File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line
> 80, in get_machine_connection
>     co, po =
> cls._wrap_connection(univention.admin.uldap.getMachineConnection)
>   File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line
> 61, in _wrap_connection
>     six.reraise(ConnectionError, ConnectionError('Could not read secret
> file'), sys.exc_info()[2])
>   File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
>     raise value.with_traceback(tb)
>   File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line
> 59, in _wrap_connection
>     return func(**kwargs)
>   File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 178,
> in getMachineConnection
>     lo = univention.uldap.getMachineConnection(start_tls,
> decode_ignorelist=decode_ignorelist, ldap_master=ldap_master)
>   File "/usr/lib/python3/dist-packages/univention/uldap.py", line 168, in
> getMachineConnection
>     bindpw = open(secret_file).read().rstrip('\n')
> univention.udm.exceptions.ConnectionError: Could not read secret file

These and a lot of other tracebacks are handled (i.e. warnings are written to the log instead of tracebacks). I have not seen any in my manual upgrade tests. Jenkins will tell...(In reply to Florian Best from comment #25)

> REOPEN: The following git commits weren't taken into the rewrite:
> 
> git:98c644f7ce6cc40b86c1b2b57b127b5dd35cd718
> git:203134319f6b73c900ceabc0bc417377c6375145

They have now been adapted.

univention-portal 4.0.5-37A~5.0.0.202104230131
Comment 28 Florian Best univentionstaff 2021-04-23 01:50:08 CEST
(In reply to Dirk Wiesenthal from comment #27)
> (In reply to Florian Best from comment #19)
> > It's missing that the unittests are executed during package build.
> 
> Fixed the unittests. They are not run because it might require a lot of
> build dependencies.
> 
> We are working on a pipeline based solution for this. For now, they are
> "just there".(In reply to Florian Best from comment #21)
> > Please add error handling or fix this error during Jenkins Tests:
> > 
> > Traceback (most recent call last):
> >   File
> > "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py",
> > line 107, in refresh
> >     fd = self._refresh()
> >   File
> > "/usr/lib/python3/dist-packages/univention/portal/extensions/reloader.py",
> > line 177, in _refresh
> >     udm = udm_lib.UDM.machine().version(2)
> >   File "/usr/lib/python3/dist-packages/univention/udm/udm.py", line 140, in
> > machine
> >     connection = LDAP_connection.get_machine_connection()
> >   File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line
> > 80, in get_machine_connection
> >     co, po =
> > cls._wrap_connection(univention.admin.uldap.getMachineConnection)
> >   File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line
> > 61, in _wrap_connection
> >     six.reraise(ConnectionError, ConnectionError('Could not read secret
> > file'), sys.exc_info()[2])
> >   File "/usr/lib/python3/dist-packages/six.py", line 692, in reraise
> >     raise value.with_traceback(tb)
> >   File "/usr/lib/python3/dist-packages/univention/udm/connections.py", line
> > 59, in _wrap_connection
> >     return func(**kwargs)
> >   File "/usr/lib/python3/dist-packages/univention/admin/uldap.py", line 178,
> > in getMachineConnection
> >     lo = univention.uldap.getMachineConnection(start_tls,
> > decode_ignorelist=decode_ignorelist, ldap_master=ldap_master)
> >   File "/usr/lib/python3/dist-packages/univention/uldap.py", line 168, in
> > getMachineConnection
> >     bindpw = open(secret_file).read().rstrip('\n')
> > univention.udm.exceptions.ConnectionError: Could not read secret file
> 
> These and a lot of other tracebacks are handled (i.e. warnings are written
> to the log instead of tracebacks). I have not seen any in my manual upgrade
> tests. Jenkins will tell...(In reply to Florian Best from comment #25)

That's because they are happening during new installation, not during upgrade.

https://jenkins.knut.univention.de:8181/job/UCS-5.0/job/UCS-5.0-0/job/AutotestJoin/SambaVersion=no-samba,Systemrolle=master-part-II/ws/test/portal.log
Comment 29 Dirk Wiesenthal univentionstaff 2021-04-27 11:23:40 CEST
The last tracebacks have been fixed in the latest version.
Comment 30 Dirk Wiesenthal univentionstaff 2021-04-27 11:54:14 CEST
(In reply to Dirk Wiesenthal from comment #29)
> The last tracebacks have been fixed in the latest version.

Should be git:24916805f52
Comment 31 Florian Best univentionstaff 2021-04-28 21:14:34 CEST
(In reply to Dirk Wiesenthal from comment #27)
> > REOPEN: The following git commits weren't taken into the rewrite:
> > 
> > git:98c644f7ce6cc40b86c1b2b57b127b5dd35cd718
> > git:203134319f6b73c900ceabc0bc417377c6375145
> 
> They have now been adapted.
> 
> univention-portal 4.0.5-37A~5.0.0.202104230131

I don't see an equivalent commit/code for those commits.

Well... I don't see any tracebacks in Jenkins as of today.

OK: no tracebacks during installation / upgrade
OK: code review
OK: Changelog entry
Comment 32 Florian Best univentionstaff 2021-05-25 16:01:01 CEST
UCS 5.0 has been released:
 https://docs.software-univention.de/release-notes-5.0-0-en.html
 https://docs.software-univention.de/release-notes-5.0-0-de.html

If this error occurs again, please use "Clone This Bug".