use of com.iwave.utility.ssh.SSHCommandExecutor in project coprhd-controller by CoprHD.
the class HpuxSystem method executeCommand.
@Override
public void executeCommand(Command command, int timeout) {
SSHCommandExecutor executor = new SSHCommandExecutor(getHost(), getPort(), getUsername(), getPassword());
executor.setCommandTimeout(timeout);
executor.setSudoPrefix("export PATH=$PATH:/usr/local/bin; sudo -S -p '' sh -c ");
command.setCommandExecutor(executor);
command.execute();
}
use of com.iwave.utility.ssh.SSHCommandExecutor in project coprhd-controller by CoprHD.
the class AbstractAssetValidator method setSSHTimeout.
public static void setSSHTimeout(CommandExecutor executor, int connect, int read, int complete) {
if (executor instanceof SSHCommandExecutor) {
SSHCommandExecutor sshExecutor = (SSHCommandExecutor) executor;
sshExecutor.setConnectTimeout(connect);
sshExecutor.setReadTimeout(connect);
sshExecutor.setCommandTimeout(complete);
}
}
use of com.iwave.utility.ssh.SSHCommandExecutor in project coprhd-controller by CoprHD.
the class CustomServicesRemoteAnsibleExecution method executeRemoteCmd.
// Execute Ansible playbook on remote node. Playbook is also in remote node
private CommandOutput executeRemoteCmd(final String extraVars, final CustomServicesDBRemoteAnsiblePrimitive primitive) {
final Map<String, CustomServicesWorkflowDocument.InputGroup> inputType = step.getInputGroups();
if (inputType == null) {
return null;
}
logger.debug("user:{} password:{}", AnsibleHelper.getOptions(CustomServicesConstants.REMOTE_USER, input), AnsibleHelper.getOptions(CustomServicesConstants.REMOTE_PASSWORD, input));
final SSHCommandExecutor executor = new SSHCommandExecutor(AnsibleHelper.getOptions(CustomServicesConstants.REMOTE_NODE, input), 22, AnsibleHelper.getOptions(CustomServicesConstants.REMOTE_USER, input), AnsibleHelper.getOptions(CustomServicesConstants.REMOTE_PASSWORD, input));
executor.setCommandTimeout((int) timeout);
final Command command = new RemoteCommand(extraVars, input, primitive);
command.setCommandExecutor(executor);
command.execute();
return command.getOutput();
}
Aggregations