From e4839b048040877cc7d780d2d98b25233db62537 Mon Sep 17 00:00:00 2001 From: Stanislav Levin Date: Sep 21 2021 06:28:41 +0000 Subject: command_defaults: Don't crash on nonexistent command It's common for ipa commands to raise NotFound in such a case. Fixes: https://pagure.io/freeipa/issue/8954 Signed-off-by: Stanislav Levin Reviewed-By: Florence Blanc-Renaud --- diff --git a/ipaserver/plugins/schema.py b/ipaserver/plugins/schema.py index dd5f2fa..d56cf28 100644 --- a/ipaserver/plugins/schema.py +++ b/ipaserver/plugins/schema.py @@ -292,6 +292,13 @@ class command_defaults(PKQuery): ) def execute(self, name, **options): + if name not in self.api.Command: + raise errors.NotFound( + reason=_("{oname}: {command_name} not found").format( + oname=self.name, command_name=name + ) + ) + command = self.api.Command[name] params = options.get('params') or []