Example #1
0
    def execute_automation(self, job_interface: BackgroundProcessInterface,
                           request: CheckmkAutomationRequest) -> None:
        self._logger.info("Starting automation: %s", request.command)
        self._logger.debug(request)

        result = check_mk_local_automation(request.command, request.args, request.indata,
                                           request.stdin_data, request.timeout)

        # This file will be read by the get-status request
        result_file_path = os.path.join(job_interface.get_work_dir(), "result.mk")
        store.save_object_to_file(result_file_path, result)

        job_interface.send_result_message(_("Finished."))
Example #2
0
 def execute_automation(
     self,
     job_interface: BackgroundProcessInterface,
     api_request: CheckmkAutomationRequest,
 ) -> None:
     self._logger.info("Starting automation: %s", api_request.command)
     self._logger.debug(api_request)
     cmdline_cmd, serialized_result = check_mk_local_automation_serialized(
         command=api_request.command,
         args=api_request.args,
         indata=api_request.indata,
         stdin_data=api_request.stdin_data,
         timeout=api_request.timeout,
     )
     # This file will be read by the get-status request
     self._store_result(
         path=Path(job_interface.get_work_dir()) / "result.mk",
         serialized_result=serialized_result,
         automation_cmd=api_request.command,
         cmdline_cmd=cmdline_cmd,
     )
     job_interface.send_result_message(_("Finished."))