Skip to content

Commit

Permalink
fix jclouds azure credentials problem
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoran10 committed Nov 25, 2020
1 parent 12d4a3b commit b2635cf
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 b2635cf

Please sign in to comment.