99
1010from automax .core .models import ExecutionContext , PluginResult
1111from automax .plugins .base import BasePlugin , PluginValidationError , RenderedFileInstallMixin
12- from automax .plugins .remote_utils import CHANGE_MARKER , exec_remote , quote , result_from_remote , sudo_prefix
12+ from automax .plugins .remote_utils import CHANGE_MARKER , exec_remote , predicate_result_from_remote , quote , result_from_remote , sudo_prefix
1313
1414
1515
@@ -170,7 +170,7 @@ def execute(self, params: Dict[str, Any], context: ExecutionContext) -> PluginRe
170170
171171class UdevRuleCheckPlugin (BasePlugin ):
172172 name = "device.udev.rule.check"
173- description = "Assert that a udev rules file exists and optionally matches rendered content."
173+ description = "Check whether a udev rules file exists and optionally matches rendered content."
174174 required_params = ("path" ,)
175175 optional_params = ("content" , "rules" , "sudo" )
176176 opens_remote_session = True
@@ -187,4 +187,11 @@ def manual_commands(self, params: Dict[str, Any], context: ExecutionContext) ->
187187
188188 def execute (self , params : Dict [str , Any ], context : ExecutionContext ) -> PluginResult :
189189 rc , out , err = exec_remote (context , self .manual_commands (params , context )[0 ])
190- return result_from_remote (rc = rc , stdout = out , stderr = err , message = "device.udev.rule.check failed" , data = {"path" : str (params ["path" ])})
190+ return predicate_result_from_remote (
191+ rc = rc ,
192+ stdout = out ,
193+ stderr = err ,
194+ message = "device.udev.rule.check failed" ,
195+ data_key = "matches" if ("content" in params or "rules" in params ) else "exists" ,
196+ data = {"path" : str (params ["path" ])},
197+ )
0 commit comments