mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-17 05:52:26 +00:00
pushing these methods up in the inheritance hierarchy to make logs accessible for all Computer derived classes.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11403 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
4c893a3f30
commit
d876beffbe
2 files changed
+24
-23
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package hudson.model;
|
||||
|
||||
import hudson.EnvVars;
|
||||
import hudson.Util;
|
||||
import hudson.slaves.ComputerLauncher;
|
||||
import hudson.slaves.RetentionStrategy;
|
||||
import hudson.node_monitors.NodeMonitor;
|
||||
@@ -18,6 +19,7 @@ import hudson.util.ExceptionCatchingThreadFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -31,6 +33,7 @@ import javax.servlet.ServletException;
|
||||
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.framework.io.*;
|
||||
import org.kohsuke.stapler.export.Exported;
|
||||
import org.kohsuke.stapler.export.ExportedBean;
|
||||
|
||||
@@ -80,6 +83,20 @@ public abstract class Computer extends AbstractModelObject implements AccessCont
|
||||
setNode(node);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the log from the remote agent goes.
|
||||
*/
|
||||
protected File getLogFile() {
|
||||
return new File(Hudson.getInstance().getRootDir(),"slave-"+nodeName+".log");
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string representation of the slave log.
|
||||
*/
|
||||
public String getLog() throws IOException {
|
||||
return Util.loadFile(getLogFile());
|
||||
}
|
||||
|
||||
public ACL getACL() {
|
||||
return Hudson.getInstance().getAuthorizationStrategy().getACL(this);
|
||||
}
|
||||
@@ -476,6 +493,13 @@ public abstract class Computer extends AbstractModelObject implements AccessCont
|
||||
req.getView(this,"_script.jelly").forward(req,rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles incremental log.
|
||||
*/
|
||||
public void doProgressiveLog( StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
new org.kohsuke.stapler.framework.io.LargeText(getLogFile(),false).doProgressText(req,rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current {@link Computer} that the build is running.
|
||||
* This method only works when called during a build, such as by
|
||||
|
||||
@@ -9,7 +9,6 @@ import hudson.util.StreamTaskListener;
|
||||
import hudson.util.NullStream;
|
||||
import hudson.util.RingBufferLogHandler;
|
||||
import hudson.FilePath;
|
||||
import hudson.Util;
|
||||
import hudson.maven.agent.Main;
|
||||
import hudson.maven.agent.PluginManagerInterceptor;
|
||||
|
||||
@@ -29,7 +28,6 @@ import java.util.ArrayList;
|
||||
|
||||
import org.kohsuke.stapler.StaplerRequest;
|
||||
import org.kohsuke.stapler.StaplerResponse;
|
||||
import org.kohsuke.stapler.framework.io.LargeText;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -71,13 +69,6 @@ public final class SlaveComputer extends Computer {
|
||||
this.acceptingTasks = acceptingTasks;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is where the log from the remote agent goes.
|
||||
*/
|
||||
private File getLogFile() {
|
||||
return new File(Hudson.getInstance().getRootDir(),"slave-"+nodeName+".log");
|
||||
}
|
||||
|
||||
public SlaveComputer(Slave slave) {
|
||||
super(slave);
|
||||
}
|
||||
@@ -292,20 +283,6 @@ public final class SlaveComputer extends Computer {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the string representation of the slave log.
|
||||
*/
|
||||
public String getLog() throws IOException {
|
||||
return Util.loadFile(getLogFile());
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles incremental log.
|
||||
*/
|
||||
public void doProgressiveLog( StaplerRequest req, StaplerResponse rsp) throws IOException {
|
||||
new LargeText(getLogFile(),false).doProgressText(req,rsp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Serves jar files for JNLP slave agents.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user