Esempio n. 1
0
  private void verifyGerrit(String verify_value, String message, String revision)
      throws IOException {

    File privateKeyFile = new File(private_key_file_path);
    SSHMarker marker = new SSHMarker();
    marker.connect(gerrit_host, gerrit_port);
    marker.authenticate(gerrit_username, privateKeyFile, passPhrase);
    String command = String.format(gerrit_approve_command, verify_value, message, revision);
    marker.executeCommand(command);
    marker.disconnect();
  }
Esempio n. 2
0
    public FormValidation doCheckPassPhrase(@QueryParameter String value) {

      if (path_to_private_key_file == null) {
        return FormValidation.error("Define path to private key file first");
      }
      File f = new File(path_to_private_key_file);
      if (!f.exists()) {
        return FormValidation.error("No private key file");
      }
      if (!SSHMarker.IsPrivateKeyFileValid(f)) {
        return FormValidation.error("Private key file is not valid");
      }
      if (!SSHMarker.CheckPassPhrase(f, value)) {
        return FormValidation.error("Passphrase is not valid");
      }
      return FormValidation.ok();
    }
Esempio n. 3
0
    public FormValidation doCheckPrivate_key_file_path(@QueryParameter String value) {
      if (value.length() == 0) {
        return FormValidation.error("Please set a path to private key file");
      }
      File f = new File(value);
      if (!f.exists()) {
        return FormValidation.error("File doesn't exists");
      }
      if (!SSHMarker.IsPrivateKeyFileValid(f)) {
        return FormValidation.error("Private key file is not valid");
      }
      path_to_private_key_file = value;

      return FormValidation.ok();
    }