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("/");
}
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));
}
Aggregations