提交 e283405c 编写于 作者: K kohsuke

added the reload-config command.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@22666 71c3de6d-444a-0410-be80-ed276b4c234a
上级 7786083e
......@@ -133,6 +133,8 @@ import org.kohsuke.stapler.StaplerFallback;
import org.kohsuke.stapler.WebApp;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.HttpRedirect;
import org.kohsuke.stapler.HttpResponses;
import org.kohsuke.stapler.HttpResponse;
import org.kohsuke.stapler.jelly.JellyClassLoaderTearOff;
import org.kohsuke.stapler.jelly.JellyRequestDispatcher;
import org.kohsuke.stapler.framework.adjunct.AdjunctManager;
......@@ -2649,14 +2651,12 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
/**
* Reloads the configuration.
*/
public synchronized void doReload( StaplerRequest req, StaplerResponse rsp ) throws IOException {
@CLIMethod(name="reload-config")
public synchronized HttpResponse doReload() throws IOException {
checkPermission(ADMINISTER);
// engage "loading ..." UI and then run the actual task in a separate thread
final ServletContext context = req.getServletContext();
context.setAttribute("app",new HudsonIsLoading());
rsp.sendRedirect2(req.getContextPath()+"/");
servletContext.setAttribute("app",new HudsonIsLoading());
new Thread("Hudson config reload thread") {
@Override
......@@ -2664,12 +2664,14 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
try {
load();
User.reload();
context.setAttribute("app",Hudson.this);
servletContext.setAttribute("app",Hudson.this);
} catch (IOException e) {
LOGGER.log(SEVERE,"Failed to reload Hudson config",e);
}
}
}.start();
return HttpResponses.redirectViaContextPath("/");
}
/**
......
......@@ -235,3 +235,4 @@ CLI.restart.shortDescription=Restart Hudson
CLI.keep-build.shortDescription=Mark the build to keep the build forever.
CLI.quiet-down.shortDescription=Quiet down Hudson, in preparation for a restart. Don''t start any builds.
CLI.cancel-quiet-down.shortDescription=Cancel the effect of the "quiet-down" command.
CLI.reload-config.shortDescription=Discard all the loaded data in memory and reload everything from file system. Useful when you modified config files directly on disk.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册