Search in sources :

Example 1 with CLIMethod

use of hudson.cli.declarative.CLIMethod in project hudson-2.x by hudson.

the class Hudson method doReload.

/**
 * Reloads the configuration.
 */
@CLIMethod(name = "reload-configuration")
public synchronized HttpResponse doReload() throws IOException {
    checkPermission(ADMINISTER);
    // engage "loading ..." UI and then run the actual task in a separate thread
    WebAppController.get().install(new HudsonIsLoading());
    new Thread("Hudson config reload thread") {

        @Override
        public void run() {
            try {
                SecurityContextHolder.getContext().setAuthentication(ACL.SYSTEM);
                reload();
            } catch (IOException e) {
                LOGGER.log(Level.SEVERE, "Failed to reload Hudson config", e);
            } catch (ReactorException e) {
                LOGGER.log(Level.SEVERE, "Failed to reload Hudson config", e);
            } catch (InterruptedException e) {
                LOGGER.log(Level.SEVERE, "Failed to reload Hudson config", e);
            }
        }
    }.start();
    return HttpResponses.redirectViaContextPath("/");
}
Also used : ReactorException(org.jvnet.hudson.reactor.ReactorException) IOException(java.io.IOException) HudsonIsLoading(hudson.util.HudsonIsLoading) UDPBroadcastThread(hudson.UDPBroadcastThread) CLIMethod(hudson.cli.declarative.CLIMethod)

Example 2 with CLIMethod

use of hudson.cli.declarative.CLIMethod in project hudson-2.x by hudson.

the class Computer method cliOffline.

/**
 * CLI command to mark the node offline.
 */
@CLIMethod(name = "offline-node")
public void cliOffline(@Option(name = "-m", usage = "Record the note about why you are disconnecting this node") String cause) throws ExecutionException, InterruptedException {
    checkPermission(Hudson.ADMINISTER);
    setTemporarilyOffline(true, new ByCLI(cause));
}
Also used : ByCLI(hudson.slaves.OfflineCause.ByCLI) CLIMethod(hudson.cli.declarative.CLIMethod)

Aggregations

CLIMethod (hudson.cli.declarative.CLIMethod)2 UDPBroadcastThread (hudson.UDPBroadcastThread)1 ByCLI (hudson.slaves.OfflineCause.ByCLI)1 HudsonIsLoading (hudson.util.HudsonIsLoading)1 IOException (java.io.IOException)1 ReactorException (org.jvnet.hudson.reactor.ReactorException)1