jclouds-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ignasi Barrera <n...@apache.org>
Subject Re: Fwd: issue with new google cloud credential
Date Tue, 24 Nov 2015 21:53:30 GMT
That was mentioned recently in the IRC channel but I can't find a JIRA
issue for it. Mind creating the issue yourself?

The problem is in the client id. jclouds parses it to extract the project
id and the regular expression used does not match. I tried to reproduce the
issue but the accounts I create don't have that conflicting "iam" thing.

This said, there is an easy workaround: just set this property [1] when
creating the context to preconfigure the project id; if the property is set
jclouds won't try to parse the client id to extract the project id.

Just FTR, this [2] is the code that parses the client id and fails. Feel
free to fix it and send a pull request!

In any case, please file the JIRA issue.

HTH!

I.

[1]
https://github.com/jclouds/jclouds/blob/master/common/googlecloud/src/main/java/org/jclouds/googlecloud/config/GoogleCloudProperties.java#L31-36
[2]
https://github.com/jclouds/jclouds/blob/master/common/googlecloud/src/main/java/org/jclouds/googlecloud/config/CurrentProject.java
El 24/11/2015 22:36, "Subhadip Bagui" <i.bagui@gmail.com> escribió:

> This is the code part I'm using.
>
> public static ComputeServiceContext getGoogleClient(){
> String provider = "google-compute-engine";
>    String identity = "account-2@projectId.iam.gserviceaccount.com";
>    String credential = "D:/Project/gCloud/ACE-Project-4bd232d73860.json";
>    credential = getCredentialFromJsonKeyFile(credential);
>
>    Properties googleProperties = overrideGoogleCloudProperties();
>
>         ComputeServiceContext computeContext =
>                 ContextBuilder.newBuilder(provider)
>                     .credentials(identity, credential)
>                     .modules(
>                         ImmutableSet.<Module> of(new
> SshjSshClientModule()/*, new SLF4JLoggingModule()*/))
>                     .overrides(googleProperties).buildView(
>                         ComputeServiceContext.class);
> return computeContext;
> }
>
> public static Set<? extends Image> getImages(ComputeService compute){
> Set<? extends Image> images = compute.listImages();
> for(Image image : images){
> // System.out.println("Image got as:: id=" +image.getId()+";
> name="+image.getName());
> System.out.println("Image got as:: "+image);
> }
> return images;
> }
>
> Regards,
> Subhadip
>
>
> -------------------------------------------------------------------------------------------------------------------
>
> ---------- Forwarded message ----------
> From: Subhadip Bagui <i.bagui@gmail.com>
> Date: Mon, Nov 23, 2015 at 11:16 AM
> Subject: issue with new google cloud credential
> To: user-help@jclouds.apache.org, user@jclouds.apache.org
>
>
> Hi,
>
> I'm using Jclouds version 1.9.1 and for GCE we are having one working use
> case.
>
> Now since my google account got expired I have created a new service
> account.
>
> Since then I'm getting the below issue. I'm having trouble to fix the
> issue.
> As in jcloulds and GCE API as well it's expecting the email as
> xxx@developer.gserviceaccount.com to validate the credential.
>
> *Client email account-2@ace-project-xxxx.iam.gserviceaccount.com
> <account-2@ace-project-xxxx.iam.gserviceaccount.com> is malformed. Should
> be client_email*
> * which usually looks like project_id@developer.gserviceaccount.com
> <project_id@developer.gserviceaccount.com> or
> project_id-extended_uid@developer.gserviceaccount.com
> <project_id-extended_uid@developer.gserviceaccount.com> *
>
>
> Regards,
> Subhadip
>
>
> -------------------------------------------------------------------------------------------------------------------
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message