Project

General

Profile

Bug #53223

Fun with subinterpreters: Exceptions showing traceback when SpecValidationError raised from service_spec.py module

Added by Paul Cuzner 3 months ago. Updated 3 months ago.

Status:
New
Priority:
Normal
Category:
orchestrator
Target version:
% Done:

0%

Source:
Tags:
Backport:
pacific
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

The service specs are using SpecValidationErrors to indicate issues, but the normal try/catch provided by the cli_write_command decorator is not catching these exceptions correctly.

e.g.

[ceph: root@cs8-snmp1 ~]# ceph orch apply snmp-gateway --snmp-version=V3  --destination=192.168.122.1 -i ./snmpv3_creds.yml 
Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/mgr_module.py", line 1618, in _handle_command
    return self.handle_command(inbuf, cmd)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 168, in handle_command
    return dispatch[cmd['prefix']].call(self, cmd, inbuf)
  File "/usr/share/ceph/mgr/mgr_module.py", line 416, in call
    return self.func(mgr, **kwargs)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 107, in <lambda>
    wrapper_copy = lambda *l_args, **l_kwargs: wrapper(*l_args, **l_kwargs)  # noqa: E731
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 96, in wrapper
    return func(*args, **kwargs)
  File "/usr/share/ceph/mgr/orchestrator/module.py", line 1230, in _apply_snmp_gateway
    return self._apply_misc([spec], dry_run, format, no_overwrite)
  File "/usr/share/ceph/mgr/orchestrator/module.py", line 1068, in _apply_misc
    raise_if_exception(completion)
  File "/usr/share/ceph/mgr/orchestrator/_interface.py", line 225, in raise_if_exception
    raise e
Exception: must provide an engine_id for SNMP v3 notifications

You can see that the exception is generic above and yet the code uses the following call

            if self.snmp_version == 'V3':
                raise SpecValidationError(
                    "must provide an engine_id for SNMP v3 notifications" 
                )

History

#1 Updated by Sebastian Wagner 3 months ago

  • Subject changed from Exceptions showing traceback when SpecValidationError raised from service_spec.py module to Fun with subinterpreters: Exceptions showing traceback when SpecValidationError raised from service_spec.py module
  • Description updated (diff)

Also available in: Atom PDF