Package org.platformlayer.ops

Examples of org.platformlayer.ops.OpsException


        persistentInstance.setDnsName(model.dnsName);

        try {
            platformLayer.create(persistentInstance);
        } catch (OpenstackClientException e) {
            throw new OpsException("Error registering persistent instance", e);
        }
    }
View Full Code Here


      int port = ZookeeperConstants.ZK_PUBLIC_PORT;
      List<EndpointInfo> endpoints = EndpointInfo.findEndpoints(zookeeperServer.getTags(), port);

      EndpointInfo endpoint = EndpointChooser.any().choose(endpoints);
      if (endpoint == null) {
        throw new OpsException("Cannot find endpoint for zookeeper");
      }

      InetSocketAddress socketAddress = endpoint.asSocketAddress();

      {
View Full Code Here

      // throw new OpsException("Interrupted while reading zookeeper", e);
      // }
      // return data;
    } catch (Exception e) {
      // Ugh ... let's hide Netflix's sins...
      throw new OpsException("Error reading zookeeper", e);
    }
  }
View Full Code Here

      // Thread.currentThread().interrupt();
      // throw new OpsException("Interrupted while reading zookeeper", e);
      // }
    } catch (Exception e) {
      // Ugh ... let's hide Netflix's sins...
      throw new OpsException("Error writing zookeeper", e);
    }

    // try {
    // try {
    // zk.setData(zkPath, data, -1);
View Full Code Here

    CuratorFramework curatorFramework;
    try {
      curatorFramework = builder.build();
    } catch (IOException e) {
      throw new OpsException("Error building zookeeper connection", e);
    }

    return curatorFramework;
    // TimeSpan sessionTimeout = TimeSpan.TEN_SECONDS;
    //
View Full Code Here

    {
      RunScript script = dbConnection.addChild(RunScript.class);
      try {
        script.sql = ResourceUtils.get(getClass(), "auth_schema.sql");
      } catch (IOException e) {
        throw new OpsException("Error loading SQL script resource", e);
      }

    }
  }
View Full Code Here

      for (OwnedItem<?> childServer : parentController.getChildren(OwnedItem.class)) {
        ItemBase server = childServer.getItem();
        if (server == null) {
          // TODO: It's _possible_ that the child is ready instantly.
          // Right now, we have to go through a retry cycle
          throw new OpsException("Child server not ready");
        }
        List<EndpointInfo> endpoints = EndpointInfo.findEndpoints(server.getTags(), port);
        if (endpoints.isEmpty()) {
          // TODO: Cope in future e.g. if we only need one of two in a cluster
          throw new OpsException("Child server not ready");
        }

        // if (endpoints.size() != 1) {
        // throw new OpsException("Expected exactly one endpoint");
        // }
View Full Code Here

  public void copyTo0(OpsTarget target, File remoteFilePath) throws OpsException {
    InetAddress host;
    try {
      host = InetAddress.getByName(uri.getHost());
    } catch (UnknownHostException e) {
      throw new OpsException("Unable to resolve host: " + uri, e);
    }

    if (InetAddressUtils.isPublic(host)) {
      CurlRequest curlRequest = new CurlRequest(uri);
      curlRequest.bareRequest = true;
      CommandEnvironment commandEnvironment = httpProxies.getHttpProxyEnvironment(target, Usage.General, uri);

      Command curlCommand = curlRequest.toCommand();
      curlCommand.addLiteral(">");
      curlCommand.addFile(remoteFilePath);
      curlCommand.setEnvironment(commandEnvironment);
      curlCommand.setTimeout(TimeSpan.FIVE_MINUTES);

      target.executeCommand(curlCommand);
    } else {
      log.warn("Address was not public: " + host + ", doing copy via ops system");

      File tempFile;
      try {
        tempFile = File.createTempFile("jenkins", "dat");
      } catch (IOException e) {
        throw new OpsException("Error creating temp file", e);
      }
      try {
        InputStream is = uri.toURL().openStream();
        try {
          IoUtils.copyStream(is, tempFile);
        } finally {
          Closeables.closeQuietly(is);
        }

        FileUpload.upload(target, remoteFilePath, tempFile);
      } catch (IOException e) {
        throw new OpsException("Error copying jenkins artifact", e);
      } finally {
        tempFile.delete();
      }
    }
View Full Code Here

    InputStream input = null;
    try {
      input = openSourceStream();
      return CryptoUtils.md5(input);
    } catch (IOException e) {
      throw new OpsException("Error computing hash", e);
    } finally {
      IoUtils.safeClose(input);
    }
  }
View Full Code Here

  @Override
  public void bringToMachine(String imageId, OpsTarget destination, File destinationPath) throws OpsException {
    Properties imageProperties = fileStore.readProperties(imageId);
    if (imageProperties == null) {
      throw new OpsException("Image not found: " + imageId);
    }

    File imageFile = getImageFile(imageId, imageProperties);

    // TODO: Local caching???
View Full Code Here

TOP

Related Classes of org.platformlayer.ops.OpsException

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.