Bug #53223
Updated by Sebastian Wagner over 2 years ago
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. <pre> [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 </pre> You can see that the exception is generic above and yet the code uses the following call <pre><code class="python"> if self.snmp_version == 'V3': raise SpecValidationError( "must provide an engine_id for SNMP v3 notifications" ) </code></pre>