mirror of https://github.com/apache/jclouds.git
Fixes Run SSH script for passwords with special characters (as parentheses)
This commit is contained in:
parent
053dfd0134
commit
8228994850
|
@ -112,7 +112,8 @@ public class RunScriptOnNodeUsingSsh implements RunScriptOnNode {
|
|||
public String execAsRoot(String command) {
|
||||
if (node.getCredentials().identity.equals("root")) {
|
||||
} else if (node.getCredentials().shouldAuthenticateSudo()) {
|
||||
command = String.format("sudo -S sh <<'%s'\n%s\n%s%s\n", MARKER, node.getCredentials().getOptionalPassword().get(), command, MARKER);
|
||||
command = String.format("sudo -S sh <<'%s'\n'%s'\n%s%s\n", MARKER, node.getCredentials().getOptionalPassword
|
||||
().get(), command, MARKER);
|
||||
} else {
|
||||
command = String.format("sudo sh <<'%s'\n%s%s\n", MARKER, command, MARKER);
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class RunScriptOnNodeUsingSshTest {
|
|||
expect(sshClient.getUsername()).andReturn("tester");
|
||||
expect(sshClient.getHostAddress()).andReturn("somewhere.example.com");
|
||||
expect(
|
||||
sshClient.exec("sudo -S sh <<'RUN_SCRIPT_AS_ROOT_SSH'\n" + "testpassword!\n" + "echo $USER\n"
|
||||
sshClient.exec("sudo -S sh <<'RUN_SCRIPT_AS_ROOT_SSH'\n" + "'testpassword!'\n" + "echo $USER\n"
|
||||
+ "echo $USER\n" + "RUN_SCRIPT_AS_ROOT_SSH\n")).andReturn(new ExecResponse("root\nroot\n", null, 0));
|
||||
sshClient.disconnect();
|
||||
replay(sshClient);
|
||||
|
|
Loading…
Reference in New Issue