Bug 51683 - Remove no-ldap evaluation from System Setup
Remove no-ldap evaluation from System Setup
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: System setup
UCS 5.0
Other Linux
: P5 normal (vote)
: UCS 5.0
Assigned To: Daniel Tröder
Jürn Brodersen
: interim-3
: 53156 (view as bug list)
Depends on: 33008
Blocks: 53156
  Show dependency treegraph
 
Reported: 2020-07-17 12:11 CEST by Florian Best
Modified: 2021-05-25 16:03 CEST (History)
5 users (show)

See Also:
What kind of report is it?: ---
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 Florian Best univentionstaff 2020-07-17 12:11:18 CEST
(In reply to Philipp Hahn from comment #5)
> (In reply to Florian Best from comment #4)
> > Is more cleanup necessary?
> > Removing the "no-ldap" evaluation? Is this another bug?
> 
> Another bug as I lacked the deep understanding.

+++ This bug was initially created as a clone of Bug #33008 +++

ldap_available.sh was last called in UCS-3.0
 ucs-3.0/ucs/base/univention-system-setup/usr/share/univention-system-setup/univention-system-setup:
  testpipe = os.popen('/usr/lib/univention-system-setup/scripts/ldap_available.sh')

So after running setup-join.sh the file /var/run/univention-system-setup.ldap is created containing "no-ldap".
The file is not removed explicitly, but only after reboot by /lib/init/bootclean.sh.
Until then no LDAP objects are updated by calling UMC basic setup again.

It should probably be called once from umc/python/setup/util.py#run_scripts() just before calling the scripts.
It should also be rewritten in Python anyway, see attached patch.
Comment 1 Florian Best univentionstaff 2020-07-17 12:11:46 CEST
(In reply to Florian Best from comment #1)
> /usr/lib/univention-system-setup/scripts/setup-join.sh contains:
> echo "no-ldap" > /var/run/univention-system-setup.ldap
> 
> should this be changed to the script-call, too?
Comment 2 Florian Best univentionstaff 2021-05-12 13:43:10 CEST
*** Bug 53156 has been marked as a duplicate of this bug. ***
Comment 3 Daniel Tröder univentionstaff 2021-05-12 15:52:54 CEST
The status file /var/run/univention-system-setup.ldap is now removed at the end of the system-setup run in /usr/lib/univention-system-setup/cleanup-post.d/06_remove_no_ldap_status_file.

[5.0-0 6a5977419d] Bug #51683: cleanup univention-system-setup.ldap status file

univention-system-setup (13.0.3-25)

A DVD will automatically be built tonight. It can be used for the QA.
Comment 4 Florian Best univentionstaff 2021-05-12 17:43:17 CEST
This looks more like a workaround than a actual solution?
Does it work for systems which have been upgraded from UCS 4.4 which still have that file?
Why not remove the whole "no-ldap" logic as suggested in the initial bug creation? We need to clone it otherwise again.

base/univention-system-setup/usr/lib/univention-system-setup/scripts/10_basis/18root_password
> 49 ldap_available=1
> 50 if [ "$(cat /var/run/univention-system-setup.ldap)" = "no-ldap" ]; then
> 51 »   ldap_available=0
> 52 fi
→ At least the variable seems unused and can be removed.
Comment 5 Daniel Tröder univentionstaff 2021-05-14 09:46:28 CEST
* DVD builds.
* DVD-Install tests are successful.
* Manual test: installed and booted from fresh DVD: file /var/run/univention-system-setup.ldap was removed.

(In reply to Florian Best from comment #4)
> This looks more like a workaround than a actual solution?
It is the solution for the problem.
The problem being that during system-setup the LDAP gets purged and restarted a lot and thus some scripts should not write to it. To know that they shouldn't write to it even when it is running, an "information" must be available to them. That's this status file.

> Does it work for systems which have been upgraded from UCS 4.4 which still
> have that file?
They don't have that file anymore.
It was removed by /lib/init/bootclean.sh. (I don't know where that file can be found in our repositories.) You can just check your 4.4 systems.
But anyway: yes, it works for upgrades.

> Why not remove the whole "no-ldap" logic as suggested in the initial bug
> creation? We need to clone it otherwise again.
The initial bug report does not want to remove the logic. Its patch just moves the file removal code from /lib/init/bootclean.sh to util.py#run_scripts().

At the time the patch was written, the code in base/univention-system-setup/usr/lib/univention-system-setup/scripts/cleanup.py didn't yet exist. As it does now, this has become the place to go for cleanup code.

> base/univention-system-setup/usr/lib/univention-system-setup/scripts/
> 10_basis/18root_password
> > 49 ldap_available=1
> > 50 if [ "$(cat /var/run/univention-system-setup.ldap)" = "no-ldap" ]; then
> > 51 »   ldap_available=0
> > 52 fi
> → At least the variable seems unused and can be removed.

[5.0-0 9755038865] Bug #51683: remove unused content from ldap status file
[5.0-0 0bee3d3d9a] Bug #51683: remove unused variable

univention-system-setup (13.0.3-27)
Comment 6 Jürn Brodersen univentionstaff 2021-05-17 10:06:38 CEST
What I tested:
DVD install -> OK
Appliance install -> OK
/var/run/univention-system-setup.ldap -> created on system configuration start -> OK
/var/run/univention-system-setup.ldap -> removed after configuration is complete -> OK
/var/run/univention-system-setup.ldap exits -> no ldap changes through the network module -> OK
/var/run/univention-system-setup.ldap doesn't exit -> ldap object is updated through the network module -> OK
jenkins -> OK

I added this bug to the changelog entry bug 33008.
[5.0-0 02257391a3] Bug #51683: changelog



Notes:
/lib/init/bootclean.sh is part of the "initscripts" packages which isn't installed by default since 4.3, the /run directory should now be a tmpfs. The result is the same, a clean /run directory on each boot.
Comment 7 Florian Best univentionstaff 2021-05-25 16:03:33 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".