Bug 53969 - univention-run-diagnostic-checks always runs all or only one diagnostic module
univention-run-diagnostic-checks always runs all or only one diagnostic module
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - System diagnostic
UCS 4.4
Other Linux
: P5 normal (vote)
: UCS 5.0-1-errata
Assigned To: Nikola Radovanovic
Arvid Requate
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-21 12:20 CEST by Sönke Schwardt-Krummrich
Modified: 2022-02-16 12:07 CET (History)
4 users (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): bitesize, Usability
Max CVSS v3 score:


Attachments
Proposed solution (1.15 KB, text/plain)
2021-11-10 10:07 CET, Nikola Radovanovic
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sönke Schwardt-Krummrich univentionstaff 2021-10-21 12:20:30 CEST
univention-run-diagnostic-checks is only capable of running *all* or *only one* diagnostic module. For each start, credentials have to be specified.
It would be great, 
a) if more than one module can be specified on CLI and/or
b) if one or more module can be specified whose checks are skipped
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2021-10-21 12:23:40 CEST
This behaviour is really annoying in larger UCS@school environments where at least 911_ucsschool_consistency and 40_samba_tool_dbcheck take huge amounts of time and CPU.
Comment 2 Nikola Radovanovic univentionstaff 2021-11-10 10:07:36 CET
Created attachment 10861 [details]
Proposed solution

This is proposed solution, with (hopefully) minimal changes:

1. "-l/--list" action is treated separately, with its own flag in arguments
2. "-t/--test" is a list of plugins or "all" (which remains default option) but it allows separate tests to be listed
3. "-s/--skip" is a list of tests to be skipped. By default it is empty list

So use cases are as:
1. list avilable tests:
  python univention-run-diagnostic-checks -l
  or
  python univention-run-diagnostic-checks --list
2. execute all tests:
  python univention-run-diagnostic-checks
  or
  python univention-run-diagnostic-checks --test all
3. execute two specific tests:
  python univention-run-diagnostic-checks --test plugin_2 plugin_4
4. skip two specific tests:
  python univention-run-diagnostic-checks --skip plugin_2 plugin_4

Adding this to actual code is quite simple, but had to be tested
Comment 3 Florian Best univentionstaff 2021-11-10 10:19:52 CET
Thanks! Even if it's a proposed solution, can you create a merge request for it? You can mark the merge request as draft.
Comment 4 Nikola Radovanovic univentionstaff 2021-11-10 10:28:12 CET
Sure, no problem.
Comment 5 Nikola Radovanovic univentionstaff 2021-11-10 16:34:21 CET
I have created draft MR: https://git.knut.univention.de/univention/ucs/-/merge_requests/163 ,so please take a look and comment.
Comment 6 Florian Best univentionstaff 2021-11-10 16:49:36 CET
Thanks.
So the only difference is that the prior `-k list` is now `-l/--list` ?
Comment 7 Florian Best univentionstaff 2021-11-10 16:54:19 CET
I would support that as I already did last year:

https://forge.univention.org/bugzilla/show_bug.cgi?id=51942#c7
Comment 8 Nikola Radovanovic univentionstaff 2021-12-29 09:47:46 CET
719106aace | univention-run-diagnostic-checks always runs all or only one diagnostic module
5768b2b424 | Advisory update
Comment 9 Arvid Requate univentionstaff 2021-12-29 19:02:42 CET
Something still looks broken:

root@primary20:~# /usr/bin/univention-run-diagnostic-checks -l
Traceback (most recent call last):
  File "/usr/bin/univention-run-diagnostic-checks", line 151, in <module>
    sys.exit(CLIClient.main())
  File "/usr/bin/univention-run-diagnostic-checks", line 57, in main
    if args.help:
AttributeError: 'Namespace' object has no attribute 'help'

Also, if I temporarily fix that by commenting out that block of code,
then the "-l" option is never evaluated.


Also this behaves kind of strange:


root@primary20:~# /usr/bin/univention-run-diagnostic-checks -t 41_samba_tool_showrepl 40_samba_tool_dbcheck -s 40_samba_tool_dbcheck
Domain Admin Login: Administrator
Password: 

You can find the logging messages of the diagnostic modules at /var/log/univention/management-console-module-diagnostic.log

ran 00_check_server_password successfully.

ran 01_ssh_connection successfully.

ran 02_certificate_check successfully.

ran 03_check_notifier_replication successfully.

ran 04_saml_certificate_check successfully.

ran 10_gateway successfully.

ran 11_nameserver successfully.

ran 12_proxy successfully.

ran 20_check_nameservers successfully.

ran 21_check_join_status successfully.

ran 22_kdc_service successfully.

ran 23_check_update_sites successfully.

ran 30_disk_usage successfully.

ran 31_file_permissions successfully.

ran 32_security_limits successfully.

ran 41_samba_tool_showrepl successfully.

ran 43_connectors4_rejects successfully.

ran 44_well_known_sid_check successfully.

ran 45_heimdal_on_samba4_dc successfully.

ran 46_kerberos_ddns_update successfully.

ran 50_check_ucr_templates successfully.

ran 51_hostname_check successfully.

ran 52_mail_acl_sync successfully.

ran 53_package_status successfully.

ran 54_sources_list_check successfully.

ran 55_user_migration successfully.

ran 56_univention_types successfully.

ran 57_univention_server_role_windows successfully.

ran 58_check_memberOf successfully.

ran 59_ldap_server_name successfully.

ran 60_old_schema_registration successfully.
Comment 11 Nikola Radovanovic univentionstaff 2022-01-26 16:49:30 CET
719106aace | univention-run-diagnostic-checks always runs all or only one diagnostic module
5768b2b424 | Advisory update
3ba8ad6553 | Advisory update
37df3745ee | univention-run-diagnostic-checks always runs all or only one diagnostic module
76e88dda3a | Advisory update
Comment 12 Arvid Requate univentionstaff 2022-01-26 20:49:09 CET
Verified:
* Code review
* Package update
* Functional test: Ok (with combinations of -t & -s)
* Advisory

433458a292 | Philipp improved the advisory markup