You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Ignasi Barrera (Jira)" <ji...@apache.org> on 2019/10/01 10:01:00 UTC

[jira] [Commented] (JCLOUDS-1517) google could - can't handle service account without scopes

    [ https://issues.apache.org/jira/browse/JCLOUDS-1517?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16941708#comment-16941708 ] 

Ignasi Barrera commented on JCLOUDS-1517:
-----------------------------------------

Thanks for reporting.

In the codebase, in general we favor empty collections versus null ones, so the fix should be as easy as changing that method to initialize the scopes to an empty list if the parameter is null. Something like:

{code}
@SerializedNames({ "email", "scopes" })
public static ServiceAccount create(String email, List<String> scopes) {
   return new AutoValue_Instance_ServiceAccount(email, copyOf(scopes));
}
{code}

Do you wanna try opening a pull request with the patch?

> google could - can't handle service account without scopes
> ----------------------------------------------------------
>
>                 Key: JCLOUDS-1517
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1517
>             Project: jclouds
>          Issue Type: Bug
>          Components: jclouds-labs-google
>            Reporter: Yasei
>            Priority: Major
>
> When getting the active instance list (listNodesDetailsMatching), the code is issuing an instanceAggregatedList request to google, expecting to get serviceAccounts with email and scopes - I have an example that does not have scopes, so the code fail with the below stack trace.
> This is a snippet from my response:
> serviceAccounts: [{
>     serviceAccounts: [{ email: elasticsearch - sa @ xx - xx - xxx.iam.gserviceaccount.com 
>   } 
> ],
> my other accounts do have scopes:
> serviceAccounts: [{
>   serviceAccounts: [{ email: xxx - compute @ developer.gserviceaccount.com, 
>   scopes: [ 
>     https: //www.googleapis.com/auth/cloud.useraccounts.readonly , 
>     https: //www.googleapis.com/auth/devstorage.read_only , 
>     https: //www.googleapis.com/auth/logging.write , 
>     https: //www.googleapis.com/auth/monitoring.write , 
>     https: //www.googleapis.com/auth/cloudruntimeconfig 
> ] } ],
> I guess 'scopes' should be optional.
> The code is this:
> [https://github.com/apache/jclouds/blob/master/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Instance.java#L164]
> Stack trace:
> SEVERE: Error parsing input: Null scopes
> java.lang.NullPointerException: Null scopes at org.jclouds.googlecomputeengine.domain.AutoValue_Instance_ServiceAccount.<init>(AutoValue_Instance_ServiceAccount.java:21) at org.jclouds.googlecomputeengine.domain.Instance$ServiceAccount.create(Instance.java:166) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.google.common.reflect.Invokable$MethodInvokable.invokeInternal(Invokable.java:197) at com.google.common.reflect.Invokable.invoke(Invokable.java:102) at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.newInstance(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:224) at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:204) at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.readAndBuild(NullFilteringTypeAdapterFactories.java:95) at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.read(NullFilteringTypeAdapterFactories.java:83) at org.jclouds.json.internal.NullFilteringTypeAdapterFactories$IterableTypeAdapter.read(NullFilteringTypeAdapterFactories.java:62) at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$ParameterReader.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:272) at org.jclouds.json.internal.DeserializationConstructorAndReflectiveTypeAdapterFactory$DeserializeIntoParameterizedConstructor.read(DeserializationConstructorAndReflectiveTypeAdapterFactory.java:184) at org.jclouds.googlecloud.config.ListPageAdapterFactory$ListPageAdapter.readItems(ListPageAdapterFactory.java:73) at org.jclouds.googlecloud.config.ListPageAdapterFactory$ListPageAdapter.readAggregate(ListPageAdapterFactory.java:89) at org.jclouds.googlecloud.config.ListPageAdapterFactory$ListPageAdapter.read(ListPageAdapterFactory.java:58) at org.jclouds.googlecloud.config.ListPageAdapterFactory$ListPageAdapter.read(ListPageAdapterFactory.java:36) at com.google.gson.Gson.fromJson(Gson.java:861) at com.google.gson.Gson.fromJson(Gson.java:826) at org.jclouds.json.internal.GsonWrapper.fromJson(GsonWrapper.java:55) at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:82) at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:76) at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:61) at org.jclouds.http.functions.ParseJson.apply(ParseJson.java:41) at com.google.common.base.Functions$FunctionComposition.apply(Functions.java:227) at org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73) at org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44) at org.jclouds.reflect.FunctionalReflection$FunctionalInvocationHandler.handleInvocation(FunctionalReflection.java:117) at com.google.common.reflect.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:87) at com.sun.proxy.$Proxy62.instances(Unknown Source) at org.jclouds.googlecomputeengine.compute.GoogleComputeEngineServiceAdapter.listNodes(GoogleComputeEngineServiceAdapter.java:250) at org.jclouds.compute.strategy.impl.AdaptingComputeServiceStrategies.listDetailsOnNodesMatching(AdaptingComputeServiceStrategies.java:122) at org.jclouds.compute.internal.BaseComputeService.listNodesDetailsMatching(BaseComputeService.java:352)
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)