本文整理了Java中org.apache.brooklyn.location.winrm.WinRmMachineLocation.executePsScript()
方法的一些代码示例,展示了WinRmMachineLocation.executePsScript()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WinRmMachineLocation.executePsScript()
方法的具体详情如下:
包路径:org.apache.brooklyn.location.winrm.WinRmMachineLocation
类名称:WinRmMachineLocation
方法名:executePsScript
暂无
代码示例来源:origin: org.apache.brooklyn/brooklyn-test-framework
@Override
public WinRmToolResponse call() throws Exception {
// FIXME Do I need COMPUTER_NAME in flags?
return machine.executePsScript(psScript);
}
});
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-winrm
public WinRmToolResponse executePsScript(List<String> psScript) {
return executePsScript(ImmutableMap.of(), psScript);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-winrm
public WinRmToolResponse executePsScript(String psScript) {
return executePsScript(ImmutableMap.of(), ImmutableList.of(psScript));
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Override
protected void createDirectory(String directoryName, String summaryForLogging) {
getLocation().executePsScript("New-Item -path \"" + directoryName + "\" -type directory -ErrorAction SilentlyContinue");
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
public int executePsScriptNoRetry(List<String> psScript) {
return getLocation().executePsScript(ImmutableMap.of(WinRmTool.PROP_EXEC_TRIES, 1), psScript).getStatusCode();
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
public int executePsScript(List<String> psScript) {
return getLocation().executePsScript(psScript).getStatusCode();
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
private void assertExecPsSucceeds(List<String> cmds, String stdout, String stderr) {
Stopwatch stopwatch = Stopwatch.createStarted();
assertSucceeded(cmds, machine.executePsScript(cmds), stdout, stderr, stopwatch);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
private void assertExecPsSucceeds(String cmd, String stdout, String stderr) {
Stopwatch stopwatch = Stopwatch.createStarted();
assertSucceeded(cmd, machine.executePsScript(cmd), stdout, stderr, stopwatch);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
private void assertExecPsFails(String cmd) {
Stopwatch stopwatch = Stopwatch.createStarted();
assertFailed(cmd, machine.executePsScript(cmd), stopwatch);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
private void assertExecPsFails(List<String> cmds) {
Stopwatch stopwatch = Stopwatch.createStarted();
assertFailed(cmds, machine.executePsScript(cmds), stopwatch);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
public void rebootAndWait(String hostname) {
try {
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) {
Throwable interestingCause = findExceptionCausedByWindowsRestart(e);
if (interestingCause != null) {
LOG.debug("Restarting... exception while closing winrm session from the restart command {}", getEntity(), e);
} else {
throw e;
}
}
waitForWinRmStatus(false, entity.getConfig(VanillaWindowsProcess.REBOOT_BEGUN_TIMEOUT));
waitForWinRmStatus(true, entity.getConfig(VanillaWindowsProcess.REBOOT_COMPLETED_TIMEOUT)).getWithError();
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-winrm
@Override
@SuppressWarnings("unchecked")
public T call() throws Exception {
Maybe<WinRmMachineLocation> machineLocationMaybe = Machines.findUniqueMachineLocation(entity.getLocations(), WinRmMachineLocation.class);
if (machineLocationMaybe.isAbsent()) {
return null;
}
WinRmMachineLocation machine = EffectorTasks.getMachine(entity, WinRmMachineLocation.class);
WinRmToolResponse response = machine.executePsScript(command);
return (T)response;
}
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
response = getLocation().executePsScript(winrmProps.build(), ImmutableList.of(powerShellCommand));
} else {
response = getLocation().executeCommand(winrmProps.build(), ImmutableList.of(regularCommand));
代码示例来源:origin: org.apache.brooklyn/brooklyn-software-base
@Test(groups={"Live", "WIP"})
public void testExecPsBatchFileExit3() throws Exception {
String script = "EXIT /B 3";
String scriptPath = "C:\\myscript-"+Identifiers.makeRandomId(4)+".bat";
machine.copyTo(new ByteArrayInputStream(script.getBytes()), scriptPath);
WinRmToolResponse response = machine.executePsScript("& '"+scriptPath+"'");
String msg = "statusCode="+response.getStatusCode()+"; out="+response.getStdOut()+"; err="+response.getStdErr();
assertEquals(response.getStatusCode(), 3, msg);
}
代码示例来源:origin: org.apache.brooklyn/brooklyn-locations-jclouds
protected void assertWinrmable(WinRmMachineLocation machine) {
WinRmToolResponse result = machine.executePsScript("echo mycmd");
assertEquals(result.getStatusCode(), 0, "status="+result.getStatusCode()+"; stdout="+result.getStdOut()+"; stderr="+result.getStdErr());
}
内容来源于网络,如有侵权,请联系作者删除!