You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2016/06/15 20:09:47 UTC
[1/4] brooklyn-server git commit: Fail on non-0 exit code when
setting up a location
Repository: brooklyn-server
Updated Branches:
refs/heads/master 3451d4c20 -> 36be4a311
Fail on non-0 exit code when setting up a location
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/b2cb9ac0
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/b2cb9ac0
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/b2cb9ac0
Branch: refs/heads/master
Commit: b2cb9ac0fdf5c2640a93c7fa7747287c2802dd27
Parents: f410f80
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue May 31 12:36:07 2016 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Tue May 31 12:36:07 2016 +0300
----------------------------------------------------------------------
.../location/jclouds/JcloudsLocation.java | 59 +++++++++++++++++---
1 file changed, 50 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/b2cb9ac0/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index ebce579..1cf2535 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -867,9 +867,15 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
String scriptContent = ResourceUtils.create(this).getResourceAsString(setupScriptItem);
String script = TemplateProcessor.processTemplateContents(scriptContent, getManagementContext(), substitutions);
if (windows) {
- ((WinRmMachineLocation)machineLocation).executeCommand(ImmutableList.copyOf((script.replace("\r", "").split("\n"))));
+ WinRmToolResponse resp = ((WinRmMachineLocation)machineLocation).executeCommand(ImmutableList.copyOf((script.replace("\r", "").split("\n"))));
+ if (resp.getStatusCode() != 0) {
+ throw new IllegalStateException("Command 'Customizing node " + this + "' failed with exit code " + resp.getStatusCode() + " for location " + machineLocation);
+ }
} else {
- ((SshMachineLocation)machineLocation).execCommands("Customizing node " + this, ImmutableList.of(script));
+ executeCommandThrowingOnError(
+ (SshMachineLocation)machineLocation,
+ "Customizing node " + this,
+ ImmutableList.of(script));
}
}
}
@@ -880,7 +886,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
} else {
customisationForLogging.add("point /dev/random to urandom");
- ((SshMachineLocation)machineLocation).execCommands("using urandom instead of random",
+ executeCommandThrowingOnError(
+ (SshMachineLocation)machineLocation,
+ "using urandom instead of random",
Arrays.asList("sudo mv /dev/random /dev/random-real", "sudo ln -s /dev/urandom /dev/random"));
}
}
@@ -893,7 +901,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
} else {
customisationForLogging.add("configure hostname");
- ((SshMachineLocation)machineLocation).execCommands("Generate hostname " + node.getName(),
+ executeCommandThrowingOnError(
+ (SshMachineLocation)machineLocation,
+ "Generate hostname " + node.getName(),
Arrays.asList("sudo hostname " + node.getName(),
"sudo sed -i \"s/HOSTNAME=.*/HOSTNAME=" + node.getName() + "/g\" /etc/sysconfig/network",
"sudo bash -c \"echo 127.0.0.1 `hostname` >> /etc/hosts\"")
@@ -931,14 +941,23 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
for (String rule : iptablesRules) {
batch.add(rule);
if (batch.size() == 50) {
- ((SshMachineLocation)machineLocation).execCommands("Inserting iptables rules, 50 command batch", batch);
+ executeCommandWarningOnError(
+ (SshMachineLocation)machineLocation,
+ "Inserting iptables rules, 50 command batch",
+ batch);
batch.clear();
}
}
if (batch.size() > 0) {
- ((SshMachineLocation)machineLocation).execCommands("Inserting iptables rules", batch);
+ executeCommandWarningOnError(
+ (SshMachineLocation)machineLocation,
+ "Inserting iptables rules",
+ batch);
}
- ((SshMachineLocation)machineLocation).execCommands("List iptables rules", ImmutableList.of(IptablesCommands.listIptablesRule()));
+ executeCommandWarningOnError(
+ (SshMachineLocation)machineLocation,
+ "List iptables rules",
+ ImmutableList.of(IptablesCommands.listIptablesRule()));
}
}
}
@@ -957,7 +976,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
} else {
cmds = ImmutableList.of(IptablesCommands.iptablesServiceStop(), IptablesCommands.iptablesServiceStatus());
}
- ((SshMachineLocation)machineLocation).execCommands("Stopping iptables", cmds);
+ executeCommandWarningOnError(
+ (SshMachineLocation)machineLocation,
+ "Stopping iptables", cmds);
}
}
@@ -970,7 +991,9 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
for (String keyUrl : extraKeyUrlsToAuth) {
extraKeyDataToAuth.add(ResourceUtils.create().getResourceAsString(keyUrl));
}
- ((SshMachineLocation)machineLocation).execCommands("Authorizing ssh keys",
+ executeCommandThrowingOnError(
+ (SshMachineLocation)machineLocation,
+ "Authorizing ssh keys",
ImmutableList.of(new AuthorizeRSAPublicKeys(extraKeyDataToAuth).render(org.jclouds.scriptbuilder.domain.OsFamily.UNIX)));
}
}
@@ -1060,6 +1083,24 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
throw Exceptions.propagate(e);
}
}
+
+ private void executeCommandThrowingOnError(SshMachineLocation loc, String name, List<String> commands) {
+ executeCommandThrowingOnError(ImmutableMap.<String, Object>of(), loc, name, commands);
+ }
+
+ private void executeCommandThrowingOnError(Map<String, Object> flags, SshMachineLocation loc, String name, List<String> commands) {
+ int ret = loc.execCommands(flags, name, commands);
+ if (ret != 0) {
+ throw new IllegalStateException("Command '" + name + "' failed with exit code " + ret + " for location " + loc);
+ }
+ }
+
+ private void executeCommandWarningOnError(SshMachineLocation loc, String name, List<String> commands) {
+ int ret = loc.execCommands(name, commands);
+ if (ret != 0) {
+ LOG.warn("Command '{}' failed with exit code {} for location {}", new Object[] {name, ret, this});
+ }
+ }
// ------------- suspend and resume ------------------------------------
[2/4] brooklyn-server git commit: Implement dontRequireTtyForSudo for
locations
Posted by al...@apache.org.
Implement dontRequireTtyForSudo for locations
Analogous to the SoftwareProcess behaviour, but applied when obtaining a location
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/bd165c12
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/bd165c12
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/bd165c12
Branch: refs/heads/master
Commit: bd165c125d5c9c89a7c2decbed8c6d6a181f9fa5
Parents: b2cb9ac
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue May 31 12:36:57 2016 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Tue May 31 12:36:57 2016 +0300
----------------------------------------------------------------------
.../location/jclouds/JcloudsLocation.java | 16 ++++++++++++++++
.../location/jclouds/JcloudsLocationConfig.java | 18 ++++++++++++++++--
2 files changed, 32 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bd165c12/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 1cf2535..8247043 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -879,6 +879,22 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
}
}
}
+
+ Boolean dontRequireTtyForSudo = setup.get(JcloudsLocationConfig.DONT_REQUIRE_TTY_FOR_SUDO);
+ if (Boolean.TRUE.equals(dontRequireTtyForSudo) ||
+ dontRequireTtyForSudo == null && setup.get(DONT_CREATE_USER)) {
+ if (windows) {
+ LOG.warn("Ignoring flag DONT_REQUIRE_TTY_FOR_SUDO on Windows location {}", machineLocation);
+ } else {
+ customisationForLogging.add("patch /etc/sudoers to disable requiretty");
+
+ executeCommandThrowingOnError(
+ ImmutableMap.<String, Object>of(SshTool.PROP_ALLOCATE_PTY.getName(), true),
+ (SshMachineLocation)machineLocation,
+ "patch /etc/sudoers to disable requiretty",
+ ImmutableList.of(BashCommands.dontRequireTtyForSudo()));
+ }
+ }
if (setup.get(JcloudsLocationConfig.MAP_DEV_RANDOM_TO_DEV_URANDOM)) {
if (windows) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bd165c12/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java
index 1403a9f..feed7a8 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java
@@ -79,8 +79,11 @@ public interface JcloudsLocationConfig extends CloudLocationConfig {
public static final ConfigKey<Boolean> AUTO_ASSIGN_FLOATING_IP = ConfigKeys.newBooleanConfigKey("autoAssignFloatingIp",
"Whether to generate floating ips (in Nova paralance), or elastic IPs (in CloudStack parlance)");
- public static final ConfigKey<Boolean> DONT_CREATE_USER = ConfigKeys.newBooleanConfigKey("dontCreateUser",
- "Whether to skip creation of 'user' when provisioning machines (default false)", false);
+ public static final ConfigKey<Boolean> DONT_CREATE_USER = ConfigKeys.newBooleanConfigKey("dontCreateUser",
+ "Whether to skip creation of 'user' when provisioning machines (default false). " +
+ "Note that setting this will prevent jclouds from overwriting /etc/sudoers which might be " +
+ "configured incorrectly by default. See 'dontRequireTtyForSudo' for details.",
+ false);
public static final ConfigKey<Boolean> GRANT_USER_SUDO = ConfigKeys.newBooleanConfigKey("grantUserSudo",
"Whether to grant the created user sudo privileges. Irrelevant if dontCreateUser is true. Default: true.", true);
public static final ConfigKey<Boolean> DISABLE_ROOT_AND_PASSWORD_SSH = ConfigKeys.newBooleanConfigKey("disableRootAndPasswordSsh",
@@ -173,6 +176,17 @@ public interface JcloudsLocationConfig extends CloudLocationConfig {
public static final ConfigKey<Boolean> INCLUDE_BROOKLYN_USER_METADATA = ConfigKeys.newBooleanConfigKey("includeBrooklynUserMetadata",
"Whether to set metadata about the context of a machine, e.g. brooklyn-entity-id, brooklyn-app-name (default true)", true);
+ // See also SoftwareProcess.DONT_REQUIRE_TTY_FOR_SUDO
+ public static final ConfigKey<Boolean> DONT_REQUIRE_TTY_FOR_SUDO = ConfigKeys.newBooleanConfigKey("dontRequireTtyForSudo",
+ "Whether to explicitly set /etc/sudoers, so don't need tty (will leave unchanged if 'false'); " +
+ "some machines require a tty for sudo; brooklyn by default does not use a tty " +
+ "(so that it can get separate error+stdout streams); you can enable a tty as an " +
+ "option to every ssh command, or you can do it once and " +
+ "modify the machine so that a tty is not subsequently required. " +
+ "Usually used in conjunction with 'dontCreateUser' since it will prevent " +
+ "jclouds from overwriting /etc/sudoers and overriding the system default. " +
+ "When not explicitly set will be applied if 'dontCreateUser' is set.");
+
public static final ConfigKey<Boolean> MAP_DEV_RANDOM_TO_DEV_URANDOM = ConfigKeys.newBooleanConfigKey(
"installDevUrandom", "Map /dev/random to /dev/urandom to prevent halting on insufficient entropy", true);
[4/4] brooklyn-server git commit: This closes #169
Posted by al...@apache.org.
This closes #169
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/36be4a31
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/36be4a31
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/36be4a31
Branch: refs/heads/master
Commit: 36be4a311d3412d160902aa2c108c44ee253c160
Parents: 3451d4c 48a2670
Author: Aled Sage <al...@gmail.com>
Authored: Wed Jun 15 21:09:30 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Wed Jun 15 21:09:30 2016 +0100
----------------------------------------------------------------------
.../brooklyn/util/core/task/ssh/SshTasks.java | 18 +++-
.../location/jclouds/JcloudsLocation.java | 105 +++++++++++++++++--
.../location/jclouds/JcloudsLocationConfig.java | 18 +++-
3 files changed, 126 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/36be4a31/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/36be4a31/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocationConfig.java
----------------------------------------------------------------------
[3/4] brooklyn-server git commit: Execute location obtain commands as
tasks
Posted by al...@apache.org.
Execute location obtain commands as tasks
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/48a26707
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/48a26707
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/48a26707
Branch: refs/heads/master
Commit: 48a267079b4ab04ed68ce21f0b31941222c18488
Parents: bd165c1
Author: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Authored: Tue May 31 14:58:19 2016 +0300
Committer: Svetoslav Neykov <sv...@cloudsoftcorp.com>
Committed: Fri Jun 3 17:19:40 2016 +0300
----------------------------------------------------------------------
.../brooklyn/util/core/task/ssh/SshTasks.java | 18 +++++--
.../location/jclouds/JcloudsLocation.java | 50 ++++++++++++++++----
2 files changed, 54 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/48a26707/core/src/main/java/org/apache/brooklyn/util/core/task/ssh/SshTasks.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/util/core/task/ssh/SshTasks.java b/core/src/main/java/org/apache/brooklyn/util/core/task/ssh/SshTasks.java
index c9fd66b..1ecc461 100644
--- a/core/src/main/java/org/apache/brooklyn/util/core/task/ssh/SshTasks.java
+++ b/core/src/main/java/org/apache/brooklyn/util/core/task/ssh/SshTasks.java
@@ -18,6 +18,8 @@
*/
package org.apache.brooklyn.util.core.task.ssh;
+import java.util.Arrays;
+import java.util.List;
import java.util.Map;
import javax.annotation.Nullable;
@@ -71,12 +73,20 @@ import com.google.common.collect.Maps;
public class SshTasks {
private static final Logger log = LoggerFactory.getLogger(SshTasks.class);
-
+
public static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, String ...commands) {
- return newSshExecTaskFactory(machine, true, commands);
+ return newSshExecTaskFactory(machine, Arrays.asList(commands));
}
-
+
public static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, final boolean useMachineConfig, String ...commands) {
+ return newSshExecTaskFactory(machine, useMachineConfig, Arrays.asList(commands));
+ }
+
+ public static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, List<String> commands) {
+ return newSshExecTaskFactory(machine, true, commands);
+ }
+
+ public static ProcessTaskFactory<Integer> newSshExecTaskFactory(SshMachineLocation machine, final boolean useMachineConfig, List<String> commands) {
return new PlainSshExecTaskFactory<Integer>(machine, commands) {
{
if (useMachineConfig)
@@ -167,7 +177,7 @@ public class SshTasks {
BashCommands.dontRequireTtyForSudo(),
// strange quotes are to ensure we don't match against echoed stdin
BashCommands.sudo("echo \"sudo\"-is-working-"+id))
- .summary("setting up sudo")
+ .summary("patch /etc/sudoers to disable requiretty")
.configure(SshTool.PROP_ALLOCATE_PTY, true)
.allowingNonZeroExitCode()
.returning(new Function<ProcessTaskWrapper<?>,Boolean>() { public Boolean apply(ProcessTaskWrapper<?> task) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/48a26707/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
index 8247043..8c1ae46 100644
--- a/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/org/apache/brooklyn/location/jclouds/JcloudsLocation.java
@@ -58,6 +58,7 @@ import org.apache.brooklyn.api.location.NoMachinesAvailableException;
import org.apache.brooklyn.api.location.PortRange;
import org.apache.brooklyn.api.mgmt.AccessController;
import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.api.mgmt.TaskAdaptable;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.config.ConfigKey.HasConfigKey;
import org.apache.brooklyn.core.BrooklynVersion;
@@ -99,8 +100,13 @@ import org.apache.brooklyn.util.core.internal.ssh.SshTool;
import org.apache.brooklyn.util.core.internal.winrm.WinRmTool;
import org.apache.brooklyn.util.core.internal.winrm.WinRmToolResponse;
import org.apache.brooklyn.util.core.task.DynamicTasks;
+import org.apache.brooklyn.util.core.task.DynamicTasks.TaskQueueingResult;
import org.apache.brooklyn.util.core.task.TaskBuilder;
+import org.apache.brooklyn.util.core.task.TaskInternal;
import org.apache.brooklyn.util.core.task.Tasks;
+import org.apache.brooklyn.util.core.task.ssh.SshTasks;
+import org.apache.brooklyn.util.core.task.system.ProcessTaskFactory;
+import org.apache.brooklyn.util.core.task.system.ProcessTaskWrapper;
import org.apache.brooklyn.util.core.text.TemplateProcessor;
import org.apache.brooklyn.util.exceptions.CompoundRuntimeException;
import org.apache.brooklyn.util.exceptions.Exceptions;
@@ -882,17 +888,14 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
Boolean dontRequireTtyForSudo = setup.get(JcloudsLocationConfig.DONT_REQUIRE_TTY_FOR_SUDO);
if (Boolean.TRUE.equals(dontRequireTtyForSudo) ||
- dontRequireTtyForSudo == null && setup.get(DONT_CREATE_USER)) {
+ (dontRequireTtyForSudo == null && setup.get(DONT_CREATE_USER))) {
if (windows) {
LOG.warn("Ignoring flag DONT_REQUIRE_TTY_FOR_SUDO on Windows location {}", machineLocation);
} else {
customisationForLogging.add("patch /etc/sudoers to disable requiretty");
- executeCommandThrowingOnError(
- ImmutableMap.<String, Object>of(SshTool.PROP_ALLOCATE_PTY.getName(), true),
- (SshMachineLocation)machineLocation,
- "patch /etc/sudoers to disable requiretty",
- ImmutableList.of(BashCommands.dontRequireTtyForSudo()));
+ queueLocationTask("patch /etc/sudoers to disable requiretty",
+ SshTasks.dontRequireTtyForSudo((SshMachineLocation)machineLocation, true).newTask().asTask());
}
}
@@ -1105,14 +1108,41 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation im
}
private void executeCommandThrowingOnError(Map<String, Object> flags, SshMachineLocation loc, String name, List<String> commands) {
- int ret = loc.execCommands(flags, name, commands);
- if (ret != 0) {
- throw new IllegalStateException("Command '" + name + "' failed with exit code " + ret + " for location " + loc);
+ Task<Integer> task = SshTasks.newSshExecTaskFactory(loc, commands)
+ .summary(name)
+ .requiringExitCodeZero()
+ .configure(flags)
+ .newTask()
+ .asTask();
+ queueLocationTask("waiting for '" + name + "' on machine " + loc, task);
+ }
+
+ protected <T> T queueLocationTask(String msg, Task<T> task) {
+ TaskQueueingResult<T> queueResult = DynamicTasks.queueIfPossible(task);
+ final String origDetails = Tasks.setBlockingDetails(msg);
+ try {
+ if(queueResult.isQueuedOrSubmitted()){
+ return task.getUnchecked();
+ } else {
+ // TODO Should we add an `orExecuteInSameThread()` in `TaskQueueingResult`?
+ try {
+ return ((TaskInternal<T>)task).getJob().call();
+ } catch (Exception e) {
+ throw Exceptions.propagate(e);
+ }
+ }
+ } finally {
+ Tasks.setBlockingDetails(origDetails);
}
}
private void executeCommandWarningOnError(SshMachineLocation loc, String name, List<String> commands) {
- int ret = loc.execCommands(name, commands);
+ Task<Integer> task = SshTasks.newSshExecTaskFactory(loc, commands)
+ .summary(name)
+ .allowingNonZeroExitCode()
+ .newTask()
+ .asTask();
+ int ret = queueLocationTask("waiting for '" + name + "' on machine " + loc, task);
if (ret != 0) {
LOG.warn("Command '{}' failed with exit code {} for location {}", new Object[] {name, ret, this});
}