@Override public T apply(String input) { return TypeCoercions.coerce(Strings.trimEnd(input), (Class<T>) sensor.getType()); }}, SshValueFunctions.stdout()));
@Override public T apply(String input) { return TypeCoercions.coerce(Strings.trimEnd(input), (Class<T>) sensor.getType()); }}, SshValueFunctions.stdout()));
String inspect = Strings.trimEnd(slave.execCommand(sudo("docker inspect -f '{{.State.Pid}}' " + containerId))); String dockerPid = Iterables.find(Splitter.on(CharMatcher.anyOf("\r\n")).omitEmptyStrings().split(inspect), StringPredicates.matchesRegex("^[0-9]+$"));
ImmutableList.of("cat "+driver.getRunDir() + '/' + VanillaSoftwareProcessSshDriver.PID_FILENAME), MutableMap.<String,Object>of()); int launchedProcessPid = Integer.parseInt(Strings.trimEnd(new String(stdOut.toByteArray()))); log.info(format("Pid of launched long running process %d.", launchedProcessPid)); ScriptHelper stopCommandScriptHelper = driver.stopCommandScriptHelper();
@Override public void install() { // TODO: At some point in the future, this should probably be refactored to get the name of the machine in WinRmMachineLocation and set it as the hostname sensor String hostname = null; if (entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) { WinRmExecuteHelper checkHostnameTask = newScript("Checking hostname") .setCommand("hostname") .failOnNonZeroResultCode() .gatherOutput(); checkHostnameTask.execute(); hostname = Strings.trimEnd(checkHostnameTask.getResultStdout()); } // TODO: Follow install path of VanillaSoftwareProcessSshDriver if(Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_COMMAND)) || Strings.isNonBlank(getEntity().getConfig(VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND))) { executeCommandInTask( getEntity().getConfig(VanillaWindowsProcess.INSTALL_COMMAND), getEntity().getConfig(VanillaWindowsProcess.INSTALL_POWERSHELL_COMMAND), "install-command", hostname); } if (entity.getConfig(VanillaWindowsProcess.INSTALL_REBOOT_REQUIRED)) { rebootAndWait(hostname); } }