From 2afdec0afb77ce52edf68bf3c6eb66c778d36e8a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Sat, 9 Mar 2019 14:51:22 +0100 Subject: [CompileIPxeLegacy] (Re-)add log output --- .../taskmanager/tasks/CompileIPxeLegacy.java | 28 ++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java index 6e2e297..c55276e 100644 --- a/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java +++ b/src/main/java/org/openslx/taskmanager/tasks/CompileIPxeLegacy.java @@ -9,7 +9,9 @@ import java.util.concurrent.atomic.AtomicBoolean; import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; import org.openslx.satserver.util.Exec; +import org.openslx.satserver.util.Exec.ExecCallback; import org.openslx.taskmanager.api.AbstractTask; +import org.openslx.taskmanager.api.BoundedLog; import com.google.gson.annotations.Expose; @@ -144,11 +146,12 @@ public class CompileIPxeLegacy extends AbstractTask return false; } // Compile - if ( 0 != Exec.syncAt( 240, "/opt/openslx/ipxe/src", "make", "EMBED=../ipxelinux.ipxe,../pxelinux.0", "bin/undionly.kkkpxe" ) ) { + ProcLogger pl = new ProcLogger(); + if ( 0 != Exec.syncAt( 240, pl, "/opt/openslx/ipxe/src", "make", "EMBED=../ipxelinux.ipxe,../pxelinux.0", "bin/undionly.kkkpxe" ) ) { status.error = "Compiling ipxelinux.0 failed"; return false; } - if ( 0 != Exec.syncAt( 240, "/opt/openslx/ipxe/src", "make", "EMBED=../usb.ipxe,../pxelinux.0", "bin/ipxe.usb" ) ) { + if ( 0 != Exec.syncAt( 240, pl, "/opt/openslx/ipxe/src", "make", "EMBED=../usb.ipxe,../pxelinux.0", "bin/ipxe.usb" ) ) { FileUtils.deleteQuietly( new File( "/opt/openslx/ipxe/openslx-bootstick.raw" ) ); status.error = "Compiling ipxe usb image failed"; return false; @@ -173,6 +176,27 @@ public class CompileIPxeLegacy extends AbstractTask class Output { protected String error = null; + protected final BoundedLog log = new BoundedLog( 20, true ); + + protected void addLog( String data ) + { + log.addLog( data ); + } + } + + private class ProcLogger implements ExecCallback + { + @Override + public void processStdOut( String line ) + { + status.addLog( line ); + } + + @Override + public void processStdErr( String line ) + { + status.addLog( line ); + } } } -- cgit v1.2.3-55-g7522