Package org.apache.hive.ptest.execution.ssh

Examples of org.apache.hive.ptest.execution.ssh.RSyncResult


  RSyncResult copyToDroneFromLocal(Drone drone, String localFile, String remoteFile)
      throws AbortDroneException, SSHExecutionException, IOException {
    Map<String, String> templateVariables = Maps.newHashMap(mTemplateDefaults);
    templateVariables.put("instanceName", drone.getInstanceName());
    templateVariables.put("localDir", drone.getLocalDirectory());
    RSyncResult result = new RSyncCommand(mRSyncCommandExecutor, drone.getPrivateKey(), drone.getUser(),
        drone.getHost(), drone.getInstance(),
        Templates.getTemplateResult(localFile, templateVariables),
        Templates.getTemplateResult(remoteFile, templateVariables),
        RSyncCommand.Type.FROM_LOCAL).call();
    if(result.getExitCode() != Constants.EXIT_CODE_SUCCESS) {
      throw new AbortDroneException("Drone " + drone + " exited with " +
          result.getExitCode() + ": " + result);
    }
    if(result.getException() != null || result.getExitCode() != 0) {
      throw new SSHExecutionException(result);
    }
    return result;
  }
View Full Code Here


          Preconditions.checkState(remoteStagingLocation == null, "Remote staging location must be null at the start of the loop");
          final Map<String, String> templateVariables = Maps.newHashMap(mTemplateDefaults);
          templateVariables.put("instanceName", drone.getInstanceName());
          templateVariables.put("localDir", drone.getLocalDirectory());
          String resolvedRemoteLocation = Files.simplifyPath(Templates.getTemplateResult(remoteFile, templateVariables));
          RSyncResult result = new RSyncCommand(mRSyncCommandExecutor, drone.getPrivateKey(), drone.getUser(),
              drone.getHost(), drone.getInstance(),
              resolvedLocalLocation,
              resolvedRemoteLocation,
              RSyncCommand.Type.FROM_LOCAL).call();
          if(result.getExitCode() == Constants.EXIT_CODE_SUCCESS) {
            remoteStagingLocation = resolvedRemoteLocation;
            drones.remove(drone);
            mLogger.info("Successfully staged " + resolvedLocalLocation + " on " + remoteStagingLocation);
            break;
          } else {
            mDrones.remove(drone);
            mLogger.error("Aborting drone during rsync",
                new AbortDroneException("Drone " + drone + " exited with "
                    + result.getExitCode() + ": " + result));
          }
        }
        if(remoteStagingLocation == null) {
          Preconditions.checkState(mDrones.isEmpty(), "If remote staging location is not set all drones should be bad");
          mLogger.warn("Unable to stage directory on remote host, all drones must be bad");
View Full Code Here

  RSyncResult copyFromDroneToLocal(Drone drone, String localFile, String remoteFile)
      throws SSHExecutionException, IOException {
    Map<String, String> templateVariables = Maps.newHashMap(mTemplateDefaults);
    templateVariables.put("instanceName", drone.getInstanceName());
    templateVariables.put("localDir", drone.getLocalDirectory());
    RSyncResult result = new RSyncCommand(mRSyncCommandExecutor, drone.getPrivateKey(), drone.getUser(),
        drone.getHost(), drone.getInstance(),
        Templates.getTemplateResult(localFile, templateVariables),
        Templates.getTemplateResult(remoteFile, templateVariables),
        RSyncCommand.Type.TO_LOCAL).call();
    if(result.getException() != null || result.getExitCode() != Constants.EXIT_CODE_SUCCESS) {
      throw new SSHExecutionException(result);
    }
    return result;
  }
View Full Code Here

  RSyncResult copyToDroneFromLocal(Drone drone, String localFile, String remoteFile)
      throws AbortDroneException, SSHExecutionException, IOException {
    Map<String, String> templateVariables = Maps.newHashMap(mTemplateDefaults);
    templateVariables.put("instanceName", drone.getInstanceName());
    templateVariables.put("localDir", drone.getLocalDirectory());
    RSyncResult result = new RSyncCommand(mRSyncCommandExecutor, drone.getPrivateKey(), drone.getUser(),
        drone.getHost(), drone.getInstance(),
        Templates.getTemplateResult(localFile, templateVariables),
        Templates.getTemplateResult(remoteFile, templateVariables),
        RSyncCommand.Type.FROM_LOCAL).call();
    if(result.getExitCode() != Constants.EXIT_CODE_SUCCESS) {
      throw new AbortDroneException("Drone " + drone + " exited with " +
          result.getExitCode() + ": " + result);
    }
    if(result.getException() != null || result.getExitCode() != 0) {
      throw new SSHExecutionException(result);
    }
    return result;
  }
View Full Code Here

          Preconditions.checkState(remoteStagingLocation == null, "Remote staging location must be null at the start of the loop");
          final Map<String, String> templateVariables = Maps.newHashMap(mTemplateDefaults);
          templateVariables.put("instanceName", drone.getInstanceName());
          templateVariables.put("localDir", drone.getLocalDirectory());
          String resolvedRemoteLocation = Files.simplifyPath(Templates.getTemplateResult(remoteFile, templateVariables));
          RSyncResult result = new RSyncCommand(mRSyncCommandExecutor, drone.getPrivateKey(), drone.getUser(),
              drone.getHost(), drone.getInstance(),
              resolvedLocalLocation,
              resolvedRemoteLocation,
              RSyncCommand.Type.FROM_LOCAL).call();
          if(result.getExitCode() == Constants.EXIT_CODE_SUCCESS) {
            remoteStagingLocation = resolvedRemoteLocation;
            drones.remove(drone);
            mLogger.info("Successfully staged " + resolvedLocalLocation + " on " + remoteStagingLocation);
            break;
          } else {
            mDrones.remove(drone);
            mLogger.error("Aborting drone during rsync",
                new AbortDroneException("Drone " + drone + " exited with "
                    + result.getExitCode() + ": " + result));
          }
        }
        if(remoteStagingLocation == null) {
          Preconditions.checkState(mDrones.isEmpty(), "If remote staging location is not set all drones should be bad");
          mLogger.warn("Unable to stage directory on remote host, all drones must be bad");
View Full Code Here

  RSyncResult copyFromDroneToLocal(Drone drone, String localFile, String remoteFile)
      throws SSHExecutionException, IOException {
    Map<String, String> templateVariables = Maps.newHashMap(mTemplateDefaults);
    templateVariables.put("instanceName", drone.getInstanceName());
    templateVariables.put("localDir", drone.getLocalDirectory());
    RSyncResult result = new RSyncCommand(mRSyncCommandExecutor, drone.getPrivateKey(), drone.getUser(),
        drone.getHost(), drone.getInstance(),
        Templates.getTemplateResult(localFile, templateVariables),
        Templates.getTemplateResult(remoteFile, templateVariables),
        RSyncCommand.Type.TO_LOCAL).call();
    if(result.getException() != null || result.getExitCode() != Constants.EXIT_CODE_SUCCESS) {
      throw new SSHExecutionException(result);
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of org.apache.hive.ptest.execution.ssh.RSyncResult

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.