commandline.createArg().setValue( "700" );
commandline.createArg().setValue( sshKeysTarget.getCanonicalPath() );
CommandLineUtils.StringStreamConsumer out = new CommandLineUtils.StringStreamConsumer();
CommandLineUtils.StringStreamConsumer err = new CommandLineUtils.StringStreamConsumer();
int exitCode = CommandLineUtils.executeCommandLine( commandline, out, err );
Streams streams = new Streams();
streams.setOut( out.getOutput() );
streams.setErr( err.getOutput() );
if ( exitCode != 0 )
{
throw new RuntimeException(
"fail to chmod exit code " + exitCode + ", error" + streams.getErr() + ", out "
+ streams.getOut() );
}
authInfo.setPrivateKey( new File( sshKeysTarget, "id_rsa" ).getCanonicalPath() );
return authInfo;