From 977bf13c690d78c17d61627d7befccbf047b410d Mon Sep 17 00:00:00 2001 From: AZero13 Date: Wed, 17 Dec 2025 18:45:11 -0500 Subject: [PATCH] Remove unreachable python code " raise sudo.PluginError("You are not allowed to run this command!")" I know this is an example but still. We should do this the right way. --- plugins/python/example_policy_plugin.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/python/example_policy_plugin.py b/plugins/python/example_policy_plugin.py index e226c46712..c772c29ae1 100644 --- a/plugins/python/example_policy_plugin.py +++ b/plugins/python/example_policy_plugin.py @@ -68,10 +68,9 @@ def check_policy(self, argv: tuple, env_add: tuple): cmd = argv[0] # Example for a simple reject: if not self._is_command_allowed(cmd): - sudo.log_error("You are not allowed to run this command!") - return sudo.RC.REJECT - - raise sudo.PluginError("You are not allowed to run this command!") + error_msg = "You are not allowed to run this command!" + sudo.log_error(error_msg) + raise sudo.PluginReject(error_msg) # The environment the command will be executed with (we allow any here) user_env_out = sudo.options_from_dict(self.user_env) + env_add