Skip to content

Commit

Permalink
BEE-52312 - change constructor signature to avoid breaking changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgarciacloudbees committed Nov 12, 2024
1 parent 7f12293 commit 905f8e8
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/main/java/hudson/slaves/CommandLauncher.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,13 @@ public CommandLauncher(String command) throws Descriptor.FormException {
* "sh -c" or write the expression into a script and point to the script)
* @param env environment variables for the launcher to include when it runs the command
*/
public CommandLauncher(String command, EnvVars env) throws Descriptor.FormException {
checkSandbox();
public CommandLauncher(String command, EnvVars env) {
try {
checkSandbox();
} catch (Descriptor.FormException ex) {
throw new RuntimeException(ex);

Check warning on line 107 in src/main/java/hudson/slaves/CommandLauncher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 106-107 are not covered by tests
}

this.agentCommand = command;
this.env = env;
ScriptApproval.get().preapprove(command, SystemCommandLanguage.get());
Expand Down Expand Up @@ -300,20 +305,18 @@ public boolean filterType(@NonNull Class<?> contextClass, @NonNull Descriptor de
}

private boolean isCreatingNewObject() {
boolean isCreating = false;

if (Stapler.getCurrentRequest() != null) {

Check warning on line 308 in src/main/java/hudson/slaves/CommandLauncher.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 308 is only partially covered, one branch is missing
List<Ancestor> ancs = Stapler.getCurrentRequest().getAncestors();
for (Ancestor anc : ancs) {
if (!isCreating && anc.getObject() instanceof ComputerSet) {
if (anc.getObject() instanceof ComputerSet) {
String uri = Stapler.getCurrentRequest().getOriginalRequestURI();
if (uri.endsWith("createItem")) {
isCreating = true;
return true;
}
}
}
}
return isCreating;
return false;
}
}
}

0 comments on commit 905f8e8

Please sign in to comment.