Univention Bugzilla – Bug 52960
[o365] Changing UCR default settings for usertoken script causes traceback due to missing conversion to int
Last modified: 2021-09-13 17:23:11 CEST
The script o365_usertokens is used within a cronjob to periodically reset usertokens in azure. The period between two resets can be configured via UCR, the default is 60 + up to 15 days. Manually configured settings set by admins in UCR does cause the script to fail, as the UCR value is not correctly converted to int, causing the following traceback: Traceback (most recent call last): File "/usr/share/univention-office365/scripts/o365_usertokens", line 127, in <module> next_mod_date = today + timedelta(days=base_reset_period + randrange(reset_period_modifier + 1)) TypeError: cannot concatenate 'str' and 'int' objects Fix: Parse values read from UCR as int.
453bbeab univention-office365 2.0.2-111A~4.4.0.202103191347 Reproduce: create udm user, o365 enabled ucr set office365/tokens/base_reset_period=12 /usr/share/univention-office365/scripts/o365_usertokens --invalidate-tokens -m (this is what the cronjob does)
OK - reproduce -> ucr set office365/tokens/base_reset_period=12 -> /usr/share/univention-office365/scripts/o365_usertokens --invalidate-tokens --modify proxy settings: {} service_plan_names=['SHAREPOINTWAC', 'SHAREPOINTWAC_DEVELOPER', 'OFFICESUBSCRIPTION', 'OFFICEMOBILE_SUBSCRIPTION', 'SHAREPOINTWAC_EDU'] status: 200 (OK) (POST https://graph.windows.net/d66c72f6-8dee-47ed-ac2b-7fdbe8b8a5d4/users/0af4e4cf-581c-4404-8ddd-db8e5c132ee5/invalidateAllRefreshTokens?api-version=1.6) Traceback (most recent call last): File "/usr/share/univention-office365/scripts/o365_usertokens", line 127, in <module> next_mod_date = today + timedelta(days=base_reset_period + randrange(reset_period_modifier + 1)) TypeError: cannot concatenate 'str' and 'int' objects OK - fixed with 2.0.2-112 -> ucr set office365/tokens/base_reset_period=12 -> /usr/share/univention-office365/scripts/o365_usertokens --invalidate-tokens --modify proxy settings: {} service_plan_names=['SHAREPOINTWAC', 'SHAREPOINTWAC_DEVELOPER', 'OFFICESUBSCRIPTION', 'OFFICEMOBILE_SUBSCRIPTION', 'SHAREPOINTWAC_EDU'] status: 200 (OK) (POST https://graph.windows.net/d66c72f6-8dee-47ed-ac2b-7fdbe8b8a5d4/users/0af4e4cf-581c-4404-8ddd-db8e5c132ee5/invalidateAllRefreshTokens?api-version=1.6) Modified user: fbx1, next reset will be 2021-04-03 Error: user fbx2 is not correctly synced to Azure (missing univentionOffice365Data attribute) Modified user: fbx3, next reset will be 2021-04-07
Published in App 'office365' version 4.0