Bug 52434 - AttributeError and ImportError only prints warning for ucr modules and do not fail
AttributeError and ImportError only prints warning for ucr modules and do not...
Status: NEW
Product: UCS
Classification: Unclassified
Component: UCR
UCS 5.0
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS maintainers
UCS maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2020-11-26 10:24 CET by Jürn Brodersen
Modified: 2020-11-26 10:28 CET (History)
1 user (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: 2: Improvement: Would be a product improvement
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 Jürn Brodersen univentionstaff 2020-11-26 10:24:48 CET
AttributeError and ImportError only prints warning for ucr modules and do not fail

This is inconsistent with other python errors in a module, which produce an ucr error.

The problem is in "run_module" python/univention/config_registry/handler.py:202.
I guess only importing the module and not running it should be in the try...except block?

I'm not sure if we need that try...except at all. I would prefer an error if the import does not work.
Comment 1 Florian Best univentionstaff 2020-11-26 10:28:49 CET
 183 def run_module(modpath, arg, ucr, changes):
…
 202 »   try:
 203 »   »   module = __import__(module_name.replace(os.path.sep, '.'))
 204 »   »   arg2meth[arg](module)(ucr, changes)
 205 »   except (AttributeError, ImportError) as ex:
 206 »   »   print(ex, file=sys.stderr)