Bug 50408 - ucs-school-purge-expired-users throws error if PyHook ext_config_dep_on_role.py is active
ucs-school-purge-expired-users throws error if PyHook ext_config_dep_on_role....
Status: NEW
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-10-23 16:04 CEST by Valentin Heidelberger
Modified: 2022-09-07 11:18 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 1: Nuisance – not a big deal but noticeable
User Pain: 0.011
Enterprise Customer affected?:
School Customer affected?: Yes
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 Valentin Heidelberger univentionstaff 2019-10-23 16:04:28 CEST
ext_config_dep_on_role.py allows users to extend the config of ucs-school-import depending on the user role. It's shipped with UCS@school by default in pyhooks-available/ but must be activated manually by copying it to pyhooks/.

ucs-school-purge-expired-users throws an error if the hook is activated. It doesn't stop so it's not as big a problem as bug 50406. On a customer system I checked for expired accounts which haven't been deleted but couldn't find any so it seems to be a cosmetic issue.  Not sure if this could be problematic when the role-specific config contains different grace periods or similar settings.
From my understand that shouldn't be a problem because the ucsschoolPurgeTimestamp is set  during the import and only read by ucs-school-purge-expired-users but I wanted to mention it.

2019-10-23 15:18:29 INFO  ucs-school-purge-expired-users.main:135  ------ UCS@school import tool starting ------
2019-10-23 15:18:29 INFO  configuration.read:92  Reading configuration from '/usr/share/ucs-school-import/configs/global_defaults.json'...
2019-10-23 15:18:29 INFO  configuration.read:92  Reading configuration from '/var/lib/ucs-school-import/configs/global.json'...
2019-10-23 15:18:29 INFO  configuration.read:92  Reading configuration from '/usr/share/ucs-school-import/configs/user_import_defaults.json'...
2019-10-23 15:18:29 INFO  configuration.read:92  Reading configuration from '/var/lib/ucs-school-import/configs/user_import.json'...
2019-10-23 15:18:29 INFO  configuration._set_username_maxlength:65  UCRV ucsschool/username/max_length: None
2019-10-23 15:18:29 INFO  configuration._set_username_maxlength:73  Set value of configuration key username:max_length:default to default value of UCR variable ucsschool/username/max_length: 20.
2019-10-23 15:18:29 INFO  configuration._set_username_maxlength:82  Set value of configuration key username:max_length:student to username:max_length:default reduced by length of the exam-prefix ('exam-'): 15.
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'ConfigPyHook' in: /usr/share/ucs-school-import/pyhooks...
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes: ExtendConfigByRole
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_objects:163  Loaded hooks: {'post_config_files_read': ['ExtendConfigByRole.post_config_files_read']}.
2019-10-23 15:18:29 INFO  import_pyhook.call_hooks:147  Running ImportPyHookLoader post_config_files_read hook <bound method ExtendConfigByRole.post_config_files_read of <ext_config_dep_on_role.ExtendConfigByRole object at 0x7fd3966b2dd0>
> ...
2019-10-23 15:18:29 ERROR ext_config_dep_on_role.preconditions_met:121  Exiting hook: hook requires a fixed role but "user_role" is None.
2019-10-23 15:18:29 INFO  configuration.setup_configuration:58  Finished reading configuration, starting checks...
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'ConfigurationChecks' in: /usr/share/ucs-school-import/checks...
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_classes:124  Hook class 'SingleSourcePartialImportConfigurationChecks' filtered out by is_module_in_config().
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_classes:124  Hook class 'KasselImportConfigurationChecks' filtered out by is_module_in_config().
2019-10-23 15:18:29 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes: DefaultConfigurationChecks
Comment 1 Oliver Friedrich univentionstaff 2022-09-07 11:18:21 CEST
Still valid for UCS5!

2022-09-07 11:16:56 INFO  pyhooks_loader.get_hook_classes:116  Searching for hooks of type 'ConfigPyHook' in: /usr/share/ucs-school-import/pyhooks...
2022-09-07 11:16:56 INFO  pyhooks_loader.get_hook_classes:143  Found hook classes: ExtendConfigByRole
2022-09-07 11:16:56 INFO  pyhooks_loader.get_hook_objects:210  Loaded hooks: {'post_config_files_read': ['ExtendConfigByRole.post_config_files_read']}.
2022-09-07 11:16:56 INFO  import_pyhook.call_hooks:167  Running ImportPyHookLoader post_config_files_read hook <bound method ExtendConfigByRole.post_config_files_read of <ext_config_dep_on_role.ExtendConfigByRole
object at 0x7f2484426c50>> ...
2022-09-07 11:16:56 ERROR ext_config_dep_on_role.preconditions_met:129  Exiting hook: unknown role ''.
2022-09-07 11:16:56 INFO  configuration.setup_configuration:63  Finished reading configuration, starting checks...
2022-09-07 11:16:56 INFO  pyhooks_loader.get_hook_classes:116  Searching for hooks of type 'ConfigurationChecks' in: /usr/share/ucs-school-import/checks...
2022-09-07 11:16:56 INFO  pyhooks_loader.get_hook_classes:143  Found hook classes: SingleSourcePartialImportConfigurationChecks, DefaultConfigurationChecks
2022-09-07 11:16:56 WARNING configuration_checks.run_configuration_checks:123  Skipping configuration check 'test_00_required_config_keys'.
2022-09-07 11:16:56 DEBUG base.get_udm_object:841  Getting School UDM object by dn: ou=DeaktivierteKonten,dc=qs,dc=schule-sh,dc=de
2022-09-07 11:16:56 INFO  default_user_import_factory.load_methods_from_config:128  DefaultUserImportFactory.make_user_importer is now <class 'ucsschool.importer.mass_import.sisopi_user_import.SingleSourcePartialU
serImport'>.
2022-09-07 11:16:56 DEBUG username_handler.__init__:303  UsernameHandler(max_length=15, dry_run=True) storage_backend='MemoryStorageBackend'
2022-09-07 11:16:56 INFO  ucs-school-purge-expired-users.main:146  ------ UCS@school import tool configured ------