def execute_toolkit_command(self, pipeline_config_path, command, args): """ Execute Toolkit Command :param pipeline_config_path: String Pipeline configuration path :param command: Commands :param args: List Script arguments :returns: (stdout, stderr, returncode) Returns standard process output """ self._verify_pipeline_configuration(pipeline_config_path) if not command.startswith("shotgun"): raise ExecuteTankCommandError("ExecuteTankCommand error. Command needs to be a shotgun command [{command}]".format(command=command)) try: # # Get toolkit Script Path exec_script = self._get_full_toolkit_path(pipeline_config_path) # Get toolkit script argument list script_args = [command] + args # # Launch script exec_command = [exec_script] + script_args return_code, out, err = Command.call_cmd(exec_command) return (out, err, return_code) except Exception, e: # call_cmd is not including sentitive information in the error message, so this won't # either. raise Exception("Error executing toolkit command: " + e.message)
def execute_toolkit_command(self, pipeline_config_path, command, args): """ Execute Toolkit Command :param pipeline_config_path: String Pipeline configuration path :param command: Commands :param args: List Script arguments :returns: (stdout, stderr, returncode) Returns standard process output """ self._verify_pipeline_configuration(pipeline_config_path) if not command.startswith("shotgun"): raise ExecuteTankCommandError( "ExecuteTankCommand error. Command needs to be a shotgun command [{command}]" .format(command=command)) try: # # Get toolkit Script Path exec_script = self._get_full_toolkit_path(pipeline_config_path) # Get toolkit script argument list script_args = [command] + args # # Launch script exec_command = [exec_script] + script_args return_code, out, err = Command.call_cmd(exec_command) return (out, err, return_code) except Exception, e: # call_cmd is not including sentitive information in the error message, so this won't # either. raise Exception("Error executing toolkit command: " + e.message)
def _launch_process(self, launcher, filepath, message_error="Error executing command."): """ Standard way of starting a process and handling errors. :params launcher: Path of executable :params filepath: File to pass as executable argument. :params message_error: String to prefix error message in case of an error. :returns: Bool If the operation was successful """ args = [launcher, filepath] return_code, out, err = Command.call_cmd(args) has_error = return_code != 0 if has_error: # Do not log the command line, it might contain sensitive information. raise Exception( "{message_error}\nReturn code: {return_code}\nOutput: {std_out}\nError: {std_err}" .format(message_error=message_error, return_code=return_code, std_out=out, std_err=err)) return True
def _launch_process(self, launcher, filepath, message_error="Error executing command."): """ Standard way of starting a process and handling errors. :params launcher: Path of executable :params filepath: File to pass as executable argument. :params message_error: String to prefix error message in case of an error. :returns: Bool If the operation was successful """ args = [launcher, filepath] return_code, out, err = Command.call_cmd(args) has_error = return_code != 0 if has_error: # Do not log the command line, it might contain sensitive information. raise Exception("{message_error}\nReturn code: {return_code}\nOutput: {std_out}\nError: {std_err}" .format(message_error=message_error, return_code=return_code, std_out=out, std_err=err)) return True