Search in sources :

Example 6 with SSHCommandExecutor

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();
}
Also used : SSHCommandExecutor(com.iwave.utility.ssh.SSHCommandExecutor)

Example 7 with SSHCommandExecutor

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);
    }
}
Also used : SSHCommandExecutor(com.iwave.utility.ssh.SSHCommandExecutor)

Example 8 with SSHCommandExecutor

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();
}
Also used : Command(com.iwave.ext.command.Command) SSHCommandExecutor(com.iwave.utility.ssh.SSHCommandExecutor)

Aggregations

SSHCommandExecutor (com.iwave.utility.ssh.SSHCommandExecutor)8 Command (com.iwave.ext.command.Command)1