Bug 52661 - [O365] Update to App v3.3: Joinscript may fail when updating from previous version
[O365] Update to App v3.3: Joinscript may fail when updating from previous ve...
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Office 365
UCS 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: Erik Damrose
Felix Botner
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-01-15 12:08 CET by Erik Damrose
Modified: 2021-01-18 18:29 CET (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.137
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2021011221000272
Bug group (optional):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Damrose univentionstaff 2021-01-15 12:08:28 CET
Due to a logic error in the joinscript 40univention-office365.inst, the joinscript run will not complete and be marked as such when updating to app version 3.3. This will occur if the app was installed with version 3.1 or less (JS Version <=5) and has been updated to app version 3.2 (JS Version 6), before updating to app version 3.3 (JS Version 7). This will affect most installed app versions and cause support tickets. There is no easy workaround. Marking joinscript v7 as successful is not sufficient, as a re-run of the joinscript will cause the same error.

Error in appcenter.log:

 30299 packages                         21-01-12 09:44:01 [    INFO]: Neue Version der Konfigurationsdatei /etc/univention/registry.info/variables/univention-office365.cfg wird installiert ...
 30299 packages                         21-01-12 09:44:01 [    INFO]: File: /etc/cron.d/univention-office365-token
 30299 packages                         21-01-12 09:44:07 [    INFO]: Calling joinscript 40univention-office365.inst ...
 30299 packages                         21-01-12 09:44:07 [    INFO]: 2021-01-12 09:44:07.471247343+01:00 (in joinscript_init)
...
 30299 packages                         21-01-12 09:44:51 [    INFO]: Object exists: cn=UniventionOffice365GroupADConnectionAlias,cn=custom attributes,cn=univention,dc=ucs,dc=internal
 30299 packages                         21-01-12 09:44:52 [    INFO]: ERROR: Object not found in UDM.
 30299 packages                         21-01-12 09:44:53 [    INFO]:  ERROR: Object not found in UDM.
 30299 packages                         21-01-12 09:44:54 [    INFO]:   Azure AD connection alias defaultADconnection is already listed in UCR office365/adconnection/alias/.
 30299 packages                         21-01-12 09:44:55 [    INFO]:  AzureAuth.is_initialized('defaultADconnection'): KeyError('client_id',)
 30299 packages                         21-01-12 09:44:55 [    INFO]: Error: Azure AD connection 'defaultADconnection' is not initialized after copying. Exiting.
 30299 packages                         21-01-12 09:44:55 [    INFO]: Joinscript 40univention-office365.inst finished with exitcode 1

The fix is to run parts of the joinscript for migrating data/settings only if it has not been done before.
Comment 1 Erik Damrose univentionstaff 2021-01-15 12:17:33 CET
f60ce79f Fix logic to only execute migration steps if they have not been done before

univention-office365 2.0.2-99A~4.4.0.202101151214

To reproduce the original issue:

#Install app v3.1
univention-app install office365=3.1

# Setup azure ad connection, or unrelated errors will occur when updating.
# "update" to app v3.2
univention-app install office365=3.2

# upgrade to current latest v3.3 with e.g. univention-upgrade or UMC app center
Comment 2 Felix Botner univentionstaff 2021-01-15 14:45:08 CET
fail - for new installations JS_LAST_EXECUTED_VERSION seems to be 0 and
       both conditions matches, join scripts fails azure connections 
       migrate block

OK - update
Comment 3 Felix Botner univentionstaff 2021-01-15 14:47:25 CET
(In reply to Felix Botner from comment #2)
> fail - for new installations JS_LAST_EXECUTED_VERSION seems to be 0 and
>        both conditions matches, join scripts fails azure connections 
>        migrate block
> 
> OK - update

found this in 96univention-samba4.inst:

if [ $JS_LAST_EXECUTED_VERSION -lt 4 ] && [ $JS_LAST_EXECUTED_VERSION -gt 0 ]; then

so at least for the azure connections migrate block we might need something like this
Comment 4 Erik Damrose univentionstaff 2021-01-15 15:17:14 CET
(In reply to Felix Botner from comment #3)
> so at least for the azure connections migrate block we might need something
> like this

The extattrs should be created with the correctly renamed settings, so we need it for both blocks.


Thanks for catching this.

Fixed in 
git 18d1025
univention-office365   2.0.2-100A~4.4.0.202101151506
Comment 5 Felix Botner univentionstaff 2021-01-15 16:22:23 CET
OK, looks good
Comment 6 Erik Damrose univentionstaff 2021-01-18 18:29:41 CET
Released with Univention Microsoft 365 Connector v3.4