Skip to content
Permalink
Browse files
Merge pull request #1882 from pjanouse/JENKINS-31098
[JENKINS-31098] Deletage remove a node back to Computer.doDoDelete()
  • Loading branch information
oleg-nenashev committed Oct 24, 2015
2 parents be8c574 + 04a874a commit 0a56c1d5078bc6f36a305ee25538eeff1a0e2442
Showing 2 changed files with 8 additions and 10 deletions.
@@ -29,6 +29,7 @@
import jenkins.model.Jenkins;
import org.kohsuke.args4j.Argument;

import java.nio.file.AccessDeniedException;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Logger;
@@ -77,15 +78,12 @@ protected int run() throws Exception {
continue;
}

try {
node.checkPermission(Computer.DELETE);
} catch (Exception e) {
stderr.println(e.getMessage());
errorOccurred = true;
continue;
}

jenkins.removeNode(node);
node.toComputer().doDoDelete();
} catch (AccessDeniedException e) {
stderr.println(e.getMessage());
errorOccurred = true;
//noinspection UnnecessaryContinue
continue;
} catch (Exception e) {
final String errorMsg = String.format("Unexpected exception occurred during deletion of node '%s': %s",
node == null ? "(null)" : node.toComputer().getName(),
@@ -48,7 +48,7 @@ public class DeleteNodeCommandTest {

@Before public void setUp() {

command = new CLICommandInvoker(j, new DeleteNodeCommand());
command = new CLICommandInvoker(j, "delete-node");
}

@Test public void deleteNodeShouldFailWithoutNodeDeletePermission() throws Exception {

0 comments on commit 0a56c1d

Please sign in to comment.