use of com.sequenceiq.cloudbreak.cloud.exception.TemplatingNotSupportedException in project cloudbreak by hortonworks.
the class RedbeamsCreationService method saveDbStack.
private DBStack saveDbStack(DBStack dbStack) {
// possible future change is to use a flow here (GetPlatformTemplateRequest, modified for database server)
// for now, just get it synchronously / within this thread, it ought to be quick
CloudPlatformVariant platformVariant = new CloudPlatformVariant(dbStack.getCloudPlatform(), dbStack.getPlatformVariant());
try {
CloudConnector<Object> connector = cloudPlatformConnectors.get(platformVariant);
if (connector == null) {
throw new RedbeamsException("Failed to find cloud connector for platform variant " + platformVariant);
}
String template = connector.resources().getDBStackTemplate();
if (template == null) {
throw new RedbeamsException("No database stack template is available for platform variant " + platformVariant);
}
dbStack.setTemplate(template);
} catch (TemplatingNotSupportedException e) {
throw new RedbeamsException("Failed to retrieve database stack template for cloud platform", e);
}
DatabaseServer databaseServer = dbStack.getDatabaseServer();
if (databaseServer.getConnectionDriver() == null) {
String connectionDriver = databaseServer.getDatabaseVendor().connectionDriver();
databaseServer.setConnectionDriver(connectionDriver);
LOGGER.info("Database server allocation request lacked a connection driver; defaulting to {}", connectionDriver);
}
return dbStackService.save(dbStack);
}
use of com.sequenceiq.cloudbreak.cloud.exception.TemplatingNotSupportedException in project cloudbreak by hortonworks.
the class TemplateHandler method accept.
@Override
public void accept(Event<GetPlatformTemplateRequest> platformTemplateRequestEvent) {
LOGGER.debug("Received event: {}", platformTemplateRequestEvent);
GetPlatformTemplateRequest request = platformTemplateRequestEvent.getData();
String template = null;
try {
CloudConnector<Object> connector = cloudPlatformConnectors.get(request.getCloudContext().getPlatformVariant());
if (connector != null) {
template = connector.resources().getStackTemplate();
}
} catch (TemplatingNotSupportedException ignored) {
}
GetPlatformTemplateResult getPlatformTemplateResult = new GetPlatformTemplateResult(request.getResourceId(), template);
request.getResult().onNext(getPlatformTemplateResult);
LOGGER.debug("Get template finished.");
}
Aggregations