Search in sources :

Example 1 with Command

use of com.iwave.ext.command.Command in project coprhd-controller by CoprHD.

the class SecureShellSupport method executeCommand.

public CommandOutput executeCommand(String commandString) {
    Command command = new Command();
    command.setCommand(commandString);
    executeCommand(command);
    return command.getOutput();
}
Also used : Command(com.iwave.ext.command.Command)

Example 2 with Command

use of com.iwave.ext.command.Command in project coprhd-controller by CoprHD.

the class ShellCommandExecutor method executeCommands.

public List<CommandOutput> executeCommands(List<? extends Command> commands) throws CommandException {
    List<CommandOutput> results = Lists.newArrayList();
    for (Command command : commands) {
        command.setCommandExecutor(this);
        command.execute();
        results.add(command.getOutput());
    }
    return results;
}
Also used : Command(com.iwave.ext.command.Command) CommandOutput(com.iwave.ext.command.CommandOutput)

Example 3 with Command

use of com.iwave.ext.command.Command 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

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