@@ -110,24 +110,31 @@ def manual_commands(self, params: Dict[str, Any], context: ExecutionContext) ->
110110
111111 def execute (self , params : Dict [str , Any ], context : ExecutionContext ) -> PluginResult :
112112 missing : list [str ] = []
113+ errors : list [dict [str , Any ]] = []
113114 stdout_parts : list [str ] = []
114115 stderr_parts : list [str ] = []
115- for command in self .manual_commands (params , context ):
116+ checked = self .manual_commands (params , context )
117+ for command in checked :
116118 rc , out , err = exec_remote (context , command )
117119 stdout_parts .append (out )
118120 stderr_parts .append (err )
119- if rc != 0 :
121+ if rc == 1 :
120122 missing .append (command )
123+ elif rc != 0 :
124+ errors .append ({"command" : command , "rc" : rc , "stderr" : err })
121125 stdout = "\n " .join (part for part in stdout_parts if part )
122126 stderr = "\n " .join (part for part in stderr_parts if part )
123- checked = self .manual_commands (params , context )
124- return PluginResult .success (
125- changed = False ,
126- rc = 0 ,
127- stdout = stdout ,
128- stderr = stderr ,
129- data = {"checked" : checked , "failed" : missing , "matches" : not missing },
130- )
127+ data = {"checked" : checked , "failed" : missing , "matches" : not missing and not errors }
128+ if errors :
129+ data ["errors" ] = errors
130+ return PluginResult .failure (
131+ rc = errors [0 ]["rc" ],
132+ stdout = stdout ,
133+ stderr = stderr ,
134+ message = "os.capability.check failed with a technical command error" ,
135+ data = data ,
136+ )
137+ return PluginResult .success (changed = False , rc = 0 , stdout = stdout , stderr = stderr , data = data )
131138
132139
133140class PluginRequirementsPlugin (BasePlugin ):
0 commit comments