Skip to content

Commit

Permalink
[Tiered Storage] Fix Jclouds Azure credential error (#8693)
Browse files Browse the repository at this point in the history
### Motivation

Currently, the tiered storage Azure credential is broken.

### Modifications

Change the Azure supplier credential.

(cherry picked from commit bf9f619)
  • Loading branch information
gaoran10 authored and codelipenghui committed Nov 26, 2020
1 parent 62fde99 commit caede24
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ public static BlobStoreManagedLedgerOffloader create(TieredStorageConfiguration
config.getBucket(), config.getRegion());

blobStores.putIfAbsent(config.getBlobStoreLocation(), config.getBlobStore());
log.info("The ledger offloader was created.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,21 @@ public void validate(TieredStorageConfiguration config) throws IllegalArgumentEx

@Override
public BlobStore getBlobStore(TieredStorageConfiguration config) {
return BLOB_STORE_BUILDER.getBlobStore(config);
ContextBuilder contextBuilder = ContextBuilder.newBuilder(config.getProviderMetadata());
contextBuilder.overrides(config.getOverrides());

if (config.getProviderCredentials() != null) {
Credentials credentials = config.getProviderCredentials().get();
return contextBuilder
.credentials(credentials.identity, credentials.credential)
.buildView(BlobStoreContext.class)
.getBlobStore();
} else {
log.warn("The credentials is null. driver: {}, bucket: {}", config.getDriver(), config.getBucket());
return contextBuilder
.buildView(BlobStoreContext.class)
.getBlobStore();
}
}

@Override
Expand Down Expand Up @@ -254,11 +268,12 @@ public ProviderMetadata getProviderMetadata() {
.credentialsSupplier(config.getCredentials())
.buildView(BlobStoreContext.class)
.getBlobStore();
} else {
return contextBuilder
.buildView(BlobStoreContext.class)
.getBlobStore();
}
} else {
log.warn("The credentials is null. driver: {}, bucket: {}", config.getDriver(), config.getBucket());
return contextBuilder
.buildView(BlobStoreContext.class)
.getBlobStore();
}

};

Expand Down

0 comments on commit caede24

Please sign in to comment.