Bug 47940 - Support join hooks in univention-join
Support join hooks in univention-join
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: Join (univention-join)
UCS 4.3
Other Linux
: P5 normal (vote)
: UCS 4.4
Assigned To: Felix Botner
Arvid Requate
: interim-3
Depends on: 48801
Blocks: 48679 47942
  Show dependency treegraph
 
Reported: 2018-10-10 12:02 CEST by Felix Botner
Modified: 2019-03-12 13:41 CET (History)
2 users (show)

See Also:
What kind of report is it?: Development Internal
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

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Botner univentionstaff 2018-10-10 12:02:43 CEST
univention-join should support 

 * pre-join
 * pre-joiscripts
 * post-joinscripts

hooks.
Comment 1 Felix Botner univentionstaff 2018-10-11 11:01:53 CEST
branch school/joinhooks
Comment 2 Felix Botner univentionstaff 2018-10-12 10:53:43 CEST
Implementation:

 * univention-join-hooks has been added, looks for settings/code with specified
   hooktype and runs the hook code

 * new helper run_join_hook in joinscripthelper.lib

 * univention-join
  * run_join_hook pre-join - before computer account creation
  * run_join_hook pre-joinscripts - before joinscripts
  * run_join_hook post-joinscripts - after joinscripts

 * univention-run-join-scripts
  * run_join_hook pre-joinscripts - before running join scripts
  * run_join_hook post-joinscript - safter running joinscripts

Hooks can (and will be) be executed multiple times (univention-run-join-scripts) and therefore have to be idempotent.
Comment 3 Felix Botner univentionstaff 2018-10-12 13:43:08 CEST
We have to ignore the hooks in appbox!
Comment 4 Felix Botner univentionstaff 2018-10-12 16:12:51 CEST
We need a test for this.
Comment 5 Felix Botner univentionstaff 2019-02-08 11:31:36 CET
The new feature is already merged into 4.4-0 (Bug #47957).

So at this bug we only need to 

 * ignore the join hooks in appbox
 * add a test for this
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2019-02-11 09:08:50 CET
(In reply to Felix Botner from comment #5)
> So at this bug we only need to 
>  * ignore the join hooks in appbox

Just to be sure: I think, this should be part of the join hooks itself, so we are still able to call join hooks within docker appbox images.
Comment 7 Felix Botner univentionstaff 2019-02-11 09:46:38 CET
(In reply to Sönke Schwardt-Krummrich from comment #6)
> (In reply to Felix Botner from comment #5)
> > So at this bug we only need to 
> >  * ignore the join hooks in appbox
> 
> Just to be sure: I think, this should be part of the join hooks itself, so
> we are still able to call join hooks within docker appbox images.

Yes, that makes sense, so on thins bug only one last task

 * add a test for join hooks
Comment 8 Sönke Schwardt-Krummrich univentionstaff 2019-02-12 15:59:52 CET
(In reply to Felix Botner from comment #0)
>  * pre-joiscripts
>  * post-joinscripts

Can we rename these hook types to "pre-joinscript" and "post-joinscript" (singular not plural)?
This would improve the clarity since the settings/data object contains only ONE script and not several.
Comment 9 Felix Botner univentionstaff 2019-02-12 17:33:23 CET
(In reply to Sönke Schwardt-Krummrich from comment #8)
> (In reply to Felix Botner from comment #0)
> >  * pre-joiscripts
> >  * post-joinscripts
> 
> Can we rename these hook types to "pre-joinscript" and "post-joinscript"
> (singular not plural)?
> This would improve the clarity since the settings/data object contains only
> ONE script and not several.

as discussed, i changed the join hooks to
 * join/pre-join
 * join/pre-joinscripts
 * join/post-joinscripts
and added some debug output to univention-join-hooks

added tests/11_join/15join_hooks to ucs-test
Comment 10 Sönke Schwardt-Krummrich univentionstaff 2019-02-14 14:12:16 CET
univention-join does not show any progress/message if the join hooks are called.
Depending on the hook, this may take some time. Maybe we should print something like "Calling join hooks", and "done" before/after univention-join-hooks is called.

output on stdout:
root@slave152:~# univention-join
univention-join: joins a computer to an ucs domain
copyright (c) 2001-2019 Univention GmbH, Germany

Enter DC Master Account : Administrator
Enter DC Master Password:

Search DC Master:                                          done
Check DC Master:                                           done
Stop LDAP Server:                                          done
Search ldap/base                                           done
Start LDAP Server:                                         done
Search LDAP binddn                                         done
Sync time:                                                 done
Join Computer Account:                                     done
Sync ldap-backup.secret:                                   done
Check TLS connection:                                      done
Download host certificate:                                 done
Restart LDAP Server:                                       done
Sync Kerberos settings:                                    done
Create kerberos/adminserver
File: /etc/krb5.conf
←←←←←←←←←←← here the hook is called
Configure 01univention-ldap-server-init.inst               done
Configure 03univention-directory-listener.inst             done
Configure 04univention-ldap-client.inst                    done
Configure 05univention-bind.inst                           done
Configure 08univention-apache.inst                         done
Configure 10univention-ldap-server.inst                    done
Comment 11 Felix Botner univentionstaff 2019-02-14 15:00:26 CET
added 

Running pre/post-joinscripts hook(s):                           done

to univention-join and univention-run-join-scripts

f82b4711f9edcba39d1e0e75c98ea336229e45e7 - univention-join
610393132ea7555443052e86ca5e91e6c87b1dbb - changelog
Comment 12 Arvid Requate univentionstaff 2019-02-25 20:36:49 CET
I fixed a minor thing: the last commit wrote the current package version and copyright year into the file, instead of the @%@copyright_year@%@ etc.

89a71e921c | fix minor collateral commit damage

Package: univention-join
Version: 11.0.1-13A~4.4.0.201902252035
Branch: ucs_4.4-0
Comment 13 Arvid Requate univentionstaff 2019-03-04 16:39:20 CET
Ok:
* Code review
* Test cases
* Changelog
Comment 14 Florian Best univentionstaff 2019-03-12 13:41:13 CET
UCS 4.4 has been released:
 https://docs.software-univention.de/release-notes-4.4-0-en.html
 https://docs.software-univention.de/release-notes-4.4-0-de.html

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