Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/150#discussion_r66239158
--- Diff:
software/base/src/main/java/org/apache/brooklyn/entity/software/base/AbstractSoftwareProcessWinRmDriver.java
---
@@ -321,12 +332,21 @@ public int copyTo(InputStream source, String
destination) {
}
public void rebootAndWait() {
+ rebootAndWait(null);
+ }
+
+ public void rebootAndWait(String hostname) {
try {
- executePsScriptNoRetry(ImmutableList.of("Restart-Computer
-Force"));
+ if (hostname != null) {
+
getLocation().executePsScript(ImmutableMap.of(WinRmTool.COMPUTER_NAME,
hostname), ImmutableList.of("Restart-Computer -Force"));
+ } else {
+
getLocation().executePsScript(ImmutableList.of("Restart-Computer -Force"));
+ }
} catch (Exception e) {
- // Restarting the computer will cause the command to fail;
ignore the exception and continue
+ LOG.warn("Exception when restarting machine: ", e);
--- End diff --
I'd prefer this exception message to indicate that it is an expected
exception. If someone looks in the logs and sees this problem, it will look
like there was a problem restarting.
Should we also log at debug? Can we narrow down the kind of exception(s) we
expect? (if we're not 100% certain, that's absolutely fine to just catch
Exception).
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---