You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jclouds.apache.org by John Calcote <jo...@gmail.com> on 2024/07/02 19:49:33 UTC

string interpolation broken in azureblob

Hi all,

We updated some libraries in our pom the other day and suddenly we talk to
azure blob. Turns out the endpoint for azure in the azureblob has an
interpolated variable for the host - like this:

   public static class Builder extends BaseProviderMetadata.Builder {
      protected Builder() {
            id("azureblob")
            .name("Microsoft Azure Blob Service")
            .apiMetadata(new AzureBlobApiMetadata())
            .endpoint("https://${" + ACCOUNT + "}.blob.core.windows.net")
...

where ACCOUNT is defined as:

public final class AzureStorageProperties {
    public static final String AUTH_TYPE = "jclouds.azureblob.auth";
    public static final String ACCOUNT = "jclouds.azureblob.account";

When we try to use jclouds against azure blob service, we get an error that
there's an invalid character ('$') in the endpoint. We can see that the ${
ACCOUNT } variable was not replaced.

Does anyone know which library is responsible for this? We're currently
trying to debug through it but it would help if we had a clue where to look
first.

Thanks,
John

Re: string interpolation broken in azureblob

Posted by Andrew Phillips <ap...@qrmedia.com>.
> Turns out the problem was that azureblob doesn't honor 
> CredentialSupplier like aws-s3.

Argh - glad you were able to figure it out!

ap

Re: string interpolation broken in azureblob

Posted by John Calcote <jo...@gmail.com>.
Turns out the problem was that azureblob doesn’t honor CredentialSupplier
like aws-s3. We changed to using CredentialSupplier instead of passing a
Credential and the username and password never make it into the context.

Easy to fix - hard to find.

Thanks for the quick response.

John

On Tue, Jul 2, 2024 at 7:19 PM Andrew Phillips <ap...@qrmedia.com>
wrote:

> > but still digging through that.
>
> Looks like ExpandProperties is where this happens:
>
>
> https://github.com/apache/jclouds/blob/master/core/src/main/java/org/jclouds/functions/ExpandProperties.java
>
> Given that this hasn't changed and probably isn't broken given how
> widely it's used, my first question would be whether the
> "jclouds.azureblob.account" property is set and available to jclouds
> somehow?
>
> Regards
>
> ap
>

Re: string interpolation broken in azureblob

Posted by Andrew Phillips <ap...@qrmedia.com>.
> but still digging through that.

Looks like ExpandProperties is where this happens:

https://github.com/apache/jclouds/blob/master/core/src/main/java/org/jclouds/functions/ExpandProperties.java

Given that this hasn't changed and probably isn't broken given how 
widely it's used, my first question would be whether the 
"jclouds.azureblob.account" property is set and available to jclouds 
somehow?

Regards

ap

Re: string interpolation broken in azureblob

Posted by Andrew Phillips <ap...@qrmedia.com>.
> Does anyone know which library is responsible for this?

Judging by testVariablesReplaceOnEndpoint() in ContextBuilderTest [1], I 
suspect jclouds is doing this itself. I'm assuming it's somewhere in 
ContextBuilder [2] but still digging through that.

Hope that helps!

ap

[1] 
https://github.com/apache/jclouds/blob/master/core/src/test/java/org/jclouds/ContextBuilderTest.java
[2] 
https://github.com/apache/jclouds/blob/master/core/src/main/java/org/jclouds/ContextBuilder.java