Package org.platformlayer.ops

Examples of org.platformlayer.ops.OpsException


      // return address;
      // }
      // }

      if (addresses.size() != 1) {
        throw new OpsException("Found multiple addresses: " + Joiner.on(",").join(addresses));
      }
      networkPoint = NetworkPoint.forAddress(addresses.get(0));
    }
    return networkPoint;
  }
View Full Code Here


            ManagedItemRepository repository = opsSystem.getManagedItemRepository();
            try {
              boolean fetchTags = true;
              item = repository.getManagedItem(targetItemKey, fetchTags, SecretProvider.from(project));
            } catch (RepositoryException e) {
              throw new OpsException("Error reading item from repository", e);
            }

            if (item == null) {
              throw new WebApplicationException(404);
            }
View Full Code Here

    try {
      OpenstackSession session = buildOpenstackSession(cloud);

      return session.getComputeClient();
    } catch (OpenstackException e) {
      throw new OpsException("Error connecting to OpenStack compute API", e);
    }
  }
View Full Code Here

    try {
      OpenstackSession session = buildOpenstackSession(cloud);

      return session.getImageClient();
    } catch (OpenstackException e) {
      throw new OpsException("Error connecting to OpenStack image API", e);
    }
  }
View Full Code Here

    try {
      log.info("Listing security groups");

      securityGroups = openstackComputeClient.root().securityGroups().list();
    } catch (OpenstackException e) {
      throw new OpsException("Error getting security groups for server", e);
    }

    SecurityGroup securityGroup = null;
    if (securityGroups != null && securityGroups.getList() != null) {
      for (SecurityGroup candidate : securityGroups.getList()) {
        if (candidate.getName() == null) {
          continue;
        }

        if (candidate.getName().equals(OpenstackCloudContext.SECURITY_GROUP_PREFIX + server.getName())) {
          securityGroup = candidate;
          break;
        }

        // if (candidate.getName().startsWith(OpenstackCloudContext.SECURITY_GROUP_PREFIX)) {
        // securityGroup = candidate;
        // break;
        // }
      }
    }

    if (securityGroup == null) {
      throw new OpsException("Could not find platform layer security group for server: " + server);
    }

    return securityGroup;
  }
View Full Code Here

      compute.root().keyPairs().create(create);
    }

    keyPair = findPublicKey(compute, sshPublicKey);
    if (keyPair == null) {
      throw new OpsException("Created key pair was not found");
    }

    return keyPair;
  }
View Full Code Here

        // if (Objects.equal(sqlState, "42P04")) {
        // log.info("Database already exists");
        // return false;
        // }
        log.info("Unknown code: " + sqlState);
        throw new OpsException("Error checking if database exists", e);
      }
    }

    try {
      String sql = "CREATE DATABASE " + databaseName;
      String maskedSql = sql;

      // No point trying to connect to the database we're trying to create!
      String runInDatabase = "postgres";

      execute((SshOpsTarget) target, username, password, runInDatabase, sql, maskedSql);

      return true;
    } catch (SQLException e) {
      String sqlState = e.getSQLState();
      // if (execution.getExitCode() == 1 && execution.getStdErr().contains("already exists")) {
      // log.info("Database already exists");
      // return;
      // }

      if (Objects.equal(sqlState, "XX000")) {
        log.info("Database already exists");
        return false;
      }
      if (Objects.equal(sqlState, "42P04")) {
        log.info("Database already exists");
        return false;
      }
      log.info("Unknown code: " + sqlState);
      throw new OpsException("Error creating database", e);
    }
  }
View Full Code Here

      if (serviceAuthorization == null) {
        serviceAuthorization = new ServiceAuthorization();
        serviceAuthorization.serviceType = serviceConfiguration.getServiceType().getKey();
      }
    } catch (RepositoryException e) {
      throw new OpsException("Error reading from repository", e);
    }

    // OpsConfig opsConfig = OpsConfig.build(serviceAuthorization);
    // UserInfo userInfo = new SimpleUserInfo(auth, opsConfig);
View Full Code Here

  public List<X509Certificate> signCsr(ProjectEntity project, String csr) throws OpsException {
    CertificateAndKey projectPki;
    try {
      projectPki = repository.getProjectPki(project);
    } catch (RepositoryException e) {
      throw new OpsException("Error getting project PKI info", e);
    }

    SimpleCertificateAuthority ca = new SimpleCertificateAuthority();
    ca.caCertificate = projectPki.getCertificateChain();
    ca.caPrivateKey = projectPki.getPrivateKey();
View Full Code Here

            OpsTarget adminTarget = getAdminTarget(rootTarget, machine);
            doOperation(adminTarget, operation);
        }

        if (failed) {
            throw new OpsException("Could not update all DNS servers in cluster").setRetry(TimeSpan.ONE_MINUTE);
        }
    }
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.