> +
> +   @Inject
> +   public PBComputeServiceAdapter(ProfitBricksApi pbApi, Function<Template, 
> Server> templateToServer) {
> +      this.pbApi = checkNotNull(pbApi, "pbApi");
> +      this.templateToServer = checkNotNull(templateToServer, 
> "templateToServer");
> +   }
> +
> +   @Override
> +   public NodeAndInitialCredentials<Server> 
> createNodeWithGroupEncodedIntoName(String group, String name, Template 
> template) {
> +      Server serverToCreate = templateToServer.apply(template);
> +
> +      logger.trace(">> creating new server from template [%s]", 
> serverToCreate);
> +      String createdServerId = 
> pbApi.serversApi().createServer(serverToCreate);
> +      if (createdServerId == null) {
> +         logger.trace("<< server creation failed. template [%s]", 
> serverToCreate);
> +         return null;

Throw an exception here instead of silently returning null.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/72/files#r17228810

Reply via email to