提交 04a874ac 编写于 作者: I Ing. Pavel Janousek

[JENKINS-31098] Deletage remove a node back to Computer.doDoDelete()

上级 6aba76dc
......@@ -29,6 +29,7 @@ import hudson.model.Node;
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 @@ public class DeleteNodeCommand extends CLICommand {
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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册